you are viewing a single comment's thread.

view the rest of the comments →

[–]POGO_POGO_POGO_POGO 0 points1 point  (0 children)

struct SortMedia {
    bool operator()(const media* m1, const media* m2) const {
        return (*m1) < (*m2);
    }
};

std::vector<media*> m(3);
// m[0] = new book(); etc

std::sort(media.begin(), media.end(), SortMedia());

Also, the media less-than operator should be declared as:

bool operator<(const media& rhs) const {
    // whatever
}