You can sort using any predicate function. Here are some examples from code I am working with: struct greater_magnitude { bool operator()(const CTFARect& x, const CTFARect& y) const { return (fabs(x.Value()) > fabs(y.Value())); } }; std::list m_lstRects; ... m_lstRects.sort(greater_magnitude()); In your case, you'd define struct my_comparison_predicate with member bool my_comparison_predicate::operator()(const CTFARect *x, const CTFARect * y) const after my example above. But to use this, you have to fix some bugs in the Microsoft standard C++ library. Look at Dunkumware's list of bug fixes for the VC++ standard library. Edit the standard library headers in "Program Files\Microsoft Visual Studio\vc98\include" to implement the fixes on the Dinkumware page. Then, you must edit the file "list" thus to allow the use of predicates:
*** list Tue Jun 27 23:50:23 2000
--- list.original Mon Jun 15 05:00:00 1998
***************
*** 281,288 ****
erase(_F++);
else
++_F; }
! // typedef binder2nd<not_equal_to<_Ty> > _Pr1; // Fixed 2000 06 27 JMG
! template<class _Pr1> void remove_if(_Pr1 _Pr) // Fixed 2000 06 27 JMG
{iterator _L = end();
for (iterator _F = begin(); _F != _L; )
if (_Pr(*_F))
--- 281,288 ----
erase(_F++);
else
++_F; }
! typedef binder2nd<not_equal_to<_Ty> > _Pr1;
! void remove_if(_Pr1 _Pr)
{iterator _L = end();
for (iterator _F = begin(); _F != _L; )
if (_Pr(*_F))
***************
*** 297,304 ****
erase(_M);
else
_F = _M; }
! // typedef not_equal_to<_Ty> _Pr2; // Fixed 2000 06 27 JMG
! template<class _Pr2> void unique(_Pr2 _Pr) // Fixed 2000 06 27 JMG
{iterator _F = begin(), _L = end();
if (_F != _L)
for (iterator _M = _F; ++_M != _L; _M = _F)
--- 297,304 ----
erase(_M);
else
_F = _M; }
! typedef not_equal_to<_Ty> _Pr2;
! void unique(_Pr2 _Pr)
{iterator _F = begin(), _L = end();
if (_F != _L)
for (iterator _M = _F; ++_M != _L; _M = _F)
***************
*** 321,328 ****
_Splice(_L1, _X, _F2, _L2);
_Size += _X._Size;
_X._Size = 0; }}
! // typedef greater<_Ty> _Pr3; // Fixed 2000 06 27 JMG
! template<class _Pr3> void merge(_Myt& _X, _Pr3 _Pr) // Fixed 2000 06 27 JMG
{if (&_X