]> git.donarmstrong.com Git - rsem.git/blobdiff - boost/random/uniform_01.hpp
Updated boost to v1.55.0
[rsem.git] / boost / random / uniform_01.hpp
index 2cdd05f6519327a7d146b92a5f6a131a0fc1fb4b..d32a08546fe2a3b5e290075b29a9cf76ef7ffe37 100644 (file)
@@ -7,7 +7,7 @@
  *
  * See http://www.boost.org for most recent version including documentation.
  *
- * $Id: uniform_01.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $
+ * $Id: uniform_01.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $
  *
  * Revision history
  *  2001-02-18  moved to individual header files
 #include <boost/limits.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/random/detail/config.hpp>
-#include <boost/random/detail/pass_through_engine.hpp>
+#include <boost/random/detail/ptr_helper.hpp>
 
 #include <boost/random/detail/disable_warnings.hpp>
 
 namespace boost {
+namespace random {
 
 #ifdef BOOST_RANDOM_DOXYGEN
 
@@ -121,7 +122,6 @@ template<class UniformRandomNumberGenerator, class RealType>
 class backward_compatible_uniform_01
 {
   typedef boost::random::detail::ptr_helper<UniformRandomNumberGenerator> traits;
-  typedef boost::random::detail::pass_through_engine<UniformRandomNumberGenerator> internal_engine_type;
 public:
   typedef UniformRandomNumberGenerator base_type;
   typedef RealType result_type;
@@ -135,7 +135,7 @@ public:
   explicit backward_compatible_uniform_01(typename traits::rvalue_type rng)
     : _rng(rng),
       _factor(result_type(1) /
-              (result_type((_rng.max)()-(_rng.min)()) +
+              (result_type((base().max)()-(base().min)()) +
                result_type(std::numeric_limits<base_result>::is_integer ? 1 : 0)))
   {
   }
@@ -143,13 +143,13 @@ public:
 
   result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); }
   result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(1); }
-  typename traits::value_type& base() { return _rng.base(); }
-  const typename traits::value_type& base() const { return _rng.base(); }
+  typename traits::value_type& base() { return traits::ref(_rng); }
+  const typename traits::value_type& base() const { return traits::ref(_rng); }
   void reset() { }
 
   result_type operator()() {
     for (;;) {
-      result_type result = result_type(_rng() - (_rng.min)()) * _factor;
+      result_type result = result_type(base()() - (base().min)()) * _factor;
       if (result < result_type(1))
         return result;
     }
@@ -174,8 +174,8 @@ public:
 #endif
 
 private:
-  typedef typename internal_engine_type::result_type base_result;
-  internal_engine_type _rng;
+  typedef typename traits::value_type::result_type base_result;
+  UniformRandomNumberGenerator _rng;
   result_type _factor;
 };
 
@@ -266,6 +266,10 @@ public:
 
 #endif
 
+} // namespace random
+
+using random::uniform_01;
+
 } // namespace boost
 
 #include <boost/random/detail/enable_warnings.hpp>