]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/random/detail/seed.hpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
f6a7f045ec53d6bcea362bd188727fe3eb0b530d
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / random / detail / seed.hpp
1 /* boost random/detail/seed.hpp header file\r
2  *\r
3  * Copyright Steven Watanabe 2009\r
4  * Distributed under the Boost Software License, Version 1.0. (See\r
5  * accompanying file LICENSE_1_0.txt or copy at\r
6  * http://www.boost.org/LICENSE_1_0.txt)\r
7  *\r
8  * See http://www.boost.org for most recent version including documentation.\r
9  *\r
10  * $Id: seed.hpp 53871 2009-06-13 17:54:06Z steven_watanabe $\r
11  */\r
12 \r
13 #ifndef BOOST_RANDOM_DETAIL_SEED_HPP\r
14 #define BOOST_RANDOM_DETAIL_SEED_HPP\r
15 \r
16 #include <boost/config.hpp>\r
17 \r
18 #if !defined(BOOST_NO_SFINAE)\r
19 \r
20 #include <boost/utility/enable_if.hpp>\r
21 #include <boost/type_traits/is_arithmetic.hpp>\r
22 \r
23 namespace boost {\r
24 namespace random {\r
25 namespace detail {\r
26 \r
27 template<class T>\r
28 struct disable_seed : boost::disable_if<boost::is_arithmetic<T> > {};\r
29 \r
30 template<class Engine, class T>\r
31 struct disable_constructor : disable_seed<T> {};\r
32 \r
33 template<class Engine>\r
34 struct disable_constructor<Engine, Engine> {\r
35 };\r
36 \r
37 #define BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(Self, Generator, gen) \\r
38     template<class Generator>                                           \\r
39     explicit Self(Generator& gen, typename ::boost::random::detail::disable_constructor<Self, Generator>::type* = 0)\r
40 \r
41 #define BOOST_RANDOM_DETAIL_GENERATOR_SEED(Self, Generator, gen)    \\r
42     template<class Generator>                                       \\r
43     void seed(Generator& gen, typename ::boost::random::detail::disable_seed<Generator>::type* = 0)\r
44 \r
45 #define BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(Self, T, x)  \\r
46     explicit Self(const T& x)\r
47 \r
48 #define BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(Self, T, x) \\r
49     void seed(const T& x)\r
50 \r
51 }\r
52 }\r
53 }\r
54 \r
55 #else\r
56 \r
57 #include <boost/type_traits/is_arithmetic.hpp>\r
58 #include <boost/mpl/bool.hpp>\r
59 \r
60 #define BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(Self, Generator, gen) \\r
61     Self(Self& other) { *this = other; }                                \\r
62     Self(const Self& other) { *this = other; }                          \\r
63     template<class Generator>                                           \\r
64     explicit Self(Generator& gen) {                                     \\r
65         boost_random_constructor_impl(gen, ::boost::is_arithmetic<Generator>());\\r
66     }                                                                   \\r
67     template<class Generator>                                           \\r
68     void boost_random_constructor_impl(Generator& gen, ::boost::mpl::false_)\r
69 \r
70 #define BOOST_RANDOM_DETAIL_GENERATOR_SEED(Self, Generator, gen)    \\r
71     template<class Generator>                                       \\r
72     void seed(Generator& gen) {                                     \\r
73         boost_random_seed_impl(gen, ::boost::is_arithmetic<Generator>());\\r
74     }\\r
75     template<class Generator>\\r
76     void boost_random_seed_impl(Generator& gen, ::boost::mpl::false_)\r
77 \r
78 #define BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(Self, T, x)  \\r
79     explicit Self(const T& x) { boost_random_constructor_impl(x, ::boost::mpl::true_()); }\\r
80     void boost_random_constructor_impl(const T& x, ::boost::mpl::true_)\r
81 \r
82 #define BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(Self, T, x) \\r
83     void seed(const T& x) { boost_random_seed_impl(x, ::boost::mpl::true_()); }\\r
84     void boost_random_seed_impl(const T& x, ::boost::mpl::true_)\r
85 \r
86 #endif\r
87 \r
88 #endif\r