Subject: [Boost-bugs] [Boost C++ Libraries] #10182: Header order dependency for boost/multiprecision/random.hpp
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-07-07 18:18:55
#10182: Header order dependency for boost/multiprecision/random.hpp
-------------------------------------------------+-------------------------
Reporter: pcfreak <coolpcfreak@â¦> | Owner: johnmaddock
Type: Bugs | Status: new
Milestone: To Be Determined | Component:
Version: Boost 1.54.0 | multiprecision
Keywords: multiprecision random | Severity: Problem
uniform_int_distribution |
-------------------------------------------------+-------------------------
Using boost/multiprecision/random.hpp requires that it gets included
before boost/random/uniform_int_distribution.hpp when using it in
combination with that.\\
See example code:
{{{
#!cpp
#include <gmp.h>
#include <cstdlib>
#include <iostream>
#include <boost/multiprecision/gmp.hpp>
//#include <boost/multiprecision/random.hpp> // fails unless this header
is included first
#include <boost/random/random_device.hpp>
#include <boost/random/uniform_int_distribution.hpp>
#include <boost/multiprecision/random.hpp> // does not work if included
here
using namespace std;
using namespace boost;
int main() {
typedef multiprecision::number<multiprecision::gmp_int> MpzInt;
random::random_device rndDevice;
MpzInt rndRangeTo(MpzInt(1) << 256);
const MpzInt rndRangeFrom(rndRangeTo >> 1);
random::uniform_int_distribution<MpzInt> rndRange(rndRangeFrom,
rndRangeTo);
const MpzInt rndValue(rndRange(rndDevice));
cout << rndValue << endl;
return EXIT_SUCCESS;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10182> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC