$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r63549 - in trunk/boost/random: . detail
From: steven_at_[hidden]
Date: 2010-07-03 13:52:16
Author: steven_watanabe
Date: 2010-07-03 13:52:16 EDT (Sat, 03 Jul 2010)
New Revision: 63549
URL: http://svn.boost.org/trac/boost/changeset/63549
Log:
Add the old names of the generators for backward compatibility.
Added:
   trunk/boost/random/detail/generator_seed_seq.hpp   (contents, props changed)
Text files modified: 
   trunk/boost/random/discard_block.hpp       |    19 ++++++++++++                            
   trunk/boost/random/mersenne_twister.hpp    |    37 ++++++++++++++++++++++++                
   trunk/boost/random/shuffle_output.hpp      |    30 ++++++++++++++++++++                    
   trunk/boost/random/subtract_with_carry.hpp |    60 ++++++++++++++++++++++++++++++++++++++++
   4 files changed, 146 insertions(+), 0 deletions(-)
Added: trunk/boost/random/detail/generator_seed_seq.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/random/detail/generator_seed_seq.hpp	2010-07-03 13:52:16 EDT (Sat, 03 Jul 2010)
@@ -0,0 +1,40 @@
+/* boost random/mersenne_twister.hpp header file
+ *
+ * Copyright Jens Maurer 2000-2001
+ * Copyright Steven Watanabe 2010
+ * 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$
+ *
+ */
+
+#ifndef BOOST_RANDOM_DETAIL_GENERATOR_SEED_SEQ_HPP_INCLUDED
+#define BOOST_RANDOM_DETAIL_GENERATOR_SEED_SEQ_HPP_INCLUDED
+
+namespace boost {
+namespace random {
+namespace detail {
+
+template<class Generator>
+class generator_seed_seq {
+public:
+    generator_seed_seq(Generator& g) : gen(&g) {}
+    template<class It>
+    void generate(It first, It last) {
+        for(; first != last; ++first) {
+            *first = (*gen)();
+        }
+    }
+private:
+    Generator* gen;
+};
+
+}
+}
+}
+
+#endif
Modified: trunk/boost/random/discard_block.hpp
==============================================================================
--- trunk/boost/random/discard_block.hpp	(original)
+++ trunk/boost/random/discard_block.hpp	2010-07-03 13:52:16 EDT (Sat, 03 Jul 2010)
@@ -192,6 +192,25 @@
 const std::size_t discard_block_engine<URNG, p, r>::used_block;
 #endif
 
+template<class URNG, int p, int r>
+class discard_block : public discard_block_engine<URNG, p, r>
+{
+    typedef discard_block_engine<URNG, p, r> base_t;
+    typedef typename base_t::result_type result_type;
+public:
+    discard_block() {}
+    template<class T>
+    discard_block(T& arg) : base_t(arg) {}
+    template<class T>
+    discard_block(const T& arg) : base_t(arg) {}
+    template<class It>
+    discard_block(It& first, It last) : base_t(first, last) {}
+    result_type min BOOST_PREVENT_MACRO_SUBSTITUTION ()
+    { return (this->base().min)(); }
+    result_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
+    { return (this->base().max)(); }
+};
+
 } // namespace random
 
 } // namespace boost
Modified: trunk/boost/random/mersenne_twister.hpp
==============================================================================
--- trunk/boost/random/mersenne_twister.hpp	(original)
+++ trunk/boost/random/mersenne_twister.hpp	2010-07-03 13:52:16 EDT (Sat, 03 Jul 2010)
@@ -25,6 +25,7 @@
 #include <boost/random/detail/config.hpp>
 #include <boost/random/detail/ptr_helper.hpp>
 #include <boost/random/detail/seed.hpp>
+#include <boost/random/detail/generator_seed_seq.hpp>
 
 namespace boost {
 namespace random {
@@ -508,6 +509,42 @@
     UINT64_C(6364136223846793005)> mt19937_64;
 #endif
 
+
+/// \cond
+
+template<class UIntType,
+         int w, int n, int m, int r,
+         UIntType a, int u, std::size_t s,
+         UIntType b, int t,
+         UIntType c, int l, UIntType v>
+class mersenne_twister :
+    public mersenne_twister_engine<UIntType,
+        w, n, m, r, a, u, ~(UIntType)0, s, b, t, c, l, 1812433253>
+{
+    typedef mersenne_twister_engine<UIntType,
+        w, n, m, r, a, u, ~(UIntType)0, s, b, t, c, l, 1812433253> base_type;
+public:
+    mersenne_twister() {}
+    BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(mersenne_twister, Gen, gen)
+    { seed(gen); }
+    BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(mersenne_twister, UIntType, val)
+    { seed(val); }
+    template<class It>
+    mersenne_twister(It& first, It last) : base_type(first, last) {}
+    void seed() { base_type::seed(); }
+    BOOST_RANDOM_DETAIL_GENERATOR_SEED(mersenne_twister, Gen, gen)
+    {
+        detail::generator_seed_seq<Gen> seq(gen);
+        base_type::seed(seq);
+    }
+    BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(mersenne_twister, UIntType, val)
+    { base_type::seed(val); }
+    template<class It>
+    void seed(It& first, It last) { base_type::seed(first, last); }
+};
+
+/// \endcond
+
 } // namespace random
 
 using random::mt11213b;
Modified: trunk/boost/random/shuffle_output.hpp
==============================================================================
--- trunk/boost/random/shuffle_output.hpp	(original)
+++ trunk/boost/random/shuffle_output.hpp	2010-07-03 13:52:16 EDT (Sat, 03 Jul 2010)
@@ -18,4 +18,34 @@
 
 #include <boost/random/shuffle_order.hpp>
 
+namespace boost {
+namespace random {
+
+/// \cond
+
+template<typename URNG, int k, 
+         typename URNG::result_type val = 0> 
+class shuffle_output : public shuffle_order_engine<URNG, k>
+{
+    typedef shuffle_order_engine<URNG, k> base_t;
+    typedef typename base_t::result_type result_type;
+public:
+    shuffle_output() {}
+    template<class T>
+    shuffle_output(T& arg) : base_t(arg) {}
+    template<class T>
+    shuffle_output(const T& arg) : base_t(arg) {}
+    template<class It>
+    shuffle_output(It& first, It last) : base_t(first, last) {}
+    result_type min BOOST_PREVENT_MACRO_SUBSTITUTION ()
+    { return (this->base().min)(); }
+    result_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
+    { return (this->base().max)(); }
+};
+
+/// \endcond
+
+}
+}
+
 #endif // BOOST_RANDOM_SHUFFLE_OUTPUT_HPP
Modified: trunk/boost/random/subtract_with_carry.hpp
==============================================================================
--- trunk/boost/random/subtract_with_carry.hpp	(original)
+++ trunk/boost/random/subtract_with_carry.hpp	2010-07-03 13:52:16 EDT (Sat, 03 Jul 2010)
@@ -24,6 +24,7 @@
 #include <boost/limits.hpp>
 #include <boost/cstdint.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/integer/static_log2.hpp>
 #include <boost/detail/workaround.hpp>
 #include <boost/random/detail/config.hpp>
 #include <boost/random/detail/seed.hpp>
@@ -495,6 +496,65 @@
 const uint32_t subtract_with_carry_01_engine<RealType, w, s, r>::default_seed;
 #endif
 
+
+/// \cond
+
+template<class IntType, IntType m, unsigned s, unsigned r, IntType v>
+class subtract_with_carry :
+    public subtract_with_carry_engine<IntType,
+        boost::static_log2<m>::value, s, r>
+{
+    typedef subtract_with_carry_engine<IntType,
+        boost::static_log2<m>::value, s, r> base_type;
+public:
+    subtract_with_carry() {}
+    BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(subtract_with_carry, Gen, gen)
+    { seed(gen); }
+    BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(subtract_with_carry,
+                                               uint32_t, val)
+    { seed(val); }
+    template<class It>
+    subtract_with_carry(It& first, It last) : base_type(first, last) {}
+    void seed() { base_type::seed(); }
+    BOOST_RANDOM_DETAIL_GENERATOR_SEED(subtract_with_carry, Gen, gen)
+    {
+        detail::generator_seed_seq<Gen> seq(gen);
+        base_type::seed(seq);
+    }
+    BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(subtract_with_carry, uint32_t, val)
+    { base_type::seed(val); }
+    template<class It>
+    void seed(It& first, It last) { base_type::seed(first, last); }
+};
+
+template<class RealType, int w, unsigned s, unsigned r, int v = 0>
+class subtract_with_carry_01 :
+    public subtract_with_carry_01_engine<RealType, w, s, r>
+{
+    typedef subtract_with_carry_01_engine<RealType, w, s, r> base_type;
+public:
+    subtract_with_carry_01() {}
+    BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(subtract_with_carry_01, Gen, gen)
+    { seed(gen); }
+    BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(subtract_with_carry_01,
+                                               uint32_t, val)
+    { seed(val); }
+    template<class It>
+    subtract_with_carry_01(It& first, It last) : base_type(first, last) {}
+    void seed() { base_type::seed(); }
+    BOOST_RANDOM_DETAIL_GENERATOR_SEED(subtract_with_carry_01, Gen, gen)
+    {
+        detail::generator_seed_seq<Gen> seq(gen);
+        base_type::seed(seq);
+    }
+    BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(subtract_with_carry_01, uint32_t, val)
+    { base_type::seed(val); }
+    template<class It>
+    void seed(It& first, It last) { base_type::seed(first, last); }
+};
+
+/// \endcond
+
 } // namespace random
 } // namespace boost