M
Math Preregistration System
I'm using a std::list as a container for some pointers to objects, for
example
list< C* > lst;
I would like to sort them using two different criteria, say first by
C.first and then by C.second. Is it possible to use template <class C>
void list::sort( C fn ) and define two different fns, and use them
something like
lst.sort< C >( sortOnFirst() );
lst.sort< C >( sortOnSecond() ):
or am I not on the right track? I don't understand exactly how this
works. Alternatively, I can use a vector and std::sort() if you can
convince me it would be a better idea, but the main point is that I need
to sort according to two different criteria.
Thanks for you input!
Tim Partridge
example
list< C* > lst;
I would like to sort them using two different criteria, say first by
C.first and then by C.second. Is it possible to use template <class C>
void list::sort( C fn ) and define two different fns, and use them
something like
lst.sort< C >( sortOnFirst() );
lst.sort< C >( sortOnSecond() ):
or am I not on the right track? I don't understand exactly how this
works. Alternatively, I can use a vector and std::sort() if you can
convince me it would be a better idea, but the main point is that I need
to sort according to two different criteria.
Thanks for you input!
Tim Partridge