big_integer and boost::random::uniform_int

I tried to use boost::random::uniform_int with the in-development big_integer library. Here is a test code: #include <boost/random/uniform_int.hpp> #include "boost/big_integer.hpp" /////////////////////// int main(int argc, char* argv[]) { typedef boost::big_integer data_t; // typedef long long data_t; data_t n(235345345); boost::uniform_int<data_t> rng(0,n-1); return 0; } /////////////////////// ==> g++ --version g++ (GCC) 3.3.2 20031022 (Red Hat Linux 3.3.2-1) Compiling this yields: /////////////////////// g++ -o a -I ~/boost/boost/include/boost-1_31/ randomtest.cpp /home/afit1/fac/jyoung/boost/boost/include/boost-1_31/boost/random/uniform_int.hpp: In constructor `boost::uniform_int<IntType>::uniform_int(IntType,IntType) [with IntType = main(int, char**)::data_t]': randomtest.cpp:10: instantiated from here /home/afit1/fac/jyoung/boost/boost/include/boost-1_31/boost/random/uniform_int.hpp:52: error: invalid application of `sizeof' to an incomplete type ////////////////////// Joel

Joel Young wrote:
I tried to use boost::random::uniform_int with the in-development big_integer library. [...] Compiling this yields:
/////////////////////// g++ -o a -I ~/boost/boost/include/boost-1_31/ randomtest.cpp /home/afit1/fac/jyoung/boost/boost/include/boost-1_31/boost/random/uniform_ int.hpp: In constructor `boost::uniform_int<IntType>::uniform_int(IntType,IntType) [with IntType = main(int, char**)::data_t]': randomtest.cpp:10: instantiated from here /home/afit1/fac/jyoung/boost/boost/include/boost-1_31/boost/random/uniform_ int.hpp:52: error: invalid application of `sizeof' to an incomplete type
Yea, that's quite vague error message, but in fact this is failed STATIC_ASSERT. The line in question reads: BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer); so I guess numeric_limits should be somehow specialized for big_integer. - Volodya
participants (2)
-
Joel Young
-
Vladimir Prus