From 33d3fd71ddd9fe61cbde1202a657da582becbfeb Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Wed, 9 Jul 2003 19:47:11 +0000 Subject: [PATCH] move static assertions on std::numeric_limits<> from class to constructor scope to suit MSVC [SVN r19000] --- include/boost/random/poisson_distribution.hpp | 11 ++++++----- include/boost/random/uniform_smallint.hpp | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/boost/random/poisson_distribution.hpp b/include/boost/random/poisson_distribution.hpp index 820d8d1..dd20001 100644 --- a/include/boost/random/poisson_distribution.hpp +++ b/include/boost/random/poisson_distribution.hpp @@ -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::is_integer); - BOOST_STATIC_ASSERT(!std::numeric_limits::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::is_integer); + BOOST_STATIC_ASSERT(!std::numeric_limits::is_integer); +#endif + assert(mean > RealType(0)); init(); } diff --git a/include/boost/random/uniform_smallint.hpp b/include/boost/random/uniform_smallint.hpp index 21e5e8c..fb72e84 100644 --- a/include/boost/random/uniform_smallint.hpp +++ b/include/boost/random/uniform_smallint.hpp @@ -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::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::is_integer); +#endif + } result_type min() const { return _min; } result_type max() const { return _max; }