On 30/06/11 02:32, Neil Groves wrote:
On Wed, Jun 29, 2011 at 1:19 PM, Alastair Rankine
mailto:arsptr@internode.on.net> wrote: Just to be clear, the desired output is: forward: abc reversed: abc
Surely you mean ha the reversed output would be: cba ?
No - the point is that I want to be able to specify at compile time (via the Reversed template argument) whether or not the range should be processed in reverse order. In the above example "reversed" refers to an array "cba" which has Reversed set to a true type, meaning that it should be processed in the reverse direction, producing "abc" Hope that is clear?
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/ada....
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_
Note that you could also use the reversed_range class directly.
I make a point of never using anything in a detail namespace unless absolutely necessary. But even in this case I don't think it will help.