2
0
mirror of https://github.com/boostorg/random.git synced 2026-01-23 17:52:18 +00:00

move static assertions on std::numeric_limits<> from class to constructor

scope to suit MSVC


[SVN r19000]
This commit is contained in:
Jens Maurer
2003-07-09 19:47:11 +00:00
parent 5b26d1be08
commit 33d3fd71dd
2 changed files with 12 additions and 10 deletions

View File

@@ -34,14 +34,15 @@ public:
typedef RealType input_type;
typedef IntType result_type;
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer);
BOOST_STATIC_ASSERT(!std::numeric_limits<RealType>::is_integer);
#endif
explicit poisson_distribution(const RealType& mean = RealType(1))
: _mean(mean)
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
// MSVC fails BOOST_STATIC_ASSERT with std::numeric_limits at class scope
BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer);
BOOST_STATIC_ASSERT(!std::numeric_limits<RealType>::is_integer);
#endif
assert(mean > RealType(0));
init();
}

View File

@@ -165,13 +165,14 @@ public:
typedef IntType input_type;
typedef IntType result_type;
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer);
#endif
explicit uniform_smallint(IntType min = 0, IntType max = 9)
: _min(min), _max(max)
{ }
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
// MSVC fails BOOST_STATIC_ASSERT with std::numeric_limits at class scope
BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer);
#endif
}
result_type min() const { return _min; }
result_type max() const { return _max; }