Boost logo

Boost :

Subject: Re: [boost] [random] xor_combine
From: Thijs (M.A.) van den Berg (thijs_at_[hidden])
Date: 2012-03-21 06:34:31


I'm trying to use the xor_combine adaptor with boost 1.48, but get a compiler error. Any ideas?

A second question: the xor_combine adaptor did not make it into C++11, right?

Here is the error I get, and the code causing it.

/usr/local/include/boost/random/detail/seed_impl.hpp: In function ‘void boost::random::detail::fill_array_int_impl(Iter&, Iter, UIntType (&)[n]) [with int w = 32, long unsigned int n = 624ul, Iter = boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>, UIntType = unsigned int]’:
/usr/local/include/boost/random/detail/seed_impl.hpp:324: instantiated from ‘void boost::random::detail::fill_array_int_impl(Iter&, Iter, IntType (&)[n], mpl_::false_) [with int w = 32, long unsigned int n = 624ul, Iter = boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>, IntType = unsigned int]’
/usr/local/include/boost/random/detail/seed_impl.hpp:330: instantiated from ‘void boost::random::detail::fill_array_int(Iter&, Iter, IntType (&)[n]) [with int w = 32, long unsigned int n = 624ul, Iter = boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>, IntType = unsigned int]’
/usr/local/include/boost/random/mersenne_twister.hpp:173: instantiated from ‘void boost::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::seed(It&, It) [with It = boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>, UIntType = unsigned int, long unsigned int w = 32ul, long unsigned int n = 624ul, long unsigned int m = 397ul, long unsigned int r = 31ul, UIntType a = 2567483615u, long unsigned int u = 11ul, UIntType d = 4294967295u, long unsigned int s = 7ul, UIntType b = 2636928640u, long unsigned int t = 15ul, UIntType c = 4022730752u, long unsigned int l = 18ul, UIntType f = 1812433253u]’
/usr/local/include/boost/random/mersenne_twister.hpp:112: instantiated from ‘boost::random::mersenne_twister_engine<UIntType, w, n, m, r, a, u, d, s, b, t, c, l, f>::mersenne_twister_engine(It&, It) [with It = boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>, UIntType = unsigned int, long unsigned int w = 32ul, long unsigned int n = 624ul, long unsigned int m = 397ul, long unsigned int r = 31ul, UIntType a = 2567483615u, long unsigned int u = 11ul, UIntType d = 4294967295u, long unsigned int s = 7ul, UIntType b = 2636928640u, long unsigned int t = 15ul, UIntType c = 4022730752u, long unsigned int l = 18ul, UIntType f = 1812433253u]’
/usr/local/include/boost/random/xor_combine.hpp:87: instantiated from ‘boost::random::xor_combine_engine<URNG1, s1, URNG2, s2>::xor_combine_engine(It&, It) [with It = boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>, URNG1 = boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>, int s1 = 0, URNG2 = boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>, int s2 = 1]’
/usr/local/include/boost/random/xor_combine.hpp:194: instantiated from ‘boost::random::xor_combine<URNG1, s1, URNG2, s2, v>::xor_combine(It&, It) [with It = main()::ENG, URNG1 = boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>, int s1 = 0, URNG2 = boost::random::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>, int s2 = 1, typename URNG1::result_type v = 0u]’
.../sandbox/xor_combine_parallel_random.cpp:28: instantiated from here
/usr/local/include/boost/random/detail/seed_impl.hpp:308: error: no ‘operator++(int)’ declared for postfix ‘++’, trying prefix operator instead
/usr/local/include/boost/random/detail/seed_impl.hpp:308: error: no match for ‘operator++’ in ‘++first’

=================================================

    #include <boost/random.hpp>
    namespace rndlib = boost::random;

    typedef rndlib::mt19937 ENG;
    typedef rndlib::xor_combine<ENG,0,ENG,1> XORENG;
   
    ENG eng1;
    ENG eng2;
    XORENG xoreng1(eng1,eng2); // <== LINE 28 ERROR "instantiated from here"


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