Sorting lists of lists...

Discussion in 'C++' started by JustSomeGuy, Jun 17, 2004.

  1. JustSomeGuy

    JustSomeGuy Guest

    I have a class structure like:

    class image : public list<class element> {};

    class series : public list<class image>
    {
    public:
    bool operator< (const image & img) const
    {
    return (image_id < img.image_id);
    }
    };

    class study : public list<class series> {};
    class patient : public list<class study> {};
    class patients : public list<patient> {};

    So sorting the series class is quite simple I just:

    series s;
    s.sort();

    An unprocessed series can contain images from different studies and
    different patients.

    --------->>>> What I want to do is go through the series list and build
    up a a sorted patient list.... (patients please!)

    Within each image is a image_id, patient_id, series_id and a study_id.

    What is the best way to build up the patient list?

    I was thinking of modifying the series operator< and add the patient_id,
    study_id series_id, and image_id so that at least that
    list is completly sorted.... Then traverse the series list and populate
    the patient list... (class patients)

    Should I add a operator< to each class?

    What do you think?
     
    JustSomeGuy, Jun 17, 2004
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.