Boost C++ Libraries: Ticket #1544: uniform_01 w/ref template param causes ref to ref error https://svn.boost.org/trac10/ticket/1544 <p> From uniform_01 doc: WARNING: As an exception / historic accident, this class takes a <a class="missing wiki">UniformRandomNumberGenerator</a> as its constructor parameter, and BY VALUE. Usually, you want reference semantics so that the state of the passed-in generator is changed in-place and not copied. In that case, explicitly supply a reference type for the template parameter <a class="missing wiki">UniformRandomNumberGenerator</a>. </p> <p> OK, but what about: from uniform_01.hpp: </p> <blockquote> <p> base_type&amp; base() { return _rng; } </p> </blockquote> <p> So, for example: #include &lt;boost/random.hpp&gt; </p> <p> typedef boost::mt19937 rng_t; struct F { </p> <blockquote> <p> F (rng_t &amp; r) : </p> <blockquote> <p> gen (r){} </p> </blockquote> </blockquote> <blockquote> <p> double operator()() { return gen(); } </p> </blockquote> <blockquote> <p> boost::uniform_01&lt;rng_t&amp;&gt; gen; </p> </blockquote> <p> }; </p> <p> /usr/local/src/boost.hg/boost/random/uniform_01.hpp:53: error: forming reference to reference type ‘rng_t&amp;’ </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1544 Trac 1.4.3 Marshall Clow Sat, 09 Feb 2008 01:09:07 GMT owner set https://svn.boost.org/trac10/ticket/1544#comment:1 https://svn.boost.org/trac10/ticket/1544#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">No-Maintainer</span> </li> </ul> Ticket Steven Watanabe Thu, 19 Feb 2009 23:27:42 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1544#comment:2 https://svn.boost.org/trac10/ticket/1544#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/51337" title="Convert uniform_01 to the current distribution interface, dispatching ...">[51337]</a>) Convert uniform_01 to the current distribution interface, dispatching on the first template paramter to retain backwards compatibility. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/599" title="#599: Bugs: uniform_01 copies engine instead of using a reference (closed: fixed)">#599</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1544" title="#1544: Bugs: uniform_01 w/ref template param causes ref to ref error (closed: fixed)">#1544</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2679" title="#2679: Patches: boost::uniform_01 constructor (closed: fixed)">#2679</a> </p> Ticket