annotate DEPENDENCIES/generic/include/boost/random/detail/seed.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
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@16 10 * $Id: seed.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $
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@16 24
Chris@16 25 namespace boost {
Chris@16 26 namespace random {
Chris@16 27 namespace detail {
Chris@16 28
Chris@16 29 template<class T>
Chris@16 30 struct disable_seed : boost::disable_if<boost::is_arithmetic<T> > {};
Chris@16 31
Chris@16 32 template<class Engine, class T>
Chris@16 33 struct disable_constructor : disable_seed<T> {};
Chris@16 34
Chris@16 35 template<class Engine>
Chris@16 36 struct disable_constructor<Engine, Engine> {};
Chris@16 37
Chris@16 38 #define BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(Self, Generator, gen) \
Chris@16 39 template<class Generator> \
Chris@16 40 explicit Self(Generator& gen, typename ::boost::random::detail::disable_constructor<Self, Generator>::type* = 0)
Chris@16 41
Chris@16 42 #define BOOST_RANDOM_DETAIL_GENERATOR_SEED(Self, Generator, gen) \
Chris@16 43 template<class Generator> \
Chris@16 44 void seed(Generator& gen, typename ::boost::random::detail::disable_seed<Generator>::type* = 0)
Chris@16 45
Chris@16 46 #define BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(Self, SeedSeq, seq) \
Chris@16 47 template<class SeedSeq> \
Chris@16 48 explicit Self(SeedSeq& seq, typename ::boost::random::detail::disable_constructor<Self, SeedSeq>::type* = 0)
Chris@16 49
Chris@16 50 #define BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(Self, SeedSeq, seq) \
Chris@16 51 template<class SeedSeq> \
Chris@16 52 void seed(SeedSeq& seq, typename ::boost::random::detail::disable_seed<SeedSeq>::type* = 0)
Chris@16 53
Chris@16 54 #define BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(Self, T, x) \
Chris@16 55 explicit Self(const T& x)
Chris@16 56
Chris@16 57 #define BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(Self, T, x) \
Chris@16 58 void seed(const T& x)
Chris@16 59 }
Chris@16 60 }
Chris@16 61 }
Chris@16 62
Chris@16 63 #else
Chris@16 64
Chris@16 65 #include <boost/type_traits/is_arithmetic.hpp>
Chris@16 66 #include <boost/mpl/bool.hpp>
Chris@16 67
Chris@16 68 #define BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(Self, Generator, gen) \
Chris@16 69 Self(Self& other) { *this = other; } \
Chris@16 70 Self(const Self& other) { *this = other; } \
Chris@16 71 template<class Generator> \
Chris@16 72 explicit Self(Generator& gen) { \
Chris@16 73 boost_random_constructor_impl(gen, ::boost::is_arithmetic<Generator>());\
Chris@16 74 } \
Chris@16 75 template<class Generator> \
Chris@16 76 void boost_random_constructor_impl(Generator& gen, ::boost::mpl::false_)
Chris@16 77
Chris@16 78 #define BOOST_RANDOM_DETAIL_GENERATOR_SEED(Self, Generator, gen) \
Chris@16 79 template<class Generator> \
Chris@16 80 void seed(Generator& gen) { \
Chris@16 81 boost_random_seed_impl(gen, ::boost::is_arithmetic<Generator>());\
Chris@16 82 }\
Chris@16 83 template<class Generator>\
Chris@16 84 void boost_random_seed_impl(Generator& gen, ::boost::mpl::false_)
Chris@16 85
Chris@16 86 #define BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(Self, SeedSeq, seq) \
Chris@16 87 Self(Self& other) { *this = other; } \
Chris@16 88 Self(const Self& other) { *this = other; } \
Chris@16 89 template<class SeedSeq> \
Chris@16 90 explicit Self(SeedSeq& seq) { \
Chris@16 91 boost_random_constructor_impl(seq, ::boost::is_arithmetic<SeedSeq>());\
Chris@16 92 } \
Chris@16 93 template<class SeedSeq> \
Chris@16 94 void boost_random_constructor_impl(SeedSeq& seq, ::boost::mpl::false_)
Chris@16 95
Chris@16 96 #define BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(Self, SeedSeq, seq) \
Chris@16 97 template<class SeedSeq> \
Chris@16 98 void seed(SeedSeq& seq) { \
Chris@16 99 boost_random_seed_impl(seq, ::boost::is_arithmetic<SeedSeq>()); \
Chris@16 100 } \
Chris@16 101 template<class SeedSeq> \
Chris@16 102 void boost_random_seed_impl(SeedSeq& seq, ::boost::mpl::false_)
Chris@16 103
Chris@16 104 #define BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(Self, T, x) \
Chris@16 105 explicit Self(const T& x) { boost_random_constructor_impl(x, ::boost::mpl::true_()); }\
Chris@16 106 void boost_random_constructor_impl(const T& x, ::boost::mpl::true_)
Chris@16 107
Chris@16 108 #define BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(Self, T, x) \
Chris@16 109 void seed(const T& x) { boost_random_seed_impl(x, ::boost::mpl::true_()); }\
Chris@16 110 void boost_random_seed_impl(const T& x, ::boost::mpl::true_)
Chris@16 111
Chris@16 112 #endif
Chris@16 113
Chris@16 114 #endif