[Boost-bugs] [Boost C++ Libraries] #1544: uniform_01 w/ref template param causes ref to ref error

Subject: [Boost-bugs] [Boost C++ Libraries] #1544: uniform_01 w/ref template param causes ref to ref error
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-12-28 14:06:16


#1544: uniform_01 w/ref template param causes ref to ref error
-----------------------------------------------+----------------------------
 Reporter: Neal Becker <ndbecker2_at_[hidden]> | Type: Bugs
   Status: new | Milestone: Boost 1.36.0
Component: random | Version: Boost 1.34.1
 Severity: Problem | Keywords:
-----------------------------------------------+----------------------------
 From uniform_01 doc:
 WARNING: As an exception / historic accident, this class takes a
 UniformRandomNumberGenerator 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
 UniformRandomNumberGenerator.

 OK, but what about:
 from uniform_01.hpp:
   base_type& base() { return _rng; }

 So, for example:
 #include <boost/random.hpp>

 typedef boost::mt19937 rng_t;
 struct F {
   F (rng_t & r) :
     gen (r){}

   double operator()() { return gen(); }

   boost::uniform_01<rng_t&> gen;
 };


 /usr/local/src/boost.hg/boost/random/uniform_01.hpp:53: error: forming
 reference to reference type ‘rng_t&’

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1544>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.


This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC