annotate DEPENDENCIES/generic/include/boost/random/detail/seed.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 /* boost random/detail/seed.hpp header file
Chris@16 2 *
Chris@16 3 * Copyright Steven Watanabe 2009
Chris@16 4 * Distributed under the Boost Software License, Version 1.0. (See
Chris@16 5 * accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 * http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 *
Chris@16 8 * See http://www.boost.org for most recent version including documentation.
Chris@16 9 *
Chris@101 10 * $Id$
Chris@16 11 */
Chris@16 12
Chris@16 13 #ifndef BOOST_RANDOM_DETAIL_SEED_HPP
Chris@16 14 #define BOOST_RANDOM_DETAIL_SEED_HPP
Chris@16 15
Chris@16 16 #include <boost/config.hpp>
Chris@16 17
Chris@16 18 // Sun seems to have trouble with the use of SFINAE for the
Chris@16 19 // templated constructor. So does Borland.
Chris@16 20 #if !defined(BOOST_NO_SFINAE) && !defined(__SUNPRO_CC) && !defined(__BORLANDC__)
Chris@16 21
Chris@16 22 #include <boost/utility/enable_if.hpp>
Chris@16 23 #include <boost/type_traits/is_arithmetic.hpp>
Chris@101 24 #include <boost/mpl/bool.hpp>
Chris@16 25
Chris@16 26 namespace boost {
Chris@16 27 namespace random {
Chris@16 28 namespace detail {
Chris@16 29
Chris@16 30 template<class T>
Chris@16 31 struct disable_seed : boost::disable_if<boost::is_arithmetic<T> > {};
Chris@16 32
Chris@16 33 template<class Engine, class T>
Chris@16 34 struct disable_constructor : disable_seed<T> {};
Chris@16 35
Chris@16 36 template<class Engine>
Chris@16 37 struct disable_constructor<Engine, Engine> {};
Chris@16 38
Chris@16 39 #define BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(Self, Generator, gen) \
Chris@16 40 template<class Generator> \
Chris@16 41 explicit Self(Generator& gen, typename ::boost::random::detail::disable_constructor<Self, Generator>::type* = 0)
Chris@16 42
Chris@16 43 #define BOOST_RANDOM_DETAIL_GENERATOR_SEED(Self, Generator, gen) \
Chris@16 44 template<class Generator> \
Chris@16 45 void seed(Generator& gen, typename ::boost::random::detail::disable_seed<Generator>::type* = 0)
Chris@16 46
Chris@16 47 #define BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(Self, SeedSeq, seq) \
Chris@16 48 template<class SeedSeq> \
Chris@16 49 explicit Self(SeedSeq& seq, typename ::boost::random::detail::disable_constructor<Self, SeedSeq>::type* = 0)
Chris@16 50
Chris@16 51 #define BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(Self, SeedSeq, seq) \
Chris@16 52 template<class SeedSeq> \
Chris@16 53 void seed(SeedSeq& seq, typename ::boost::random::detail::disable_seed<SeedSeq>::type* = 0)
Chris@16 54
Chris@16 55 #define BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(Self, T, x) \
Chris@16 56 explicit Self(const T& x)
Chris@16 57
Chris@16 58 #define BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(Self, T, x) \
Chris@16 59 void seed(const T& x)
Chris@16 60 }
Chris@16 61 }
Chris@16 62 }
Chris@16 63
Chris@16 64 #else
Chris@16 65
Chris@16 66 #include <boost/type_traits/is_arithmetic.hpp>
Chris@16 67 #include <boost/mpl/bool.hpp>
Chris@16 68
Chris@16 69 #define BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(Self, Generator, gen) \
Chris@16 70 Self(Self& other) { *this = other; } \
Chris@16 71 Self(const Self& other) { *this = other; } \
Chris@16 72 template<class Generator> \
Chris@16 73 explicit Self(Generator& gen) { \
Chris@16 74 boost_random_constructor_impl(gen, ::boost::is_arithmetic<Generator>());\
Chris@16 75 } \
Chris@16 76 template<class Generator> \
Chris@16 77 void boost_random_constructor_impl(Generator& gen, ::boost::mpl::false_)
Chris@16 78
Chris@16 79 #define BOOST_RANDOM_DETAIL_GENERATOR_SEED(Self, Generator, gen) \
Chris@16 80 template<class Generator> \
Chris@16 81 void seed(Generator& gen) { \
Chris@16 82 boost_random_seed_impl(gen, ::boost::is_arithmetic<Generator>());\
Chris@16 83 }\
Chris@16 84 template<class Generator>\
Chris@16 85 void boost_random_seed_impl(Generator& gen, ::boost::mpl::false_)
Chris@16 86
Chris@16 87 #define BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(Self, SeedSeq, seq) \
Chris@16 88 Self(Self& other) { *this = other; } \
Chris@16 89 Self(const Self& other) { *this = other; } \
Chris@16 90 template<class SeedSeq> \
Chris@16 91 explicit Self(SeedSeq& seq) { \
Chris@16 92 boost_random_constructor_impl(seq, ::boost::is_arithmetic<SeedSeq>());\
Chris@16 93 } \
Chris@16 94 template<class SeedSeq> \
Chris@16 95 void boost_random_constructor_impl(SeedSeq& seq, ::boost::mpl::false_)
Chris@16 96
Chris@16 97 #define BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(Self, SeedSeq, seq) \
Chris@16 98 template<class SeedSeq> \
Chris@16 99 void seed(SeedSeq& seq) { \
Chris@16 100 boost_random_seed_impl(seq, ::boost::is_arithmetic<SeedSeq>()); \
Chris@16 101 } \
Chris@16 102 template<class SeedSeq> \
Chris@16 103 void boost_random_seed_impl(SeedSeq& seq, ::boost::mpl::false_)
Chris@16 104
Chris@16 105 #define BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(Self, T, x) \
Chris@16 106 explicit Self(const T& x) { boost_random_constructor_impl(x, ::boost::mpl::true_()); }\
Chris@16 107 void boost_random_constructor_impl(const T& x, ::boost::mpl::true_)
Chris@16 108
Chris@16 109 #define BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(Self, T, x) \
Chris@16 110 void seed(const T& x) { boost_random_seed_impl(x, ::boost::mpl::true_()); }\
Chris@16 111 void boost_random_seed_impl(const T& x, ::boost::mpl::true_)
Chris@16 112
Chris@16 113 #endif
Chris@16 114
Chris@16 115 #endif