Boost logo

Boost :

From: brangdon_at_[hidden]
Date: 2001-12-04 17:53:12


In-Reply-To: <E16At77-0004r9-00_at_[hidden]>
On Mon, 3 Dec 2001 16:26:28 +0300 Vladimir Prus (ghost_at_[hidden]) wrote:
> > > There are two problems, good solutions for which I'm yet to hear:
> > > [name clashes between sequence and iterator versions]
> >
> > I guess we have to put the sequence algorithms into their own
> > namespace.
>
> This is embarassing/inelegant. Consider writing
> container_algorithms::sort(.....), and repeating that prefix in
> everywhere....
> OTOH, provided there's no "using namespace std" somewhere, you can say
> "using namespace container_algorithms" and enjoy. I'm not sure....

Does a traits approach solve it? We can write:

   boost::adjacent_find( v.begin(), v.end() );
   boost::adjacent_find( boost::make_seq(v), BinaryPredicate);

and have the algorithm use traits to decide whether it has been given a
pair of iterators or a single sequence.

This implies boost may need a version of the std algorithms even if it
doesn't rewrite them to use sequences internally. Of course, it can just
forward to the std implementation if we decide not do that.

Dave Harris


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