[Boost-bugs] [Boost C++ Libraries] #7550: Vector of variate generators cannot be populated

Subject: [Boost-bugs] [Boost C++ Libraries] #7550: Vector of variate generators cannot be populated
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-10-22 00:03:56


#7550: Vector of variate generators cannot be populated
--------------------------------------------+-------------------------------
 Reporter: fenix.citizen@… | Owner: no-maintainer
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: random
  Version: Boost 1.48.0 | Severity: Problem
 Keywords: vector, STL, variate generator |
--------------------------------------------+-------------------------------
 As in the title, it is impossible to populate a vector of variate
 generators. I tried to combine Mersenne Twister with uniform_real
 distribution. The problem appears when using assignment operator. There is
 no problem when I try to populate STL list with the same objects. The same
 issue appears for fixed seed. I observed that simple assignment of one
 variate generator to another one is also impossible. Please find my code
 snippet below.

 {{{
         boost::mt19937 rng(static_cast<unsigned int>(time(0)));
         std::vector<boost::uniform_real<> > unifRealDistrVector;
         typedef boost::variate_generator<boost::mt19937&,
 boost::uniform_real<> > unifRealVarGen;

         std::vector<unifRealVarGen> unifRealVarGenVector;
         //std::list<unifRealVarGen> unifRealVarGenList;
         for (unsigned int iter = 0; iter < 6; iter++) {
                 boost::uniform_real<> unifRealDistr(0.0, iter);
                 unifRealVarGen varGen(rng, unifRealDistr);
                 unifRealVarGenVector.push_back(varGen);
                 //unifRealVarGenList.push_back(varGen);
         }
 }}}

 Error message I received is: [[BR]]
 /usr/include/boost/random/detail/pass_through_engine.hpp:26:7: error: non-
 static reference member ‘boost::random::mersenne_twister<unsigned int, 32,
 624, 397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18,
 3346425566u>&
 boost::random::detail::pass_through_engine<boost::random::mersenne_twister<unsigned
 int, 32, 624, 397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u,
 18, 3346425566u>&>::_rng’, can’t use default assignment operator

 I use Cross G++ Compiler 4.6.3 on Ubuntu. I am still learning Boost.Random
 library. Please correct me if such an operation does not make much sense.
 Thanks in advance.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7550>
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:50:10 UTC