Boost logo

Boost Users :

Subject: Re: [Boost-users] [Range] Select forward or reverse traversal at compile time?
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2011-06-30 00:32:26


> > What you are looking for is a reversing adaptor, hence you probably
> > should look at boost::adaptors::reversed, please see
> > http://www.boost.org/doc/libs/1_46_1/libs/range/doc/html/range/reference/adaptors/reference/reversed.html.
>
> No, the reversing adaptor doesn't work either. Remember I want to
> specify *at compile time* whether or not to reverse the range.
>
> If hypothetically there was a "null" range adapter, I could do something
> like:
>
> typedef boost::mpl::if_<Reversed,
> boost::adaptors::reversed,
> boost::adaptors::null>::type adaptor;
>
> boost::copy( adaptor(range) , ...);
>
> But that doesn't seem to exist either.

The Pstade Oven library (a Boost.Range extension library) has an "identity"
adaptor:
http://p-stade.sourceforge.net/oven/doc/html/oven/range_adaptors.html#oven.range_adaptors.identities
 
This library may one day become part of Boost.Range.
 
Nate.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net