Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-10-11 01:54:21


Hi All,

I'm playing a little with some pointer containers and would like some
iterators s.t

class Base;
bool operator<( const Base& r, const Base& l );

ptr_vector<Base*> v;
v.push_back( new Derived );
// ...
std::sort( v.begin(), v.end() );

works by comparing derived Base objects while only copying the underlying
pointers of the container.
My attempt was to return another object from the iterators operator*() which
would

(a) compare objects instead of pointers
(b) copy pointers instead of objects

but it failed misserably.

Does anybody know if it is even possible to do it?

Thanks

Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk