[range] small clarification in documentation for how to write a range adaptor

[SVN r82315]
This commit is contained in:
Nathan Ridge
2013-01-02 08:05:30 +00:00
parent 61979ff421
commit 958b4fbf6e
3 changed files with 11 additions and 1 deletions

View File

@ -147,7 +147,7 @@
</p> </p>
</div> </div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: January 02, 2013 at 07:48:08 GMT</small></p></td> <td align="left"><p><small>Last revised: January 02, 2013 at 08:04:07 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td> <td align="right"><div class="copyright-footer"></div></td>
</tr></table> </tr></table>
<hr> <hr>

View File

@ -90,6 +90,12 @@
<span class="keyword">const</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">reverse_forwarder</span> <span class="identifier">reversed</span> <span class="special">=</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">reverse_forwarder</span><span class="special">();</span> <span class="keyword">const</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">reverse_forwarder</span> <span class="identifier">reversed</span> <span class="special">=</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">reverse_forwarder</span><span class="special">();</span>
<span class="special">}</span> <span class="special">}</span>
</pre> </pre>
Note that this last step only applies if the adaptor takes no arguments.
If the adaptor takes arguments (such as <code class="computeroutput"><span class="identifier">indexed</span></code>),
then there is no need for a variable. Instead, give the tag type
a constructor that takes the arguments (and store those arguments
in the tag object). A usage of the adaptor will then involve construction
of an object of the tag type.
</li> </li>
</ol></div> </ol></div>
</div> </div>

View File

@ -225,6 +225,10 @@ namespace
const detail::reverse_forwarder reversed = detail::reverse_forwarder(); const detail::reverse_forwarder reversed = detail::reverse_forwarder();
} }
`` ``
Note that this last step only applies if the adaptor takes no arguments. If the adaptor takes arguments
(such as `indexed`), then there is no need for a variable. Instead, give the tag type a
constructor that takes the arguments (and store those arguments in the tag object). A usage
of the adaptor will then involve construction of an object of the tag type.
[endsect] [endsect]