Boost logo

Boost :

From: Hugo Duncan (hugoduncan_at_[hidden])
Date: 2003-10-29 11:58:27


Hi,

Attatched is a patch which modifies variate_generator to use
boost::is_integral<t>::value instead of std::numeric_limits<T>::is_integer.

Borland was having problems with std::numeric_limits, causing the incorrect
internal_engine_type to be chosen.

Random_test passes with vc7.1, and gcc3.2 on cygwin. For bcc56 random_test
causes out of memory errors, and I am unsure how to reduce the scope of the
tests. I have tried some small test cases for bcc56, which work.

Hugo

Index: variate_generator.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/random/variate_generator.hpp,v
retrieving revision 1.3
diff -r1.3 variate_generator.hpp
29a30
> #include <boost/type_traits/is_integral.hpp>
102c103
<

---
> 
113,117c114,117
<   enum {
<     have_int = std::numeric_limits<typename decorated_engine::result_type>::is_integer,
<     want_int = std::numeric_limits<typename Distribution::input_type>::is_integer
<   };
<   typedef typename random::detail::engine_helper<have_int, want_int>::BOOST_NESTED_TEMPLATE impl<decorated_engine, typename Distribution::input_type>::type internal_engine_type;
---
>   typedef typename random::detail::engine_helper<
>     boost::is_integral<typename decorated_engine::result_type>::value,
>     boost::is_integral<typename Distribution::input_type>::value
>     >::BOOST_NESTED_TEMPLATE impl<decorated_engine, typename Distribution::input_type>::type internal_engine_type;

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