Ticket #2887: patchfile.patch

File patchfile.patch, 1.7 KB (added by corlay@…, 14 years ago)

unified diff for the proposed correction

  • detail/pass_through_engine.hpp

     
    3232  typedef typename helper_type::value_type base_type;
    3333  typedef typename base_type::result_type result_type;
    3434
    35   explicit pass_through_engine(UniformRandomNumberGenerator rng)
    36     // make argument an rvalue to avoid matching Generator& constructor
    37     : _rng(static_cast<typename helper_type::rvalue_type>(rng))
    38   { }
     35  explicit pass_through_engine(UniformRandomNumberGenerator rng): _rng(rng) { }
    3936
    4037  result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (base().min)(); }
    4138  result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (base().max)(); }
  • mersenne_twister.hpp

     
    2828#include <boost/detail/workaround.hpp>
    2929#include <boost/random/detail/config.hpp>
    3030#include <boost/random/detail/ptr_helper.hpp>
     31#include <boost/utility/enable_if.hpp>
     32#include <boost/type_traits/is_same.hpp>
    3133
    3234namespace boost {
    3335namespace random {
     
    6567  template<class It> mersenne_twister(It& first, It last) { seed(first,last); }
    6668
    6769  template<class Generator>
    68   explicit mersenne_twister(Generator & gen) { seed(gen); }
     70        explicit mersenne_twister(Generator & gen, typename disable_if< is_same<Generator,mersenne_twister>,int >::type = 0) { seed(gen); }
    6971
     72
    7073  // compiler-generated copy ctor and assignment operator are fine
    7174
    7275  void seed() { seed(UIntType(5489)); }