[Boost-bugs] [Boost C++ Libraries] #2887: boost::mersenne_twister copy constructor

Subject: [Boost-bugs] [Boost C++ Libraries] #2887: boost::mersenne_twister copy constructor
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-03-26 10:59:05


#2887: boost::mersenne_twister copy constructor
------------------------------+---------------------------------------------
 Reporter: corlay_at_[hidden] | Owner: no-maintainer
     Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: random
  Version: Boost 1.38.0 | Severity: Problem
 Keywords: boost::random |
------------------------------+---------------------------------------------
 Compiled-generated copy constructor and assignment operator are fine, but
 the copy constructor is overloaded by mersenne_twister(Generator & gen) {
 seed(gen); } even is the Generator type is mersenne_twister;

 {{{
   template<class Generator>
   explicit mersenne_twister(Generator & gen) { seed(gen); }

   // compiler-generated copy ctor and assignment operator are fine
 }}}

 Hence calling
 {{{
         boost::mt19937 rng(0);
         boost::mt19937 rngcopy(rng);
         std::cout << (rng==rngcopy) << std::endl;
 }}}
 yields "false".

 Maybe a boost::disable_if<boost::is_same<mersenne_twister,Generator> >
 solves the problem.

 See also the workaround made in default constructor of
 boost::pass_through_engine to avoid matching Generator & constructor

 S.

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