Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2007-12-28 06:33:03


John Maddock wrote:

> Neal Becker wrote:
>>> Doesn't look like it:
>>> /usr/local/src/boost.hg/boost/random/variate_generator.hpp:120:
>>> error: no type named ‘input_type’ in ‘class
>>> boost::uniform_01<boost::random::mersenne_twister<unsigned int, 32,
>>> 624, 397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18,
>>> 3346425566u>, double>’
>
> What code/compiler combination generates this?
>

Different subject, 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&’


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk