Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51413 - in trunk: boost/random boost/random/detail libs/random
From: steven_at_[hidden]
Date: 2009-02-23 10:48:30


Author: steven_watanabe
Date: 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
New Revision: 51413
URL: http://svn.boost.org/trac/boost/changeset/51413

Log:
Enable stream operators on msvc. Fixes #1068. Fixes #1691
Added:
   trunk/boost/random/detail/config.hpp (contents, props changed)
Text files modified:
   trunk/boost/random/additive_combine.hpp | 3
   trunk/boost/random/bernoulli_distribution.hpp | 3
   trunk/boost/random/binomial_distribution.hpp | 3
   trunk/boost/random/cauchy_distribution.hpp | 3
   trunk/boost/random/detail/uniform_int_float.hpp | 3
   trunk/boost/random/discard_block.hpp | 3
   trunk/boost/random/exponential_distribution.hpp | 3
   trunk/boost/random/gamma_distribution.hpp | 3
   trunk/boost/random/geometric_distribution.hpp | 3
   trunk/boost/random/inversive_congruential.hpp | 3
   trunk/boost/random/lagged_fibonacci.hpp | 5
   trunk/boost/random/linear_congruential.hpp | 7 +
   trunk/boost/random/linear_feedback_shift.hpp | 3
   trunk/boost/random/lognormal_distribution.hpp | 3
   trunk/boost/random/mersenne_twister.hpp | 3
   trunk/boost/random/normal_distribution.hpp | 3
   trunk/boost/random/poisson_distribution.hpp | 3
   trunk/boost/random/shuffle_output.hpp | 2
   trunk/boost/random/subtract_with_carry.hpp | 5
   trunk/boost/random/triangle_distribution.hpp | 3
   trunk/boost/random/uniform_01.hpp | 3
   trunk/boost/random/uniform_int.hpp | 9 -
   trunk/boost/random/uniform_on_sphere.hpp | 3
   trunk/boost/random/uniform_real.hpp | 3
   trunk/boost/random/uniform_smallint.hpp | 136 +--------------------------------------
   trunk/boost/random/xor_combine.hpp | 3
   trunk/libs/random/instantiate.cpp | 10 +-
   27 files changed, 63 insertions(+), 171 deletions(-)

Modified: trunk/boost/random/additive_combine.hpp
==============================================================================
--- trunk/boost/random/additive_combine.hpp (original)
+++ trunk/boost/random/additive_combine.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -20,6 +20,7 @@
 #include <algorithm> // for std::min and std::max
 #include <boost/config.hpp>
 #include <boost/cstdint.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/linear_congruential.hpp>
 
 namespace boost {
@@ -85,7 +86,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const additive_combine& r)

Modified: trunk/boost/random/bernoulli_distribution.hpp
==============================================================================
--- trunk/boost/random/bernoulli_distribution.hpp (original)
+++ trunk/boost/random/bernoulli_distribution.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -18,6 +18,7 @@
 
 #include <cassert>
 #include <iostream>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 
@@ -53,7 +54,7 @@
       return RealType(eng() - (eng.min)()) <= _p * RealType((eng.max)()-(eng.min)());
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const bernoulli_distribution& bd)

Modified: trunk/boost/random/binomial_distribution.hpp
==============================================================================
--- trunk/boost/random/binomial_distribution.hpp (original)
+++ trunk/boost/random/binomial_distribution.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -16,6 +16,7 @@
 
 #include <boost/config/no_tr1/cmath.hpp>
 #include <cassert>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/bernoulli_distribution.hpp>
 
 namespace boost {
@@ -53,7 +54,7 @@
     return n;
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const binomial_distribution& bd)

Modified: trunk/boost/random/cauchy_distribution.hpp
==============================================================================
--- trunk/boost/random/cauchy_distribution.hpp (original)
+++ trunk/boost/random/cauchy_distribution.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -20,6 +20,7 @@
 #include <iostream>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 
@@ -62,7 +63,7 @@
     return _median + _sigma * tan(pi*(eng()-result_type(0.5)));
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const cauchy_distribution& cd)

Added: trunk/boost/random/detail/config.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/random/detail/config.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -0,0 +1,18 @@
+/* boost random/detail/config.hpp header file
+ *
+ * Copyright Steven Watanabe 2009
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * See http://www.boost.org for most recent version including documentation.
+ *
+ * $Id$
+ */
+
+#include <boost/config.hpp>
+
+#if (defined(BOOST_NO_OPERATORS_IN_NAMESPACE) || defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)) \
+ && !defined(BOOST_MSVC)
+ #define BOOST_RANDOM_NO_STREAM_OPERATORS
+#endif

Modified: trunk/boost/random/detail/uniform_int_float.hpp
==============================================================================
--- trunk/boost/random/detail/uniform_int_float.hpp (original)
+++ trunk/boost/random/detail/uniform_int_float.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -15,6 +15,7 @@
 #define BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP
 
 #include <boost/config.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/uniform_01.hpp>
 
 
@@ -45,7 +46,7 @@
     return static_cast<IntType>(_rng() * _range) + _min;
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_int_float& ud)

Modified: trunk/boost/random/discard_block.hpp
==============================================================================
--- trunk/boost/random/discard_block.hpp (original)
+++ trunk/boost/random/discard_block.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -20,6 +20,7 @@
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 
 
 namespace boost {
@@ -69,7 +70,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const discard_block& s)

Modified: trunk/boost/random/exponential_distribution.hpp
==============================================================================
--- trunk/boost/random/exponential_distribution.hpp (original)
+++ trunk/boost/random/exponential_distribution.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -21,6 +21,7 @@
 #include <iostream>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 
@@ -54,7 +55,7 @@
     return -result_type(1) / _lambda * log(result_type(1)-eng());
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const exponential_distribution& ed)

Modified: trunk/boost/random/gamma_distribution.hpp
==============================================================================
--- trunk/boost/random/gamma_distribution.hpp (original)
+++ trunk/boost/random/gamma_distribution.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -18,6 +18,7 @@
 #include <cassert>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/exponential_distribution.hpp>
 
 namespace boost {
@@ -93,7 +94,7 @@
     }
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const gamma_distribution& gd)

Modified: trunk/boost/random/geometric_distribution.hpp
==============================================================================
--- trunk/boost/random/geometric_distribution.hpp (original)
+++ trunk/boost/random/geometric_distribution.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -19,6 +19,7 @@
 #include <boost/config/no_tr1/cmath.hpp> // std::log
 #include <cassert>
 #include <iostream>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/uniform_01.hpp>
 
 namespace boost {
@@ -59,7 +60,7 @@
     return IntType(floor(log(RealType(1)-eng()) / _log_p)) + IntType(1);
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const geometric_distribution& gd)

Modified: trunk/boost/random/inversive_congruential.hpp
==============================================================================
--- trunk/boost/random/inversive_congruential.hpp (original)
+++ trunk/boost/random/inversive_congruential.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -21,6 +21,7 @@
 #include <stdexcept>
 #include <boost/config.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/detail/const_mod.hpp>
 
 namespace boost {
@@ -75,7 +76,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, inversive_congruential x)

Modified: trunk/boost/random/lagged_fibonacci.hpp
==============================================================================
--- trunk/boost/random/lagged_fibonacci.hpp (original)
+++ trunk/boost/random/lagged_fibonacci.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -27,6 +27,7 @@
 #include <boost/detail/workaround.hpp>
 #include <boost/random/linear_congruential.hpp>
 #include <boost/random/uniform_01.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/detail/pass_through_engine.hpp>
 
 namespace boost {
@@ -141,7 +142,7 @@
   
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const lagged_fibonacci& f)
@@ -354,7 +355,7 @@
   
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const lagged_fibonacci_01&f)

Modified: trunk/boost/random/linear_congruential.hpp
==============================================================================
--- trunk/boost/random/linear_congruential.hpp (original)
+++ trunk/boost/random/linear_congruential.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -22,6 +22,7 @@
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/detail/const_mod.hpp>
 #include <boost/detail/workaround.hpp>
 
@@ -114,7 +115,7 @@
                          const linear_congruential& y)
   { return !(x == y); }
     
-#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+#if !defined(BOOST_RANDOM_NO_STREAM_OPERATORS) && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os,
@@ -156,7 +157,7 @@
 {
     return is >> lcg._x;
 }
-#elif defined(BOOST_NO_OPERATORS_IN_NAMESPACE) || defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
+#elif defined(BOOST_RANDOM_NO_STREAM_OPERATORS) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
 template<class CharT, class Traits, class IntType, IntType a, IntType c, IntType m, IntType val>
 std::basic_ostream<CharT,Traits>&
 operator<<(std::basic_ostream<CharT,Traits>& os,
@@ -225,7 +226,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT,class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const rand48& r)

Modified: trunk/boost/random/linear_feedback_shift.hpp
==============================================================================
--- trunk/boost/random/linear_feedback_shift.hpp (original)
+++ trunk/boost/random/linear_feedback_shift.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -20,6 +20,7 @@
 #include <boost/config.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/limits.hpp>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 namespace random {
@@ -96,7 +97,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, linear_feedback_shift x)

Modified: trunk/boost/random/lognormal_distribution.hpp
==============================================================================
--- trunk/boost/random/lognormal_distribution.hpp (original)
+++ trunk/boost/random/lognormal_distribution.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -21,6 +21,7 @@
 #include <iostream>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/normal_distribution.hpp>
 
 #ifdef BOOST_NO_STDC_NAMESPACE
@@ -74,7 +75,7 @@
     return exp(_normal(eng) * _nsigma + _nmean);
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const lognormal_distribution& ld)

Modified: trunk/boost/random/mersenne_twister.hpp
==============================================================================
--- trunk/boost/random/mersenne_twister.hpp (original)
+++ trunk/boost/random/mersenne_twister.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -26,6 +26,7 @@
 #include <boost/cstdint.hpp>
 #include <boost/random/linear_congruential.hpp>
 #include <boost/detail/workaround.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/detail/ptr_helper.hpp>
 
 namespace boost {
@@ -130,7 +131,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const mersenne_twister& mt)

Modified: trunk/boost/random/normal_distribution.hpp
==============================================================================
--- trunk/boost/random/normal_distribution.hpp (original)
+++ trunk/boost/random/normal_distribution.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -21,6 +21,7 @@
 #include <iostream>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 
@@ -80,7 +81,7 @@
       * _sigma + _mean;
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const normal_distribution& nd)

Modified: trunk/boost/random/poisson_distribution.hpp
==============================================================================
--- trunk/boost/random/poisson_distribution.hpp (original)
+++ trunk/boost/random/poisson_distribution.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -19,6 +19,7 @@
 #include <iostream>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 
@@ -60,7 +61,7 @@
     }
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const poisson_distribution& pd)

Modified: trunk/boost/random/shuffle_output.hpp
==============================================================================
--- trunk/boost/random/shuffle_output.hpp (original)
+++ trunk/boost/random/shuffle_output.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -84,7 +84,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const shuffle_output& s)

Modified: trunk/boost/random/subtract_with_carry.hpp
==============================================================================
--- trunk/boost/random/subtract_with_carry.hpp (original)
+++ trunk/boost/random/subtract_with_carry.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -26,6 +26,7 @@
 #include <boost/cstdint.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/detail/workaround.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/linear_congruential.hpp>
 
 
@@ -153,7 +154,7 @@
   
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os,
@@ -345,7 +346,7 @@
   
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os,

Modified: trunk/boost/random/triangle_distribution.hpp
==============================================================================
--- trunk/boost/random/triangle_distribution.hpp (original)
+++ trunk/boost/random/triangle_distribution.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -18,6 +18,7 @@
 
 #include <boost/config/no_tr1/cmath.hpp>
 #include <cassert>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/uniform_01.hpp>
 
 namespace boost {
@@ -60,7 +61,7 @@
       return _c - d3*sqrt(d2*u-d1);
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const triangle_distribution& td)

Modified: trunk/boost/random/uniform_01.hpp
==============================================================================
--- trunk/boost/random/uniform_01.hpp (original)
+++ trunk/boost/random/uniform_01.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -20,6 +20,7 @@
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/detail/pass_through_engine.hpp>
 
 namespace boost {
@@ -50,7 +51,7 @@
     }
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const new_uniform_01&)

Modified: trunk/boost/random/uniform_int.hpp
==============================================================================
--- trunk/boost/random/uniform_int.hpp (original)
+++ trunk/boost/random/uniform_int.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -24,6 +24,7 @@
 #include <boost/static_assert.hpp>
 #include <boost/detail/workaround.hpp>
 #include <boost/random/uniform_smallint.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/detail/signed_unsigned_tools.hpp>
 #include <boost/type_traits/make_unsigned.hpp>
 #ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
@@ -76,7 +77,7 @@
       return generate(eng, 0, n - 1, n - 1);
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_int& ud)
@@ -89,13 +90,9 @@
   friend std::basic_istream<CharT,Traits>&
   operator>>(std::basic_istream<CharT,Traits>& is, uniform_int& ud)
   {
-# if BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC == 1400
- return detail::extract_uniform_int(is, ud, ud.impl);
-# else
- is >> std::ws >> ud._min >> std::ws >> ud._max;
+ is >> std::ws >> ud._min >> std::ws >> ud._max;
     ud.init();
     return is;
-# endif
   }
 #endif
 

Modified: trunk/boost/random/uniform_on_sphere.hpp
==============================================================================
--- trunk/boost/random/uniform_on_sphere.hpp (original)
+++ trunk/boost/random/uniform_on_sphere.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -19,6 +19,7 @@
 #include <vector>
 #include <algorithm> // std::transform
 #include <functional> // std::bind2nd, std::divides
+#include <boost/random/detail/config.hpp>
 #include <boost/random/normal_distribution.hpp>
 
 namespace boost {
@@ -56,7 +57,7 @@
     return _container;
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_on_sphere& sd)

Modified: trunk/boost/random/uniform_real.hpp
==============================================================================
--- trunk/boost/random/uniform_real.hpp (original)
+++ trunk/boost/random/uniform_real.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -22,6 +22,7 @@
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 
 namespace boost {
 
@@ -56,7 +57,7 @@
            * (_max - _min) + _min;
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_real& ud)

Modified: trunk/boost/random/uniform_smallint.hpp
==============================================================================
--- trunk/boost/random/uniform_smallint.hpp (original)
+++ trunk/boost/random/uniform_smallint.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -22,139 +22,14 @@
 #include <boost/config.hpp>
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/random/detail/config.hpp>
 #include <boost/random/uniform_01.hpp>
 #include <boost/detail/workaround.hpp>
-#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
-#include <boost/type_traits/is_float.hpp>
-#endif
-
 
 namespace boost {
 
 // uniform integer distribution on a small range [min, max]
 
-namespace detail {
-
-template <class InputStream, class UniformInt, class Impl>
-InputStream& extract_uniform_int(InputStream& is, UniformInt& ud, Impl& impl)
-{
- typename UniformInt::result_type min, max;
- is >> std::ws >> min >> std::ws >> max;
- impl.set(min, max);
- return is;
-}
-
-template<class UniformRandomNumberGenerator, class IntType>
-struct uniform_smallint_integer
-{
-public:
- typedef UniformRandomNumberGenerator base_type;
- typedef IntType result_type;
-
- uniform_smallint_integer(base_type & rng, IntType min_arg, IntType max_arg)
- : _rng(&rng)
- { set(min_arg, max_arg); }
-
- void set(result_type min, result_type 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;
- }
-
-private:
- typedef typename base_type::result_type base_result;
- base_type * _rng;
- IntType _min, _max;
- base_result _range;
- base_result _factor;
-};
-
-template<class UniformRandomNumberGenerator, class IntType>
-void uniform_smallint_integer<UniformRandomNumberGenerator, IntType>::
-set(result_type min_arg, result_type max_arg)
-{
- _min = min_arg;
- _max = max_arg;
- assert(min_arg <= max_arg);
-
- _range = static_cast<base_result>(_max-_min)+1;
- _factor = 1;
-
- // LCGs get bad when only taking the low bits.
- // (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)()) {
- _factor = 2;
- r_base /= 2;
- }
- r_base += 1;
- if(r_base % _range == 0) {
- // No quantization effects, good
- _factor = r_base / _range;
- } else {
- // carefully avoid overflow; pessimizing heree
- for( ; r_base/_range/32 >= _range; _factor *= 2)
- r_base /= 2;
- }
-}
-
-template<class UniformRandomNumberGenerator, class IntType>
-class uniform_smallint_float
-{
-public:
- typedef UniformRandomNumberGenerator base_type;
- typedef IntType result_type;
-
- uniform_smallint_float(base_type & rng, IntType min_arg, IntType max_arg)
- : _rng(rng)
- {
- // MSVC fails BOOST_STATIC_ASSERT with std::numeric_limits at class scope
-#if !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) && !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300)
- BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer);
- BOOST_STATIC_ASSERT(!std::numeric_limits<typename base_type::result_type>::is_integer);
-#endif
-
- assert(min_arg <= max_arg);
- set(min_arg, max_arg);
- }
-
- void set(result_type min_arg, result_type max_arg)
- {
- _min = min_arg;
- _max = max_arg;
- _range = static_cast<base_result>(_max-_min)+1;
- }
-
- 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()()
- {
- return static_cast<IntType>(_rng() * _range) + _min;
- }
-
-private:
- typedef typename base_type::result_type base_result;
- uniform_01<base_type> _rng;
- IntType _min, _max;
- base_result _range;
-};
-
-
-} // namespace detail
-
-
-
-
 template<class IntType = int>
 class uniform_smallint
 {
@@ -196,7 +71,7 @@
       // No quantization effects, good
       _factor = r_base / _range;
     } else {
- // carefully avoid overflow; pessimizing heree
+ // carefully avoid overflow; pessimizing here
       for( ; r_base/_range/32 >= _range; _factor *= 2)
         r_base /= 2;
     }
@@ -204,7 +79,7 @@
     return ((eng() - (eng.min)()) / _factor) % _range + _min;
   }
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_smallint& ud)
@@ -217,16 +92,13 @@
   friend std::basic_istream<CharT,Traits>&
   operator>>(std::basic_istream<CharT,Traits>& is, uniform_smallint& ud)
   {
-# if BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292)) && BOOST_MSVC > 1300
- return detail::extract_uniform_int(is, ud, ud._impl);
-# else
     is >> std::ws >> ud._min >> std::ws >> ud._max;
     return is;
-# endif
   }
 #endif
 
 private:
+
   result_type _min;
   result_type _max;
 };

Modified: trunk/boost/random/xor_combine.hpp
==============================================================================
--- trunk/boost/random/xor_combine.hpp (original)
+++ trunk/boost/random/xor_combine.hpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -21,6 +21,7 @@
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/cstdint.hpp> // uint32_t
+#include <boost/random/detail/config.hpp>
 
 
 namespace boost {
@@ -77,7 +78,7 @@
 
 #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
 
-#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   template<class CharT, class Traits>
   friend std::basic_ostream<CharT,Traits>&
   operator<<(std::basic_ostream<CharT,Traits>& os, const xor_combine& s)

Modified: trunk/libs/random/instantiate.cpp
==============================================================================
--- trunk/libs/random/instantiate.cpp (original)
+++ trunk/libs/random/instantiate.cpp 2009-02-23 10:48:27 EST (Mon, 23 Feb 2009)
@@ -81,7 +81,7 @@
   Dist d = dist; // copy ctor
   d = dist; // copy assignment
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   {
     std::ostringstream file;
     file << urng << std::endl;
@@ -105,7 +105,7 @@
                         (std::string(name) + " old == restored_dist"));
 #endif // BOOST_MSVC
   }
-#endif // BOOST_NO_OPERATORS_IN_NAMESPACE
+#endif // BOOST_RANDOM_NO_STREAM_OPERATORS
 }
 
 template<class URNG, class RealType>
@@ -173,7 +173,7 @@
   ResultType max = (urng3.max)();
   (void) &max;
 
-#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
+#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS
   // Streamable concept not supported for broken compilers
 
   // advance a little so that state is relatively arbitrary
@@ -221,10 +221,10 @@
 #endif // BOOST_MSVC
   }
 #endif // BOOST_NO_STD_WSTREAMBUF, BOOST_NO_STD_WSTRING
-#endif // BOOST_NO_OPERATORS_IN_NAMESPACE etc.
+#endif // BOOST_RANDOM_NO_STREAM_OPERATORS
 
   // instantiate various distributions with this URNG
- // instantiate_dist(urng, "uniform_smallint", boost::uniform_smallint(0, 11));
+ instantiate_dist(urng, "uniform_smallint", boost::uniform_smallint<>(0, 11));
   instantiate_dist(urng, "uniform_int", boost::uniform_int<>(-200, 20000));
   instantiate_dist(urng, "bernoulli_distribution",
                    boost::bernoulli_distribution<>(0.2));


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