Boost logo

Boost Users :

From: wave style (wavestyle_at_[hidden])
Date: 2006-05-17 11:40:50


Hi,
  I have some strange behavior on win XP with VC 8.0 version and
boost::random library.
  When I use variate_generator helper template with uniform_01 distribution,
I always get an compiler error. like as:

//code
    boost::mt19937 rng(time(0));
    boost::uniform_01<mt19937> u01(rng);
    boost::variate_generator<mt19937, uniform_01<mt19937> > die401(rng,
u01);

//compile info
error C2039: 'input_type' : is not a member of
'boost::uniform_01<UniformRandomNumberGenerator>'
        with
        [
            UniformRandomNumberGenerator=boost::mt19937
        ]
        f:\my documents\visual studio
2005\projects\testboost\testrandom\testrandom.cpp(169) : see reference to
class template instantiation 'boost::variate_generator<Engine,Distribution>'
being compiled
        with
        [
            Engine=boost::mt19937,
            Distribution=boost::uniform_01<boost::mt19937>
        ]

Actually, the uniform_01 class doesn't declare a type named input_type in
uniform_01.hpp, because uniform_01 distribution can accept both
IntegerType and RealType UniformRandomGenerator. It seems that
variate_generator can not support the uniform_01.
However, I found the engine_helper struct be specialized for uniform_01 and
uniform_int_float in variate_generator.hpp. I got confused. It's
vc8.0compiler's bug?

How can I get a variate_generator for uniform_01 distribution?

Any feedback welcomed!!

Thanks.

Waveform.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net