> bool FormatsCompare( Format const & a, Format const & b )
> {
> return( a.name < b.name );
> }
> and then
> sort( formats_vec.begin(), formats_vec.end(), &FormatsCompare );
>
> And something similar for sorting Commands:
>
> bool CommandCompare( Command const & a, Command const & b )
> {
> if( a.from->prettyname == b.from->prettyname )
> return( a.to->prettyname < b.to->prettyname );
> else
> return( a.from->prettyname < b.from->prettyname );
> }
> sort( commands_vec.begin(), commands_vec.end(), &CommandCompare );
>
> Which all seems to work fine. Is your way "better"?
The functor object way is indeed "better" in some sense.
A function call through a pointer (as your solution uses) can not be
inlined, whereas the call to operator() can.
Of course this does not really matter in the given context so you should
choose whatever you like best.
Andre'
--
André Pönitz ........................................ [EMAIL PROTECTED]