remove minmax hack from win32.hpp and fix all places that could be affected by the minmax macros
[SVN r22394]
This commit is contained in:
parent
0333ba87f3
commit
5e99463ce1
@ -25,6 +25,7 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/minmax.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace random {
|
||||
@ -50,8 +51,8 @@ public:
|
||||
#else
|
||||
enum { has_fixed_range = false };
|
||||
#endif
|
||||
result_type min() const { return 1; }
|
||||
result_type max() const { return _mlcg1.max()-1; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 1; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (_mlcg1.max)()-1; }
|
||||
|
||||
additive_combine() : _mlcg1(), _mlcg2() { }
|
||||
additive_combine(typename MLCG1::result_type seed1,
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
if(_p == RealType(0))
|
||||
return false;
|
||||
else
|
||||
return RealType(eng() - eng.min()) <= _p * RealType(eng.max()-eng.min());
|
||||
return RealType(eng() - (eng.min)()) <= _p * RealType(eng.max()-eng.min());
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
|
@ -42,8 +42,8 @@ public:
|
||||
: _rng(static_cast<typename helper_type::rvalue_type>(rng))
|
||||
{ }
|
||||
|
||||
result_type min() const { return base().min(); }
|
||||
result_type max() const { return base().max(); }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (base().min)(); }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (base().max)(); }
|
||||
base_type& base() { return helper_type::ref(_rng); }
|
||||
const base_type& base() const { return helper_type::ref(_rng); }
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#ifndef BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP
|
||||
#define BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/random/uniform_01.hpp>
|
||||
|
||||
|
||||
@ -39,8 +40,8 @@ public:
|
||||
init();
|
||||
}
|
||||
|
||||
result_type min() const { return _min; }
|
||||
result_type max() const { return _max; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; }
|
||||
base_type& base() { return _rng.base(); }
|
||||
const base_type& base() const { return _rng.base(); }
|
||||
|
||||
|
@ -67,8 +67,8 @@ public:
|
||||
return _rng();
|
||||
}
|
||||
|
||||
result_type min() const { return _rng.min(); }
|
||||
result_type max() const { return _rng.max(); }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (_rng.min)(); }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (_rng.max)(); }
|
||||
static bool validation(result_type x) { return true; } // dummy
|
||||
|
||||
#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/random/detail/const_mod.hpp>
|
||||
|
||||
@ -46,8 +47,8 @@ public:
|
||||
BOOST_STATIC_CONSTANT(result_type, increment = b);
|
||||
BOOST_STATIC_CONSTANT(result_type, modulus = p);
|
||||
|
||||
result_type min() const { return b == 0 ? 1 : 0; }
|
||||
result_type max() const { return p-1; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return b == 0 ? 1 : 0; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return p-1; }
|
||||
|
||||
explicit inversive_congruential(IntType y0 = 1) : value(y0)
|
||||
{
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_01.hpp>
|
||||
#include <boost/random/detail/pass_through_engine.hpp>
|
||||
#include <boost/minmax.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace random {
|
||||
@ -84,8 +85,8 @@ public:
|
||||
BOOST_STATIC_CONSTANT(unsigned int, long_lag = p);
|
||||
BOOST_STATIC_CONSTANT(unsigned int, short_lag = q);
|
||||
|
||||
result_type min() const { return 0; }
|
||||
result_type max() const { return wordmask; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return wordmask; }
|
||||
|
||||
lagged_fibonacci() { init_wordmask(); seed(); }
|
||||
explicit lagged_fibonacci(uint32_t value) { init_wordmask(); seed(value); }
|
||||
@ -232,7 +233,7 @@ struct fibonacci_validation<T, P, Q> \
|
||||
BOOST_STATIC_CONSTANT(bool, is_specialized = true); \
|
||||
static T value() { return V; } \
|
||||
static T tolerance() \
|
||||
{ return std::max(E, static_cast<T>(5*std::numeric_limits<T>::epsilon())); } \
|
||||
{ return std_max(E, static_cast<T>(5*std::numeric_limits<T>::epsilon())); } \
|
||||
};
|
||||
// (The extra static_cast<T> in the std::max call above is actually
|
||||
// unnecessary except for HP aCC 1.30, which claims that
|
||||
@ -324,8 +325,8 @@ public:
|
||||
throw std::invalid_argument("lagged_fibonacci_01::seed");
|
||||
}
|
||||
|
||||
result_type min() const { return result_type(0); }
|
||||
result_type max() const { return result_type(1); }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(1); }
|
||||
|
||||
result_type operator()()
|
||||
{
|
||||
|
@ -88,8 +88,8 @@ public:
|
||||
_x = (_modulus ? (value % _modulus) : value);
|
||||
}
|
||||
|
||||
result_type min() const { return c == 0 ? 1 : 0; }
|
||||
result_type max() const { return modulus-1; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return c == 0 ? 1 : 0; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return modulus-1; }
|
||||
|
||||
IntType operator()()
|
||||
{
|
||||
@ -209,8 +209,8 @@ public:
|
||||
#else
|
||||
enum { has_fixed_range = false };
|
||||
#endif
|
||||
int32_t min() const { return 0; }
|
||||
int32_t max() const { return std::numeric_limits<int32_t>::max(); }
|
||||
int32_t min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; }
|
||||
int32_t max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (std::numeric_limits<int32_t>::max)(); }
|
||||
|
||||
explicit rand48(int32_t x0 = 1) : lcf(cnv(x0)) { }
|
||||
explicit rand48(uint64_t x0) : lcf(x0) { }
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
|
||||
@ -41,8 +42,8 @@ public:
|
||||
BOOST_STATIC_CONSTANT(int, exponent2 = q);
|
||||
BOOST_STATIC_CONSTANT(int, step_size = s);
|
||||
|
||||
result_type min() const { return 0; }
|
||||
result_type max() const { return wordmask; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return wordmask; }
|
||||
|
||||
// MSVC 6 and possibly others crash when encountering complicated integral
|
||||
// constant expressions. Avoid the checks for now.
|
||||
|
@ -113,8 +113,8 @@ public:
|
||||
throw std::invalid_argument("mersenne_twister::seed");
|
||||
}
|
||||
|
||||
result_type min() const { return 0; }
|
||||
result_type max() const
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const
|
||||
{
|
||||
// avoid "left shift count >= with of type" warning
|
||||
result_type res = 0;
|
||||
|
@ -74,16 +74,16 @@ public:
|
||||
result_type operator()() {
|
||||
// calculating the range every time may seem wasteful. However, this
|
||||
// makes the information locally available for the optimizer.
|
||||
result_type range = max()-min()+1;
|
||||
int j = k*(y-min())/range;
|
||||
result_type range = (max)()-(min)()+1;
|
||||
int j = k*(y-(min)())/range;
|
||||
// assert(0 <= j && j < k);
|
||||
y = v[j];
|
||||
v[j] = _rng();
|
||||
return y;
|
||||
}
|
||||
|
||||
result_type min() const { return _rng.min(); }
|
||||
result_type max() const { return _rng.max(); }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (_rng.min)(); }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (_rng.max)(); }
|
||||
static bool validation(result_type x) { return val == x; }
|
||||
|
||||
#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
@ -127,7 +127,7 @@ private:
|
||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
BOOST_STATIC_ASSERT(std::numeric_limits<result_type>::is_integer);
|
||||
#endif
|
||||
result_type range = max()-min();
|
||||
result_type range = (max)()-(min)();
|
||||
assert(range > 0); // otherwise there would be little choice
|
||||
if(static_cast<unsigned long>(k * range) <
|
||||
static_cast<unsigned long>(range)) // not a sufficient condition
|
||||
|
@ -118,8 +118,8 @@ public:
|
||||
k = 0;
|
||||
}
|
||||
|
||||
result_type min() const { return min_value; }
|
||||
result_type max() const { return max_value; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return min_value; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return max_value; }
|
||||
|
||||
result_type operator()()
|
||||
{
|
||||
@ -313,8 +313,8 @@ public:
|
||||
k = 0;
|
||||
}
|
||||
|
||||
result_type min() const { return result_type(0); }
|
||||
result_type max() const { return result_type(1); }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(1); }
|
||||
|
||||
result_type operator()()
|
||||
{
|
||||
|
@ -47,20 +47,20 @@ public:
|
||||
explicit uniform_01(base_type rng)
|
||||
: _rng(rng),
|
||||
_factor(result_type(1) /
|
||||
(result_type(_rng.max()-_rng.min()) +
|
||||
(result_type((_rng.max)()-(_rng.min)()) +
|
||||
result_type(std::numeric_limits<base_result>::is_integer ? 1 : 0)))
|
||||
{
|
||||
}
|
||||
// compiler-generated copy ctor and copy assignment are fine
|
||||
|
||||
result_type min() const { return result_type(0); }
|
||||
result_type max() const { return result_type(1); }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(1); }
|
||||
base_type& base() { return _rng; }
|
||||
const base_type& base() const { return _rng; }
|
||||
void reset() { }
|
||||
|
||||
result_type operator()() {
|
||||
return result_type(_rng() - _rng.min()) * _factor;
|
||||
return result_type(_rng() - (_rng.min)()) * _factor;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
|
@ -55,8 +55,8 @@ public:
|
||||
init();
|
||||
}
|
||||
|
||||
result_type min() const { return _min; }
|
||||
result_type max() const { return _max; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; }
|
||||
void reset() { }
|
||||
|
||||
// can't have member function templates out-of-line due to MSVC bugs
|
||||
@ -64,8 +64,8 @@ public:
|
||||
result_type operator()(Engine& eng)
|
||||
{
|
||||
typedef typename Engine::result_type base_result;
|
||||
base_result bmin = eng.min();
|
||||
base_result brange = eng.max() - eng.min();
|
||||
base_result bmin = (eng.min)();
|
||||
base_result brange = (eng.max)() - (eng.min)();
|
||||
|
||||
if(_range == 0) {
|
||||
return _min;
|
||||
@ -79,7 +79,7 @@ public:
|
||||
// concatenate several invocations of the base RNG
|
||||
// take extra care to avoid overflows
|
||||
result_type limit;
|
||||
if(_range == std::numeric_limits<result_type>::max()) {
|
||||
if(_range == (std::numeric_limits<result_type>::max)()) {
|
||||
limit = _range/(result_type(brange)+1);
|
||||
if(_range % result_type(brange)+1 == result_type(brange))
|
||||
++limit;
|
||||
|
@ -50,8 +50,8 @@ public:
|
||||
|
||||
// compiler-generated copy ctor and assignment operator are fine
|
||||
|
||||
result_type min() const { return _min; }
|
||||
result_type max() const { return _max; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; }
|
||||
void reset() { }
|
||||
|
||||
template<class Engine>
|
||||
|
@ -62,14 +62,14 @@ public:
|
||||
|
||||
void set(result_type min, result_type max);
|
||||
|
||||
result_type min() const { return _min; }
|
||||
result_type max() const { return _max; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; }
|
||||
base_type& base() const { return *_rng; }
|
||||
|
||||
result_type operator()()
|
||||
{
|
||||
// we must not use the low bits here, because LCGs get very bad then
|
||||
return (((*_rng)() - _rng->min()) / _factor) % _range + _min;
|
||||
return (((*_rng)() - (_rng->min)()) / _factor) % _range + _min;
|
||||
}
|
||||
|
||||
private:
|
||||
@ -95,8 +95,8 @@ set(result_type min, result_type max)
|
||||
// (probably put this logic into a partial template specialization)
|
||||
// Check how many low bits we can ignore before we get too much
|
||||
// quantization error.
|
||||
base_result r_base = _rng->max() - _rng->min();
|
||||
if(r_base == std::numeric_limits<base_result>::max()) {
|
||||
base_result r_base = (_rng->max)() - (_rng->min)();
|
||||
if(r_base == (std::numeric_limits<base_result>::max)()) {
|
||||
_factor = 2;
|
||||
r_base /= 2;
|
||||
}
|
||||
@ -137,8 +137,8 @@ public:
|
||||
_range = static_cast<base_result>(_max-_min)+1;
|
||||
}
|
||||
|
||||
result_type min() const { return _min; }
|
||||
result_type max() const { return _max; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; }
|
||||
base_type& base() const { return _rng.base(); }
|
||||
|
||||
result_type operator()()
|
||||
@ -175,8 +175,8 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
result_type min() const { return _min; }
|
||||
result_type max() const { return _max; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; }
|
||||
void reset() { }
|
||||
|
||||
template<class Engine>
|
||||
@ -190,8 +190,8 @@ public:
|
||||
// (probably put this logic into a partial template specialization)
|
||||
// Check how many low bits we can ignore before we get too much
|
||||
// quantization error.
|
||||
base_result r_base = eng.max() - eng.min();
|
||||
if(r_base == std::numeric_limits<base_result>::max()) {
|
||||
base_result r_base = (eng.max)() - (eng.min)();
|
||||
if(r_base == (std::numeric_limits<base_result>::max)()) {
|
||||
_factor = 2;
|
||||
r_base /= 2;
|
||||
}
|
||||
@ -205,7 +205,7 @@ public:
|
||||
r_base /= 2;
|
||||
}
|
||||
|
||||
return ((eng() - eng.min()) / _factor) % _range + _min;
|
||||
return ((eng() - (eng.min)()) / _factor) % _range + _min;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
|
@ -112,8 +112,8 @@ public:
|
||||
distribution_type& distribution() { return _dist; }
|
||||
const distribution_type& distribution() const { return _dist; }
|
||||
|
||||
result_type min() const { return distribution().min(); }
|
||||
result_type max() const { return distribution().max(); }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (distribution().min)(); }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (distribution().max)(); }
|
||||
|
||||
private:
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x564)
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/cstdint.hpp> // uint32_t
|
||||
#include <boost/minmax.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
@ -75,8 +76,8 @@ public:
|
||||
return (_rng1() << s1) ^ (_rng2() << s2);
|
||||
}
|
||||
|
||||
result_type min() const { return std::min(_rng1.min(), _rng2.min()); }
|
||||
result_type max() const { return std::max(_rng1.min(), _rng2.max()); }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return std_min((_rng1.min)(), (_rng2.min)()); }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return std_max((_rng1.min)(), (_rng2.max)()); }
|
||||
static bool validation(result_type x) { return val == x; }
|
||||
|
||||
#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
|
||||
|
@ -101,7 +101,7 @@ private:
|
||||
boost::random_device::random_device(const std::string& token)
|
||||
: pimpl(new impl(token))
|
||||
{
|
||||
assert(std::numeric_limits<result_type>::max() == max_value);
|
||||
assert((std::numeric_limits<result_type>::max)() == max_value);
|
||||
}
|
||||
|
||||
boost::random_device::~random_device()
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/random.hpp>
|
||||
#include <boost/progress.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@ -64,8 +65,8 @@ public:
|
||||
{ _x = x0; _a = a; _c = c; _m = m; }
|
||||
void seed(IntType x0) { _x = x0; }
|
||||
result_type operator()() { _x = (_a*_x+_c) % _m; return _x; }
|
||||
result_type min() const { return _c == 0 ? 1 : 0; }
|
||||
result_type max() const { return _m -1; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _c == 0 ? 1 : 0; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _m -1; }
|
||||
|
||||
private:
|
||||
IntType _x, _a, _c, _m;
|
||||
@ -82,8 +83,8 @@ public:
|
||||
|
||||
counting() : _x(0) { }
|
||||
result_type operator()() { return ++_x; }
|
||||
result_type min() const { return 1; }
|
||||
result_type max() const { return std::numeric_limits<result_type>::max(); }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 1; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (std::numeric_limits<result_type>::max)(); }
|
||||
|
||||
private:
|
||||
int _x;
|
||||
|
@ -252,9 +252,9 @@ void instantiate_urng(const std::string & s, const URNG &, const ResultType &)
|
||||
BOOST_TEST(have_exception);
|
||||
|
||||
// check for min/max members
|
||||
ResultType min = urng3.min();
|
||||
ResultType min = (urng3.min)();
|
||||
(void) &min;
|
||||
ResultType max = urng3.max();
|
||||
ResultType max = (urng3.max)();
|
||||
(void) &max;
|
||||
|
||||
#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
@ -390,16 +390,16 @@ void instantiate_all()
|
||||
template<class Generator>
|
||||
void check_uniform_int(Generator & gen, int iter)
|
||||
{
|
||||
std::cout << "testing uniform_int(" << gen.min() << "," << gen.max()
|
||||
std::cout << "testing uniform_int(" << (gen.min)() << "," << (gen.max)()
|
||||
<< ")" << std::endl;
|
||||
int range = gen.max()-gen.min()+1;
|
||||
int range = (gen.max)()-(gen.min)()+1;
|
||||
std::vector<int> bucket(range);
|
||||
for(int j = 0; j < iter; j++) {
|
||||
int result = gen();
|
||||
if(result < gen.min() || result > gen.max())
|
||||
if(result < (gen.min)() || result > (gen.max)())
|
||||
std::cerr << " ... delivers " << result << std::endl;
|
||||
else
|
||||
bucket[result-gen.min()]++;
|
||||
bucket[result-(gen.min)()]++;
|
||||
}
|
||||
int sum = 0;
|
||||
// use a different variable name "k", because MSVC has broken "for" scoping
|
||||
@ -426,8 +426,8 @@ void test_uniform_int(Generator & gen)
|
||||
typedef boost::variate_generator<Generator&, int_gen> level_one;
|
||||
|
||||
level_one uint12(gen, int_gen(1,2));
|
||||
BOOST_TEST(uint12.distribution().min() == 1);
|
||||
BOOST_TEST(uint12.distribution().max() == 2);
|
||||
BOOST_TEST((uint12.distribution().min)() == 1);
|
||||
BOOST_TEST((uint12.distribution().max)() == 2);
|
||||
check_uniform_int(uint12, 100000);
|
||||
level_one uint16(gen, int_gen(1,6));
|
||||
check_uniform_int(uint16, 100000);
|
||||
@ -483,9 +483,9 @@ class ruetti_gen
|
||||
{
|
||||
public:
|
||||
typedef boost::uint64_t result_type;
|
||||
result_type min() const { return 0; }
|
||||
result_type max() const { return std::numeric_limits<result_type>::max(); }
|
||||
result_type operator()() { return max()-1; }
|
||||
result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; }
|
||||
result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (std::numeric_limits<result_type>::max)(); }
|
||||
result_type operator()() { return (max)()-1; }
|
||||
};
|
||||
|
||||
void test_overflow_range()
|
||||
|
@ -332,7 +332,7 @@ public:
|
||||
// generator_reference_t<RNG> gen_ref(rng);
|
||||
RNG& gen_ref(rng);
|
||||
kolmogorov_experiment ks(n1);
|
||||
uniform_distribution ud(rng.min(), rng.max());
|
||||
uniform_distribution ud((rng.min)(), (rng.max)());
|
||||
check(run_experiment(test_distrib_chi_square,
|
||||
ks_experiment_generator(ks, gen_ref, ud), n2));
|
||||
check(run_experiment(test_distrib_chi_square,
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include <boost/random.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/minmax.hpp>
|
||||
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||
@ -91,8 +92,8 @@ public:
|
||||
template<class NumberGenerator, class Counter>
|
||||
void run(NumberGenerator f, Counter & count, int n) const
|
||||
{
|
||||
assert(f.min() == 0 &&
|
||||
static_cast<unsigned int>(f.max()) == classes()-1);
|
||||
assert((f.min)() == 0 &&
|
||||
static_cast<unsigned int>((f.max)()) == classes()-1);
|
||||
for(int i = 0; i < n; ++i)
|
||||
count(f());
|
||||
}
|
||||
@ -109,8 +110,8 @@ public:
|
||||
template<class NumberGenerator, class Counter>
|
||||
void run(NumberGenerator f, Counter & count, int n) const
|
||||
{
|
||||
unsigned int range = f.max()+1;
|
||||
assert(f.min() == 0 && range*range == classes());
|
||||
unsigned int range = (f.max)()+1;
|
||||
assert((f.min)() == 0 && range*range == classes());
|
||||
for(int i = 0; i < n; ++i) {
|
||||
int y1 = f();
|
||||
int y2 = f();
|
||||
@ -131,8 +132,8 @@ public:
|
||||
for(unsigned int i = 0; i < classes-1; ++i)
|
||||
limit[i] = invert_monotone_inc(probability, (i+1)*0.05, 0, 1000);
|
||||
limit[classes-1] = std::numeric_limits<double>::infinity();
|
||||
if(limit[classes-1] < std::numeric_limits<double>::max())
|
||||
limit[classes-1] = std::numeric_limits<double>::max();
|
||||
if(limit[classes-1] < (std::numeric_limits<double>::max)())
|
||||
limit[classes-1] = (std::numeric_limits<double>::max)();
|
||||
#if 0
|
||||
std::cout << __PRETTY_FUNCTION__ << ": ";
|
||||
for(unsigned int i = 0; i < classes; ++i)
|
||||
@ -166,7 +167,7 @@ public:
|
||||
void run(UniformRandomNumberGenerator f, Counter & count, int n) const
|
||||
{
|
||||
typedef typename UniformRandomNumberGenerator::result_type result_type;
|
||||
result_type init = (up ? f.min() : f.max());
|
||||
result_type init = (up ? (f.min)() : (f.max)());
|
||||
result_type previous = init;
|
||||
unsigned int length = 0;
|
||||
for(int i = 0; i < n; ++i) {
|
||||
@ -175,7 +176,7 @@ public:
|
||||
previous = val;
|
||||
++length;
|
||||
} else {
|
||||
count(std::min(length, classes())-1);
|
||||
count(std_min(length, classes())-1);
|
||||
length = 0;
|
||||
previous = init;
|
||||
// don't use this value, so that runs are independent
|
||||
@ -202,16 +203,16 @@ public:
|
||||
void run(UniformRandomNumberGenerator f, Counter & count, int n) const
|
||||
{
|
||||
typedef typename UniformRandomNumberGenerator::result_type result_type;
|
||||
double range = f.max() - f.min() + 1.0;
|
||||
double range = (f.max)() - (f.min)() + 1.0;
|
||||
result_type low = static_cast<result_type>(alpha * range);
|
||||
result_type high = static_cast<result_type>(beta * range);
|
||||
unsigned int length = 0;
|
||||
for(int i = 0; i < n; ) {
|
||||
result_type value = f() - f.min();
|
||||
result_type value = f() - (f.min)();
|
||||
if(value < low || value > high)
|
||||
++length;
|
||||
else {
|
||||
count(std::min(length, classes()-1));
|
||||
count(std_min(length, classes()-1));
|
||||
length = 0;
|
||||
++i;
|
||||
}
|
||||
@ -244,8 +245,8 @@ public:
|
||||
{
|
||||
typedef typename UniformRandomNumberGenerator::result_type result_type;
|
||||
assert(std::numeric_limits<result_type>::is_integer);
|
||||
assert(f.min() == 0);
|
||||
assert(f.max() == static_cast<result_type>(range-1));
|
||||
assert((f.min)() == 0);
|
||||
assert((f.max)() == static_cast<result_type>(range-1));
|
||||
std::vector<result_type> v(classes());
|
||||
for(int i = 0; i < n; ++i) {
|
||||
for(unsigned int j = 0; j < classes(); ++j)
|
||||
@ -291,8 +292,8 @@ public:
|
||||
{
|
||||
typedef typename UniformRandomNumberGenerator::result_type result_type;
|
||||
assert(std::numeric_limits<result_type>::is_integer);
|
||||
assert(f.min() == 0);
|
||||
assert(f.max() == static_cast<result_type>(d-1));
|
||||
assert((f.min)() == 0);
|
||||
assert((f.max)() == static_cast<result_type>(d-1));
|
||||
std::vector<bool> occurs(d);
|
||||
for(int i = 0; i < n; ++i) {
|
||||
occurs.assign(d, false);
|
||||
@ -308,7 +309,7 @@ public:
|
||||
break; // one complete set
|
||||
}
|
||||
}
|
||||
count(std::min(r-d, classes()-1));
|
||||
count(std_min(r-d, classes()-1));
|
||||
}
|
||||
}
|
||||
double probability(unsigned int r) const
|
||||
@ -369,8 +370,8 @@ public:
|
||||
{
|
||||
typedef typename UniformRandomNumberGenerator::result_type result_type;
|
||||
assert(std::numeric_limits<result_type>::is_integer);
|
||||
assert(f.min() == 0);
|
||||
assert(f.max() == static_cast<result_type>(m-1));
|
||||
assert((f.min)() == 0);
|
||||
assert((f.max)() == static_cast<result_type>(m-1));
|
||||
|
||||
for(int j = 0; j < n_total; j++) {
|
||||
std::vector<result_type> v(n);
|
||||
@ -386,7 +387,7 @@ public:
|
||||
if(spacing[i] == spacing[i+1])
|
||||
++k;
|
||||
}
|
||||
count(std::min(k, classes()-1));
|
||||
count(std_min(k, classes()-1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -469,17 +470,17 @@ public:
|
||||
int k = static_cast<int>(std::floor(m*y));
|
||||
if(k >= m)
|
||||
--k; // should not happen
|
||||
a[k] = std::min(a[k], y);
|
||||
b[k] = std::max(b[k], y);
|
||||
a[k] = std_min(a[k], y);
|
||||
b[k] = std_max(b[k], y);
|
||||
++c[k];
|
||||
}
|
||||
double kplus = 0, kminus = 0;
|
||||
int j = 0;
|
||||
for(int k = 0; k < m; ++k) {
|
||||
if(c[k] > 0) {
|
||||
kminus = std::max(kminus, a[k]-j/static_cast<double>(n));
|
||||
kminus = std_max(kminus, a[k]-j/static_cast<double>(n));
|
||||
j += c[k];
|
||||
kplus = std::max(kplus, j/static_cast<double>(n) - b[k]);
|
||||
kplus = std_max(kplus, j/static_cast<double>(n) - b[k]);
|
||||
}
|
||||
}
|
||||
kplus *= std::sqrt(double(n));
|
||||
@ -519,7 +520,7 @@ private:
|
||||
{
|
||||
double mx = f();
|
||||
for(int i = 1; i < t; ++i)
|
||||
mx = std::max(mx, f());
|
||||
mx = std_max(mx, f());
|
||||
return mx;
|
||||
}
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user