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. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==

    List of lists of lists of lists...

    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==, May 8, 2006, in forum: Python
    Replies:
    5
    Views:
    431
    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==
    May 15, 2006
  2. Replies:
    2
    Views:
    1,475
    James Kanze
    Jul 6, 2010
  3. Jason
    Replies:
    0
    Views:
    405
    Jason
    Oct 4, 2006
  4. Tom Kirchner

    sorting by multiple criterias (sub-sorting)

    Tom Kirchner, Oct 11, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    500
    Michael Budash
    Oct 11, 2003
  5. Chris Weisiger

    Help with sorting lists of lists

    Chris Weisiger, Oct 14, 2004, in forum: Perl Misc
    Replies:
    7
    Views:
    142
    Tad McClellan
    Oct 14, 2004
Loading...

Share This Page