Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68817 - in trunk: boost/random boost/random/detail libs/random/src libs/random/test
From: steven_at_[hidden]
Date: 2011-02-12 15:03:26


Author: steven_watanabe
Date: 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
New Revision: 68817
URL: http://svn.boost.org/trac/boost/changeset/68817

Log:
Fix problems reported by inspect.
Text files modified:
   trunk/boost/random/bernoulli_distribution.hpp | 10 +++++-----
   trunk/boost/random/detail/const_mod.hpp | 10 +++++-----
   trunk/boost/random/discrete_distribution.hpp | 8 ++++----
   trunk/boost/random/exponential_distribution.hpp | 6 +++---
   trunk/boost/random/gamma_distribution.hpp | 8 +++++---
   trunk/boost/random/generate_canonical.hpp | 14 +++++++-------
   trunk/boost/random/geometric_distribution.hpp | 6 +++---
   trunk/boost/random/independent_bits.hpp | 8 ++++----
   trunk/boost/random/inversive_congruential.hpp | 6 +++---
   trunk/boost/random/linear_congruential.hpp | 6 +++---
   trunk/boost/random/normal_distribution.hpp | 4 ++--
   trunk/boost/random/piecewise_constant_distribution.hpp | 4 ++--
   trunk/boost/random/piecewise_linear_distribution.hpp | 10 +++++-----
   trunk/boost/random/poisson_distribution.hpp | 10 +++++-----
   trunk/boost/random/triangle_distribution.hpp | 6 +++---
   trunk/boost/random/uniform_int.hpp | 4 ++--
   trunk/boost/random/uniform_int_distribution.hpp | 6 +++---
   trunk/boost/random/uniform_on_sphere.hpp | 3 ++-
   trunk/boost/random/uniform_real.hpp | 4 ++--
   trunk/boost/random/uniform_real_distribution.hpp | 14 +++++++-------
   trunk/boost/random/uniform_smallint.hpp | 4 ++--
   trunk/libs/random/src/random_device.cpp | 2 +-
   trunk/libs/random/test/concepts.hpp | 13 +++++++------
   trunk/libs/random/test/test_distribution.ipp | 4 ++--
   trunk/libs/random/test/test_generate_canonical.cpp | 2 +-
   trunk/libs/random/test/test_generator.ipp | 8 ++++----
   trunk/libs/random/test/test_random_device.cpp | 18 +++++++++---------
   trunk/libs/random/test/test_real_distribution.ipp | 2 +-
   28 files changed, 102 insertions(+), 98 deletions(-)

Modified: trunk/boost/random/bernoulli_distribution.hpp
==============================================================================
--- trunk/boost/random/bernoulli_distribution.hpp (original)
+++ trunk/boost/random/bernoulli_distribution.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -17,8 +17,8 @@
 #ifndef BOOST_RANDOM_BERNOULLI_DISTRIBUTION_HPP
 #define BOOST_RANDOM_BERNOULLI_DISTRIBUTION_HPP
 
-#include <cassert>
 #include <iosfwd>
+#include <boost/assert.hpp>
 #include <boost/random/detail/config.hpp>
 #include <boost/random/detail/operators.hpp>
 
@@ -55,8 +55,8 @@
         explicit param_type(RealType p_arg = RealType(0.5))
           : _p(p_arg)
         {
- assert(_p >= 0);
- assert(_p <= 1);
+ BOOST_ASSERT(_p >= 0);
+ BOOST_ASSERT(_p <= 1);
         }
 
         /** Returns the p parameter of the distribution. */
@@ -96,8 +96,8 @@
     explicit bernoulli_distribution(const RealType& p_arg = RealType(0.5))
       : _p(p_arg)
     {
- assert(_p >= 0);
- assert(_p <= 1);
+ BOOST_ASSERT(_p >= 0);
+ BOOST_ASSERT(_p <= 1);
     }
     /**
      * Constructs \bernoulli_distribution from its parameters

Modified: trunk/boost/random/detail/const_mod.hpp
==============================================================================
--- trunk/boost/random/detail/const_mod.hpp (original)
+++ trunk/boost/random/detail/const_mod.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -16,8 +16,8 @@
 #ifndef BOOST_RANDOM_CONST_MOD_HPP
 #define BOOST_RANDOM_CONST_MOD_HPP
 
-#include <cassert>
 #include <algorithm>
+#include <boost/assert.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/cstdint.hpp>
 #include <boost/integer_traits.hpp>
@@ -100,7 +100,7 @@
     const IntType q = m / a;
     const IntType r = m % a;
 
- assert(r < q); // check that overflow cannot happen
+ BOOST_ASSERT(r < q); // check that overflow cannot happen
 
     return sub(a*(value%q), r*(value/q));
   }
@@ -156,7 +156,7 @@
   static IntType invert_euclidian(IntType c)
   {
     // we are interested in the gcd factor for c, because this is our inverse
- assert(c > 0);
+ BOOST_ASSERT(c > 0);
     IntType l1 = 0;
     IntType l2 = 1;
     IntType n = c;
@@ -179,7 +179,7 @@
   static IntType invert_euclidian0(IntType c)
   {
     // we are interested in the gcd factor for c, because this is our inverse
- assert(c > 0);
+ BOOST_ASSERT(c > 0);
     if(c == 1) return 1;
     IntType l1 = 0;
     IntType l2 = 1;
@@ -187,7 +187,7 @@
     IntType p = m;
     IntType max = (std::numeric_limits<IntType>::max)();
     IntType q = max / n;
- assert(max % n != n - 1 && "c must be relatively prime to m.");
+ BOOST_ASSERT(max % n != n - 1 && "c must be relatively prime to m.");
     l1 += q * l2;
     p = max - q * n + 1;
     for(;;) {

Modified: trunk/boost/random/discrete_distribution.hpp
==============================================================================
--- trunk/boost/random/discrete_distribution.hpp (original)
+++ trunk/boost/random/discrete_distribution.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -14,11 +14,11 @@
 #define BOOST_RANDOM_DISCRETE_DISTRIBUTION_HPP_INCLUDED
 
 #include <vector>
-#include <cassert>
 #include <limits>
 #include <numeric>
 #include <utility>
 #include <iterator>
+#include <boost/assert.hpp>
 #include <boost/random/uniform_01.hpp>
 #include <boost/random/uniform_int.hpp>
 #include <boost/random/detail/config.hpp>
@@ -104,7 +104,7 @@
         {
             std::size_t n = (nw == 0) ? 1 : nw;
             double delta = (xmax - xmin) / n;
- assert(delta > 0);
+ BOOST_ASSERT(delta > 0);
             for(std::size_t k = 0; k < n; ++k) {
                 _probabilities.push_back(fw(xmin + k*delta + delta/2));
             }
@@ -233,7 +233,7 @@
     {
         std::size_t n = (nw == 0) ? 1 : nw;
         double delta = (xmax - xmin) / n;
- assert(delta > 0);
+ BOOST_ASSERT(delta > 0);
         std::vector<WeightType> weights;
         for(std::size_t k = 0; k < n; ++k) {
             weights.push_back(fw(xmin + k*delta + delta/2));
@@ -255,7 +255,7 @@
     template<class URNG>
     IntType operator()(URNG& urng) const
     {
- assert(!_alias_table.empty());
+ BOOST_ASSERT(!_alias_table.empty());
         WeightType test = uniform_01<WeightType>()(urng);
         IntType result = uniform_int<IntType>((min)(), (max)())(urng);
         if(test < _alias_table[result].first) {

Modified: trunk/boost/random/exponential_distribution.hpp
==============================================================================
--- trunk/boost/random/exponential_distribution.hpp (original)
+++ trunk/boost/random/exponential_distribution.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -18,8 +18,8 @@
 #define BOOST_RANDOM_EXPONENTIAL_DISTRIBUTION_HPP
 
 #include <boost/config/no_tr1/cmath.hpp>
-#include <cassert>
 #include <iosfwd>
+#include <boost/assert.hpp>
 #include <boost/limits.hpp>
 #include <boost/random/detail/config.hpp>
 #include <boost/random/detail/operators.hpp>
@@ -53,7 +53,7 @@
          * Requires: lambda > 0
          */
         param_type(RealType lambda_arg = RealType(1.0))
- : _lambda(lambda_arg) { assert(_lambda > RealType(0)); }
+ : _lambda(lambda_arg) { BOOST_ASSERT(_lambda > RealType(0)); }
 
         /** Returns the lambda parameter of the distribution. */
         RealType lambda() const { return _lambda; }
@@ -89,7 +89,7 @@
      * Requires: lambda > 0
      */
     explicit exponential_distribution(RealType lambda_arg = RealType(1.0))
- : _lambda(lambda_arg) { assert(_lambda > RealType(0)); }
+ : _lambda(lambda_arg) { BOOST_ASSERT(_lambda > RealType(0)); }
 
     /**
      * Constructs an exponential_distribution from its parameters

Modified: trunk/boost/random/gamma_distribution.hpp
==============================================================================
--- trunk/boost/random/gamma_distribution.hpp (original)
+++ trunk/boost/random/gamma_distribution.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -16,7 +16,9 @@
 #define BOOST_RANDOM_GAMMA_DISTRIBUTION_HPP
 
 #include <boost/config/no_tr1/cmath.hpp>
-#include <cassert>
+#include <istream>
+#include <iosfwd>
+#include <boost/assert.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/random/detail/config.hpp>
@@ -112,8 +114,8 @@
                                 const result_type& beta_arg = result_type(1.0))
       : _exp(result_type(1)), _alpha(alpha_arg), _beta(beta_arg)
     {
- assert(_alpha > result_type(0));
- assert(_beta > result_type(0));
+ BOOST_ASSERT(_alpha > result_type(0));
+ BOOST_ASSERT(_beta > result_type(0));
         init();
     }
 

Modified: trunk/boost/random/generate_canonical.hpp
==============================================================================
--- trunk/boost/random/generate_canonical.hpp (original)
+++ trunk/boost/random/generate_canonical.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -14,8 +14,8 @@
 #ifndef BOOST_RANDOM_GENERATE_CANONICAL_HPP
 #define BOOST_RANDOM_GENERATE_CANONICAL_HPP
 
-#include <cassert>
 #include <algorithm>
+#include <boost/assert.hpp>
 #include <boost/config/no_tr1/cmath.hpp>
 #include <boost/limits.hpp>
 #include <boost/type_traits/is_integral.hpp>
@@ -33,7 +33,7 @@
     using std::pow;
     typedef typename URNG::result_type base_result;
     std::size_t digits = std::numeric_limits<RealType>::digits;
- RealType R = RealType(g.max()) - RealType(g.min()) + 1;
+ RealType R = RealType((g.max)()) - RealType((g.min)()) + 1;
     RealType mult = R;
     RealType limit = pow(RealType(2), RealType((std::min)(bits, digits)));
     RealType S = RealType(detail::subtract<base_result>()(g(), (g.min)()));
@@ -50,8 +50,8 @@
 {
     using std::pow;
     using std::floor;
- assert((g.min)() == 0);
- assert((g.max)() == 1);
+ BOOST_ASSERT((g.min)() == 0);
+ BOOST_ASSERT((g.max)() == 1);
     typedef typename URNG::result_type base_result;
     std::size_t digits = std::numeric_limits<RealType>::digits;
     std::size_t engine_bits = g.precision();
@@ -80,11 +80,11 @@
 {
     RealType result = detail::generate_canonical_impl<RealType, bits>(
         g, boost::is_integral<typename URNG::result_type>());
- assert(result >= 0);
- assert(result <= 1);
+ BOOST_ASSERT(result >= 0);
+ BOOST_ASSERT(result <= 1);
     if(result == 1) {
         result -= std::numeric_limits<RealType>::epsilon() / 2;
- assert(result != 1);
+ BOOST_ASSERT(result != 1);
     }
     return result;
 }

Modified: trunk/boost/random/geometric_distribution.hpp
==============================================================================
--- trunk/boost/random/geometric_distribution.hpp (original)
+++ trunk/boost/random/geometric_distribution.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -18,9 +18,9 @@
 #define BOOST_RANDOM_GEOMETRIC_DISTRIBUTION_HPP
 
 #include <boost/config/no_tr1/cmath.hpp> // std::log
-#include <cassert>
 #include <iosfwd>
 #include <ios>
+#include <boost/assert.hpp>
 #include <boost/random/detail/config.hpp>
 #include <boost/random/detail/operators.hpp>
 #include <boost/random/uniform_01.hpp>
@@ -60,7 +60,7 @@
         explicit param_type(RealType p_arg = RealType(0.5))
           : _p(p_arg)
         {
- assert(RealType(0) < _p && _p < RealType(1));
+ BOOST_ASSERT(RealType(0) < _p && _p < RealType(1));
         }
 
         /** Returns the p parameter of the distribution. */
@@ -107,7 +107,7 @@
     explicit geometric_distribution(const RealType& p = RealType(0.5))
       : _p(p)
     {
- assert(RealType(0) < _p && _p < RealType(1));
+ BOOST_ASSERT(RealType(0) < _p && _p < RealType(1));
         init();
     }
 

Modified: trunk/boost/random/independent_bits.hpp
==============================================================================
--- trunk/boost/random/independent_bits.hpp (original)
+++ trunk/boost/random/independent_bits.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -14,9 +14,9 @@
 #ifndef BOOST_RANDOM_INDEPENDENT_BITS_HPP
 #define BOOST_RANDOM_INDEPENDENT_BITS_HPP
 
-#include <cassert>
 #include <istream>
 #include <iosfwd>
+#include <boost/assert.hpp>
 #include <boost/limits.hpp>
 #include <boost/config.hpp>
 #include <boost/integer/integer_mask.hpp>
@@ -193,7 +193,7 @@
             calc_params(n, range, w0, n0, y0, y1, y0_mask, y1_mask);
         }
 
- assert(n0*w0 + (n - n0)*(w0 + 1) == w);
+ BOOST_ASSERT(n0*w0 + (n - n0)*(w0 + 1) == w);
 
         result_type S = 0;
         for(std::size_t k = 0; k < n0; ++k) {
@@ -275,14 +275,14 @@
         base_unsigned& y0, base_unsigned& y1,
         base_unsigned& y0_mask, base_unsigned& y1_mask)
     {
- assert(w >= n);
+ BOOST_ASSERT(w >= n);
         w0 = w/n;
         n0 = n - w % n;
         y0_mask = (base_unsigned(2) << (w0 - 1)) - 1;
         y1_mask = (y0_mask << 1) | 1;
         y0 = (range + 1) & ~y0_mask;
         y1 = (range + 1) & ~y1_mask;
- assert(y0 != 0 || base_unsigned(range + 1) == 0);
+ BOOST_ASSERT(y0 != 0 || base_unsigned(range + 1) == 0);
     }
     /// \endcond
 

Modified: trunk/boost/random/inversive_congruential.hpp
==============================================================================
--- trunk/boost/random/inversive_congruential.hpp (original)
+++ trunk/boost/random/inversive_congruential.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -17,8 +17,8 @@
 #define BOOST_RANDOM_INVERSIVE_CONGRUENTIAL_HPP
 
 #include <iosfwd>
-#include <cassert>
 #include <stdexcept>
+#include <boost/assert.hpp>
 #include <boost/config.hpp>
 #include <boost/integer/static_log2.hpp>
 #include <boost/random/detail/config.hpp>
@@ -134,8 +134,8 @@
         if(increment == 0 && _value == 0) {
             _value = 1;
         }
- assert(_value >= (min)());
- assert(_value <= (max)());
+ BOOST_ASSERT(_value >= (min)());
+ BOOST_ASSERT(_value <= (max)());
     }
 
     /**

Modified: trunk/boost/random/linear_congruential.hpp
==============================================================================
--- trunk/boost/random/linear_congruential.hpp (original)
+++ trunk/boost/random/linear_congruential.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -17,8 +17,8 @@
 #define BOOST_RANDOM_LINEAR_CONGRUENTIAL_HPP
 
 #include <iostream>
-#include <cassert>
 #include <stdexcept>
+#include <boost/assert.hpp>
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
@@ -139,8 +139,8 @@
         if(increment == 0 && _x == 0) {
             _x = 1;
         }
- assert(_x >= (min)());
- assert(_x <= (max)());
+ BOOST_ASSERT(_x >= (min)());
+ BOOST_ASSERT(_x <= (max)());
     }
 
     /**

Modified: trunk/boost/random/normal_distribution.hpp
==============================================================================
--- trunk/boost/random/normal_distribution.hpp (original)
+++ trunk/boost/random/normal_distribution.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -18,9 +18,9 @@
 #define BOOST_RANDOM_NORMAL_DISTRIBUTION_HPP
 
 #include <boost/config/no_tr1/cmath.hpp>
-#include <cassert>
 #include <istream>
 #include <iosfwd>
+#include <boost/assert.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/random/detail/config.hpp>
@@ -101,7 +101,7 @@
       : _mean(mean_arg), _sigma(sigma_arg),
         _r1(0), _r2(0), _cached_rho(0), _valid(false)
     {
- assert(_sigma >= RealType(0));
+ BOOST_ASSERT(_sigma >= RealType(0));
     }
 
     /**

Modified: trunk/boost/random/piecewise_constant_distribution.hpp
==============================================================================
--- trunk/boost/random/piecewise_constant_distribution.hpp (original)
+++ trunk/boost/random/piecewise_constant_distribution.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -14,8 +14,8 @@
 #define BOOST_RANDOM_PIECEWISE_CONSTANT_DISTRIBUTION_HPP_INCLUDED
 
 #include <vector>
-#include <cassert>
 #include <numeric>
+#include <boost/assert.hpp>
 #include <boost/random/uniform_real.hpp>
 #include <boost/random/discrete_distribution.hpp>
 #include <boost/random/detail/config.hpp>
@@ -150,7 +150,7 @@
         {
             std::size_t n = (nw == 0) ? 1 : nw;
             double delta = (xmax - xmin) / n;
- assert(delta > 0);
+ BOOST_ASSERT(delta > 0);
             for(std::size_t k = 0; k < n; ++k) {
                 _weights.push_back(f(xmin + k*delta + delta/2));
                 _intervals.push_back(xmin + k*delta);

Modified: trunk/boost/random/piecewise_linear_distribution.hpp
==============================================================================
--- trunk/boost/random/piecewise_linear_distribution.hpp (original)
+++ trunk/boost/random/piecewise_linear_distribution.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -15,9 +15,9 @@
 
 #include <vector>
 #include <algorithm>
-#include <cassert>
 #include <cmath>
 #include <cstdlib>
+#include <boost/assert.hpp>
 #include <boost/random/uniform_real.hpp>
 #include <boost/random/discrete_distribution.hpp>
 #include <boost/random/detail/config.hpp>
@@ -159,7 +159,7 @@
         {
             std::size_t n = (nw == 0) ? 1 : nw;
             double delta = (xmax - xmin) / n;
- assert(delta > 0);
+ BOOST_ASSERT(delta > 0);
             for(std::size_t k = 0; k < n; ++k) {
                 _weights.push_back(f(xmin + k*delta));
                 _intervals.push_back(xmin + k*delta);
@@ -383,9 +383,9 @@
         if(is_in_rectangle) {
             return dist(urng);
         } else if(_weights[i] < _weights[i+1]) {
- return std::max(dist(urng), dist(urng));
+ return (std::max)(dist(urng), dist(urng));
         } else {
- return std::min(dist(urng), dist(urng));
+ return (std::min)(dist(urng), dist(urng));
         }
     }
     
@@ -498,7 +498,7 @@
             RealType width = intervals_arg[i + 1] - intervals_arg[i];
             WeightType w1 = weights_arg[i];
             WeightType w2 = weights_arg[i + 1];
- bin_weights.push_back(std::min(w1, w2) * width);
+ bin_weights.push_back((std::min)(w1, w2) * width);
             bin_weights.push_back(std::abs(w1 - w2) * width / 2);
         }
         typedef discrete_distribution<std::size_t, WeightType> bins_type;

Modified: trunk/boost/random/poisson_distribution.hpp
==============================================================================
--- trunk/boost/random/poisson_distribution.hpp (original)
+++ trunk/boost/random/poisson_distribution.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -17,8 +17,8 @@
 
 #include <boost/config/no_tr1/cmath.hpp>
 #include <cstdlib>
-#include <cassert>
 #include <iosfwd>
+#include <boost/assert.hpp>
 #include <boost/limits.hpp>
 #include <boost/random/uniform_01.hpp>
 #include <boost/random/detail/config.hpp>
@@ -79,7 +79,7 @@
         explicit param_type(RealType mean_arg = RealType(1))
           : _mean(mean_arg)
         {
- assert(_mean > 0);
+ BOOST_ASSERT(_mean > 0);
         }
         /* Returns the "mean" parameter of the distribution. */
         RealType mean() const { return _mean; }
@@ -125,7 +125,7 @@
     explicit poisson_distribution(RealType mean_arg = RealType(1))
       : _mean(mean_arg)
     {
- assert(_mean > 0);
+ BOOST_ASSERT(_mean > 0);
         init();
     }
     
@@ -242,8 +242,8 @@
 
     static RealType log_factorial(IntType k)
     {
- assert(k >= 0);
- assert(k < 10);
+ BOOST_ASSERT(k >= 0);
+ BOOST_ASSERT(k < 10);
         return detail::poisson_table<RealType>::value[k];
     }
 

Modified: trunk/boost/random/triangle_distribution.hpp
==============================================================================
--- trunk/boost/random/triangle_distribution.hpp (original)
+++ trunk/boost/random/triangle_distribution.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -18,10 +18,10 @@
 #define BOOST_RANDOM_TRIANGLE_DISTRIBUTION_HPP
 
 #include <boost/config/no_tr1/cmath.hpp>
-#include <cassert>
 #include <iosfwd>
 #include <ios>
 #include <istream>
+#include <boost/assert.hpp>
 #include <boost/random/detail/config.hpp>
 #include <boost/random/detail/operators.hpp>
 #include <boost/random/uniform_01.hpp>
@@ -54,7 +54,7 @@
                             RealType c_arg = RealType(1.0))
           : _a(a_arg), _b(b_arg), _c(c_arg)
         {
- assert(_a <= _b && _b <= _c);
+ BOOST_ASSERT(_a <= _b && _b <= _c);
         }
 
         /** Returns the minimum value of the distribution. */
@@ -111,7 +111,7 @@
                                    RealType c_arg = RealType(1.0))
       : _a(a_arg), _b(b_arg), _c(c_arg)
     {
- assert(_a <= _b && _b <= _c);
+ BOOST_ASSERT(_a <= _b && _b <= _c);
         init();
     }
 

Modified: trunk/boost/random/uniform_int.hpp
==============================================================================
--- trunk/boost/random/uniform_int.hpp (original)
+++ trunk/boost/random/uniform_int.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -17,7 +17,7 @@
 #ifndef BOOST_RANDOM_UNIFORM_INT_HPP
 #define BOOST_RANDOM_UNIFORM_INT_HPP
 
-#include <cassert>
+#include <boost/assert.hpp>
 #include <boost/random/uniform_int_distribution.hpp>
 
 namespace boost {
@@ -89,7 +89,7 @@
     template<class Engine>
     IntType operator()(Engine& eng, IntType n) const
     {
- assert(n > 0);
+ BOOST_ASSERT(n > 0);
         return static_cast<const base_type&>(*this)(eng, param_type(0, n - 1));
     }
 };

Modified: trunk/boost/random/uniform_int_distribution.hpp
==============================================================================
--- trunk/boost/random/uniform_int_distribution.hpp (original)
+++ trunk/boost/random/uniform_int_distribution.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -18,12 +18,12 @@
 #ifndef BOOST_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP
 #define BOOST_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP
 
-#include <cassert>
 #include <iosfwd>
 #include <ios>
 #include <istream>
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
+#include <boost/assert.hpp>
 #include <boost/random/detail/config.hpp>
 #include <boost/random/detail/operators.hpp>
 #include <boost/random/detail/uniform_int_float.hpp>
@@ -263,7 +263,7 @@
             IntType max_arg = (std::numeric_limits<IntType>::max)())
           : _min(min_arg), _max(max_arg)
         {
- assert(_min <= _max);
+ BOOST_ASSERT(_min <= _max);
         }
 
         /** Returns the minimum value of the distribution. */
@@ -317,7 +317,7 @@
         IntType max_arg = (std::numeric_limits<IntType>::max)())
       : _min(min_arg), _max(max_arg)
     {
- assert(min_arg <= max_arg);
+ BOOST_ASSERT(min_arg <= max_arg);
     }
     /** Constructs a uniform_int_distribution from its parameters. */
     explicit uniform_int_distribution(const param_type& parm)

Modified: trunk/boost/random/uniform_on_sphere.hpp
==============================================================================
--- trunk/boost/random/uniform_on_sphere.hpp (original)
+++ trunk/boost/random/uniform_on_sphere.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -20,6 +20,7 @@
 #include <vector>
 #include <algorithm> // std::transform
 #include <functional> // std::bind2nd, std::divides
+#include <boost/assert.hpp>
 #include <boost/random/detail/config.hpp>
 #include <boost/random/detail/operators.hpp>
 #include <boost/random/normal_distribution.hpp>
@@ -54,7 +55,7 @@
          */
         explicit param_type(int dim_arg = 2) : _dim(dim_arg)
         {
- assert(_dim >= 0);
+ BOOST_ASSERT(_dim >= 0);
         }
 
         /** Returns the dimension of the sphere. */

Modified: trunk/boost/random/uniform_real.hpp
==============================================================================
--- trunk/boost/random/uniform_real.hpp (original)
+++ trunk/boost/random/uniform_real.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -17,7 +17,7 @@
 #ifndef BOOST_RANDOM_UNIFORM_REAL_HPP
 #define BOOST_RANDOM_UNIFORM_REAL_HPP
 
-#include <cassert>
+#include <boost/assert.hpp>
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/random/uniform_real_distribution.hpp>
@@ -63,7 +63,7 @@
                           RealType max_arg = RealType(1.0))
       : base_type(min_arg, max_arg)
     {
- assert(min_arg <= max_arg);
+ BOOST_ASSERT(min_arg <= max_arg);
     }
 
     /** Constructs a uniform_real distribution from its parameters. */

Modified: trunk/boost/random/uniform_real_distribution.hpp
==============================================================================
--- trunk/boost/random/uniform_real_distribution.hpp (original)
+++ trunk/boost/random/uniform_real_distribution.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -15,10 +15,10 @@
 #ifndef BOOST_RANDOM_UNIFORM_REAL_DISTRIBUTION_HPP
 #define BOOST_RANDOM_UNIFORM_REAL_DISTRIBUTION_HPP
 
-#include <cassert>
 #include <iosfwd>
 #include <ios>
 #include <istream>
+#include <boost/assert.hpp>
 #include <boost/config.hpp>
 #include <boost/random/detail/config.hpp>
 #include <boost/random/detail/operators.hpp>
@@ -39,8 +39,8 @@
         typedef typename Engine::result_type base_result;
         result_type numerator = static_cast<T>(eng() - (eng.min)());
         result_type divisor = static_cast<T>((eng.max)() - (eng.min)());
- assert(divisor > 0);
- assert(numerator >= 0 && numerator <= divisor);
+ BOOST_ASSERT(divisor > 0);
+ BOOST_ASSERT(numerator >= 0 && numerator <= divisor);
         T result = numerator / divisor * (max_value - min_value) + min_value;
         if(result < max_value) return result;
     }
@@ -56,8 +56,8 @@
         typedef typename Engine::result_type base_result;
         result_type numerator = static_cast<T>(subtract<base_result>()(eng(), (eng.min)()));
         result_type divisor = static_cast<T>(subtract<base_result>()((eng.max)(), (eng.min)())) + 1;
- assert(divisor > 0);
- assert(numerator >= 0 && numerator <= divisor);
+ BOOST_ASSERT(divisor > 0);
+ BOOST_ASSERT(numerator >= 0 && numerator <= divisor);
         T result = numerator / divisor * (max_value - min_value) + min_value;
         if(result < max_value) return result;
     }
@@ -100,7 +100,7 @@
                             RealType max_arg = RealType(1.0))
           : _min(min_arg), _max(max_arg)
         {
- assert(_min <= _max);
+ BOOST_ASSERT(_min <= _max);
         }
 
         /** Returns the minimum value of the distribution. */
@@ -154,7 +154,7 @@
         RealType max_arg = RealType(1.0))
       : _min(min_arg), _max(max_arg)
     {
- assert(min_arg <= max_arg);
+ BOOST_ASSERT(min_arg <= max_arg);
     }
     /** Constructs a uniform_real_distribution from its parameters. */
     explicit uniform_real_distribution(const param_type& parm)

Modified: trunk/boost/random/uniform_smallint.hpp
==============================================================================
--- trunk/boost/random/uniform_smallint.hpp (original)
+++ trunk/boost/random/uniform_smallint.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -17,9 +17,9 @@
 #ifndef BOOST_RANDOM_UNIFORM_SMALLINT_HPP
 #define BOOST_RANDOM_UNIFORM_SMALLINT_HPP
 
-#include <cassert>
 #include <istream>
 #include <iosfwd>
+#include <boost/assert.hpp>
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/type_traits/is_integral.hpp>
@@ -114,7 +114,7 @@
         param_type(IntType min_arg = 0, IntType max_arg = 9)
           : _min(min_arg), _max(max_arg)
         {
- assert(_min <= _max);
+ BOOST_ASSERT(_min <= _max);
         }
 
         /** Returns the minimum value. */

Modified: trunk/libs/random/src/random_device.cpp
==============================================================================
--- trunk/libs/random/src/random_device.cpp (original)
+++ trunk/libs/random/src/random_device.cpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -14,9 +14,9 @@
 
 #include <boost/random/random_device.hpp>
 #include <boost/config.hpp>
+#include <boost/assert.hpp>
 #include <boost/detail/workaround.hpp>
 #include <string>
-#include <cassert>
 
 #if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) && !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
 // A definition is required even for integral static constants

Modified: trunk/libs/random/test/concepts.hpp
==============================================================================
--- trunk/libs/random/test/concepts.hpp (original)
+++ trunk/libs/random/test/concepts.hpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -9,6 +9,7 @@
  *
  */
 
+#include <boost/config.hpp>
 #include <boost/concept_check.hpp>
 #include <boost/concept_archetype.hpp>
 #include <boost/concept/requires.hpp>
@@ -43,8 +44,8 @@
 struct uniform_random_number_generator_archetype : Base
 {
     typedef R result_type;
- static R min() { return 0; }
- static R max() { return 0; }
+ static R min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }
+ static R max BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }
     R operator()() { return 0; }
 };
 
@@ -109,8 +110,8 @@
     BOOST_CONCEPT_USAGE(RandomNumberEngine)
     {
         same_type(e(), result_type());
- same_type(E::min(), result_type());
- same_type(E::max(), result_type());
+ same_type((E::min)(), result_type());
+ same_type((E::max)(), result_type());
 
         check_extra(boost::is_integral<result_type>());
 
@@ -181,8 +182,8 @@
         d.param(p);
         same_type(d(g), result_type());
         same_type(d(g, p), result_type());
- same_type(x.min(), result_type());
- same_type(x.max(), result_type());
+ same_type((x.min)(), result_type());
+ same_type((x.max)(), result_type());
     }
 
 private:

Modified: trunk/libs/random/test/test_distribution.ipp
==============================================================================
--- trunk/libs/random/test/test_distribution.ipp (original)
+++ trunk/libs/random/test/test_distribution.ipp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -208,7 +208,7 @@
     boost::minstd_rand0 gen;
     BOOST_RANDOM_DISTRIBUTION dist BOOST_RANDOM_TEST1_PARAMS;
     BOOST_RANDOM_DISTRIBUTION dist_two BOOST_RANDOM_TEST2_PARAMS;
- typedef BOOST_RANDOM_DISTRIBUTION::result_type result_type;
+ typedef BOOST_RANDOM_DISTRIBUTION::result_type result_type;
     for(int i = 0; i < 10; ++i) {
         result_type value = dist(gen);
 #ifdef BOOST_RANDOM_TEST1_MIN
@@ -245,7 +245,7 @@
     boost::lagged_fibonacci607 gen;
     BOOST_RANDOM_DISTRIBUTION dist BOOST_RANDOM_TEST1_PARAMS;
     BOOST_RANDOM_DISTRIBUTION dist_two BOOST_RANDOM_TEST2_PARAMS;
- typedef BOOST_RANDOM_DISTRIBUTION::result_type result_type;
+ typedef BOOST_RANDOM_DISTRIBUTION::result_type result_type;
     for(int i = 0; i < 10; ++i) {
         result_type value = dist(gen);
 #ifdef BOOST_RANDOM_TEST1_MIN

Modified: trunk/libs/random/test/test_generate_canonical.cpp
==============================================================================
--- trunk/libs/random/test/test_generate_canonical.cpp (original)
+++ trunk/libs/random/test/test_generate_canonical.cpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -91,7 +91,7 @@
     static result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }
     static result_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
     { return ~boost::uint32_t(0); }
- result_type operator()() { return max(); }
+ result_type operator()() { return (max)(); }
 };
 
 BOOST_AUTO_TEST_CASE(test_max)

Modified: trunk/libs/random/test/test_generator.ipp
==============================================================================
--- trunk/libs/random/test/test_generator.ipp (original)
+++ trunk/libs/random/test/test_generator.ipp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -88,7 +88,7 @@
    
 BOOST_AUTO_TEST_CASE(test_iterator_seed)
 {
- const std::vector<int> v(std::max(std::size_t(9999u), sizeof(BOOST_RANDOM_URNG) / 4), 0x41);
+ const std::vector<int> v((std::max)(std::size_t(9999u), sizeof(BOOST_RANDOM_URNG) / 4), 0x41);
     std::vector<int>::const_iterator it = v.begin();
     std::vector<int>::const_iterator it_end = v.end();
     BOOST_RANDOM_URNG urng(it, it_end);
@@ -96,7 +96,7 @@
     std::iterator_traits<std::vector<int>::const_iterator>::difference_type n_words = (it - v.begin());
     BOOST_CHECK_GT(n_words, 0);
 
- it = v.begin();
+ it = v.begin();
     BOOST_RANDOM_URNG urng2;
     urng2.seed(it, it_end);
     std::iterator_traits<std::vector<int>::const_iterator>::difference_type n_words2 = (it - v.begin());
@@ -110,7 +110,7 @@
     if(n_words > 1) {
         it = v.end();
         --it;
- BOOST_CHECK_THROW(BOOST_RANDOM_URNG(it, it_end), std::invalid_argument);
+ BOOST_CHECK_THROW(BOOST_RANDOM_URNG(it, it_end), std::invalid_argument);
         it = v.end();
         --it;
         BOOST_CHECK_THROW(urng.seed(it, it_end), std::invalid_argument);
@@ -119,7 +119,7 @@
 
 BOOST_AUTO_TEST_CASE(test_seed_seq_seed)
 {
- boost::random::seed_seq q;
+ boost::random::seed_seq q;
     BOOST_RANDOM_URNG urng(q);
     BOOST_RANDOM_URNG urng2;
     BOOST_CHECK_NE(urng, urng2);

Modified: trunk/libs/random/test/test_random_device.cpp
==============================================================================
--- trunk/libs/random/test/test_random_device.cpp (original)
+++ trunk/libs/random/test/test_random_device.cpp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -14,16 +14,16 @@
 #include <boost/test/included/test_exec_monitor.hpp>
 
 int test_main(int argc, char** argv) {
- boost::random_device rng;
- double entropy = rng.entropy();
- BOOST_CHECK_GE(entropy, 0);
- for(int i = 0; i < 100; ++i) {
- boost::random_device::result_type val = rng();
- BOOST_CHECK_GE(val, (rng.min)());
- BOOST_CHECK_LE(val, (rng.max)());
- }
+ boost::random_device rng;
+ double entropy = rng.entropy();
+ BOOST_CHECK_GE(entropy, 0);
+ for(int i = 0; i < 100; ++i) {
+ boost::random_device::result_type val = rng();
+ BOOST_CHECK_GE(val, (rng.min)());
+ BOOST_CHECK_LE(val, (rng.max)());
+ }
 
     boost::uint32_t a[10];
     rng.generate(a, a + 10);
- return 0;
+ return 0;
 }

Modified: trunk/libs/random/test/test_real_distribution.ipp
==============================================================================
--- trunk/libs/random/test/test_real_distribution.ipp (original)
+++ trunk/libs/random/test/test_real_distribution.ipp 2011-02-12 15:03:17 EST (Sat, 12 Feb 2011)
@@ -70,7 +70,7 @@
     
     std::vector<long long> results(max_value + 1);
     for(long long i = 0; i < max; ++i) {
- ++results[std::min(dist(gen), max_value)];
+ ++results[(std::min)(dist(gen), max_value)];
     }
 
     long long sum = boost::accumulate(results, 0ll);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk