<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What you are looking for is a reversing adaptor, hence you probably<br>
should look at boost::adaptors::reversed, please see<br>
<a href="http://www.boost.org/doc/libs/1_46_1/libs/range/doc/html/range/reference/adaptors/reference/reversed.html" target="_blank">http://www.boost.org/doc/libs/<u></u>1_46_1/libs/range/doc/html/<u></u>range/reference/adaptors/<u></u>reference/reversed.html</a>.<br>

</blockquote>
<br></div>
No, the reversing adaptor doesn&#39;t work either. Remember I want to specify *at compile time* whether or not to reverse the range.<br>
<br></blockquote><div><br></div><div>Not only does the reverse adaptor work it can easily address your stated problem.Like this:</div><div><br></div><div><div>template&lt;typename RangeT, typename Cond&gt;</div><div>struct conditional_reverse_type_generator</div>
<div>{</div><div>� � typedef typename boost::mpl::if_&lt;</div><div>� � � � Cond,</div><div>� � � � boost::reversed_range&lt;RangeT&gt;,</div><div>� � � � boost::sub_range&lt;RangeT&gt;</div><div>� � &gt;::type type;</div>
<div>};</div><div><br></div><div>template&lt;typename Cond, typename RangeT&gt;</div><div>inline</div><div>typename conditional_reverse_type_generator&lt;RangeT,Cond&gt;::type</div><div>conditional_reverse(RangeT&amp; rng)</div>
<div>{</div><div>� � typedef typename conditional_reverse_type_generator&lt;RangeT,Cond&gt;::type result_type;</div><div>� � return result_type(rng);</div><div>}</div><div><br></div><div>template&lt;typename Cond, typename RangeT&gt;</div>
<div>inline</div><div>typename conditional_reverse_type_generator&lt;const RangeT,Cond&gt;::type</div><div>conditional_reverse(const RangeT&amp; rng)</div><div>{</div><div>� � typedef typename conditional_reverse_type_generator&lt;const RangeT,Cond&gt;::type result_type;</div>
<div>� � return result_type(rng);</div><div>}</div></div><div><br></div><div><br></div><div>�</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
If hypothetically there was a &quot;null&quot; range adapter, I could do something like:<br>
<br>
typedef boost::mpl::if_&lt;Reversed,<br>
 � �boost::adaptors::reversed,<br>
 � �boost::adaptors::null&gt;::type adaptor;<br>
<br>
boost::copy( adaptor(range) , ...);<br>
<br>
But that doesn&#39;t seem to exist either.<div class="im"><br></div></blockquote><div><br></div><div>I have never had the need for a null adaptor, and this would be the first request. I shall implement one for a later version of Boost since I can see a few use cases. However you need not wait, and I don&#39;t think it provides a better solution to your problem.</div>
<div>�</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Note that you could also use the reversed_range class directly.<br>
</blockquote>
<br></div></blockquote><div><br></div><div>It is implemented in a detail namespace, but is brought into the boost namespace. This changed from the first versions of Boost.Range with adaptors. By popular demand the return types of the adaptors are now all public documented types.</div>
<div>�</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"></div>
I make a point of never using anything in a detail namespace unless absolutely necessary. But even in this case I don&#39;t think it will help.<div><div></div><div class="h5"></div></div></blockquote><div><br></div><div>
You don&#39;t need to use anything in a detail namespace, and it does help ;-)</div><div>�</div><div>Regards,</div><div>Neil Groves</div></div><br>