|
Boost : |
From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2003-12-29 17:19:02
Matthias Troyer wrote:
>> Here is a test program that fails to compile now:
>>
>> #include <boost/random.hpp>
>>
>> int main()
>> {
>> boost::lagged_fibonacci607 rng;
>> boost::uniform_int<> int_rng(0,3);
>> int x = int_rng(rng);
>> }
The proper test program now looks like this:
boost::lagged_fibonacci607 rng;
boost::uniform_int<> int_rng(0,3);
boost::variate_generator<boost::lagged_fibonacci607&, boost::uniform_int<> > uni(rng, int_rng);
int x = uni();
See libs/random/random_demo.cpp
Please tell me where the documentation still refers to the old format.
Using boost::lagged_fibonacci607& in the variate_generator<> indicates that
we pass rng by reference, and it's your job to care for the lifetimes.
boost::lagged_fibonacci607* works as well, and the syntax is expandable
to smart pointers if the rng you pass in is a smart_ptr with automatic
lifetime management.
Jens Maurer
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk