mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
fix config for C++14
This commit is contained in:
parent
3d89eae1e9
commit
d0d2b677bc
20 changed files with 41 additions and 14 deletions
|
@ -71,10 +71,12 @@
|
|||
#include "./swap_element_copy.cpp"
|
||||
#include "./random_swap.cpp"
|
||||
#include "./random_swap_result.cpp"
|
||||
#include "./bogo_sort.cpp"
|
||||
#include "./bogo_sort_result.cpp"
|
||||
#include "./bozo_sort.cpp"
|
||||
#include "./bozo_sort_result.cpp"
|
||||
#ifndef TESTSPR_CONFIG_DISABLE_MONKEY_SORT_TEST
|
||||
# include "./bogo_sort.cpp"
|
||||
# include "./bogo_sort_result.cpp"
|
||||
# include "./bozo_sort.cpp"
|
||||
# include "./bozo_sort_result.cpp"
|
||||
#endif
|
||||
|
||||
#ifdef TESTSPR_CPP_INCLUDE_DISABLE_SPROUT_LIBS_ALGORITHM_TEST_MODIFYIING_CPP
|
||||
# undef TESTSPR_CPP_INCLUDE
|
||||
|
@ -140,10 +142,12 @@ namespace testspr {
|
|||
testspr::algorithm_swap_element_copy_test();
|
||||
testspr::algorithm_random_swap_test();
|
||||
testspr::algorithm_random_swap_result_test();
|
||||
#ifndef TESTSPR_CONFIG_DISABLE_MONKEY_SORT_TEST
|
||||
testspr::algorithm_bogo_sort_test();
|
||||
testspr::algorithm_bogo_sort_result_test();
|
||||
testspr::algorithm_bozo_sort_test();
|
||||
testspr::algorithm_bozo_sort_result_test();
|
||||
#endif
|
||||
}
|
||||
} // namespace testspr
|
||||
|
||||
|
|
|
@ -353,7 +353,7 @@ namespace sprout {
|
|||
}
|
||||
template<typename InputIterator>
|
||||
SPROUT_CXX14_CONSTEXPR void process_block_impl(InputIterator first, InputIterator last) {
|
||||
for(; first != last; ++first) {
|
||||
for (; first != last; ++first) {
|
||||
process_byte(*first);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -433,7 +433,7 @@ namespace sprout {
|
|||
}
|
||||
template<typename InputIterator>
|
||||
SPROUT_CXX14_CONSTEXPR void process_block_impl(InputIterator first, InputIterator last) {
|
||||
for(; first != last; ++first) {
|
||||
for (; first != last; ++first) {
|
||||
process_byte(*first);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
// SPROUT_CXX14_STATIC_CONSTEXPR
|
||||
//
|
||||
#ifndef SPROUT_CONFIG_DISABLE_CXX14_CONSTEXPR
|
||||
# define SPROUT_CXX14_CONSTEXPR constexpr
|
||||
# define SPROUT_CXX14_CONSTEXPR_OR_CONST constexpr
|
||||
# define SPROUT_CXX14_STATIC_CONSTEXPR static constexpr
|
||||
# define SPROUT_CXX14_CONSTEXPR SPROUT_CONSTEXPR
|
||||
# define SPROUT_CXX14_CONSTEXPR_OR_CONST SPROUT_CONSTEXPR_OR_CONST
|
||||
# define SPROUT_CXX14_STATIC_CONSTEXPR SPROUT_STATIC_CONSTEXPR
|
||||
#else // #ifndef SPROUT_CONFIG_DISABLE_CXX14_CONSTEXPR
|
||||
# define SPROUT_CXX14_CONSTEXPR
|
||||
# define SPROUT_CXX14_CONSTEXPR_OR_CONST const
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace sprout {
|
|||
class exempt_ptr {
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef T element_type;
|
||||
typedef T* pointer;
|
||||
typedef T const* const_pointer;
|
||||
typedef T& reference;
|
||||
|
|
|
@ -67,6 +67,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR additive_combine_engine()
|
||||
: mlcg1_(), mlcg2_()
|
||||
{}
|
||||
additive_combine_engine(additive_combine_engine const&) = default;
|
||||
explicit SPROUT_CONSTEXPR additive_combine_engine(result_type seed)
|
||||
: mlcg1_(seed), mlcg2_(seed)
|
||||
{}
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR param_type()
|
||||
: p_(RealType(0.5))
|
||||
{}
|
||||
param_type(param_type const&) = default;
|
||||
explicit SPROUT_CONSTEXPR param_type(RealType p_arg)
|
||||
: p_((SPROUT_ASSERT(p_arg >= RealType(0)), SPROUT_ASSERT(p_arg <= RealType(1)), p_arg))
|
||||
{}
|
||||
|
@ -94,6 +95,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR bernoulli_distribution() SPROUT_NOEXCEPT
|
||||
: p_(RealType(0.5))
|
||||
{}
|
||||
bernoulli_distribution(bernoulli_distribution const&) = default;
|
||||
explicit SPROUT_CONSTEXPR bernoulli_distribution(RealType p_arg)
|
||||
: p_((SPROUT_ASSERT(p_arg >= RealType(0)), SPROUT_ASSERT(p_arg <= RealType(1)), p_arg))
|
||||
{}
|
||||
|
|
|
@ -92,6 +92,7 @@ namespace sprout {
|
|||
: t_(1)
|
||||
, p_(0.5)
|
||||
{}
|
||||
param_type(param_type const&) = default;
|
||||
explicit SPROUT_CONSTEXPR param_type(IntType t_arg, RealType p_arg = RealType(0.5))
|
||||
: t_((SPROUT_ASSERT(t_arg >= IntType(0)), t_arg))
|
||||
, p_((SPROUT_ASSERT(RealType(0) <= p_arg && p_arg <= RealType(1)), p_arg))
|
||||
|
@ -708,6 +709,7 @@ namespace sprout {
|
|||
, btrd_(!init_use_inversion(1, RealType(0.5)) ? init_btrd(1, RealType(0.5)) : btrd_type())
|
||||
, q_n_(init_use_inversion(1, RealType(0.5)) ? init_q_n(1, RealType(0.5)) : RealType())
|
||||
{}
|
||||
binomial_distribution(binomial_distribution const&) = default;
|
||||
explicit SPROUT_CONSTEXPR binomial_distribution(IntType t_arg, RealType p_arg = RealType(0.5))
|
||||
: t_((SPROUT_ASSERT(t_arg >= IntType(0)), t_arg))
|
||||
, p_((SPROUT_ASSERT(RealType(0) <= p_arg && p_arg <= RealType(1)), p_arg))
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR param_type()
|
||||
: p_(RealType(0.5))
|
||||
{}
|
||||
param_type(param_type const&) = default;
|
||||
explicit SPROUT_CONSTEXPR param_type(RealType p_arg)
|
||||
: p_((SPROUT_ASSERT(RealType(0) < p_arg), SPROUT_ASSERT(p_arg < RealType(1)), p_arg))
|
||||
{}
|
||||
|
@ -105,6 +106,7 @@ namespace sprout {
|
|||
: p_(RealType(0.5))
|
||||
, log_1mp_(init_log_1mp(RealType(0.5)))
|
||||
{}
|
||||
geometric_distribution(geometric_distribution const&) = default;
|
||||
explicit SPROUT_CONSTEXPR geometric_distribution(RealType p_arg)
|
||||
: p_((SPROUT_ASSERT(RealType(0) < p_arg), SPROUT_ASSERT(p_arg < RealType(1)), p_arg))
|
||||
, log_1mp_(init_log_1mp(p_arg))
|
||||
|
|
|
@ -85,6 +85,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR inversive_congruential_engine()
|
||||
: x_(init_seed(default_seed))
|
||||
{}
|
||||
inversive_congruential_engine(inversive_congruential_engine const&) = default;
|
||||
explicit SPROUT_CONSTEXPR inversive_congruential_engine(result_type x0)
|
||||
: x_(init_seed(x0))
|
||||
{}
|
||||
|
|
|
@ -89,6 +89,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR linear_congruential_engine()
|
||||
: x_(init_seed())
|
||||
{}
|
||||
linear_congruential_engine(linear_congruential_engine const&) = default;
|
||||
explicit SPROUT_CONSTEXPR linear_congruential_engine(result_type x0)
|
||||
: x_(init_seed(x0))
|
||||
{}
|
||||
|
|
|
@ -84,6 +84,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR linear_feedback_shift_engine()
|
||||
: x_(init_seed(default_seed))
|
||||
{}
|
||||
linear_feedback_shift_engine(linear_feedback_shift_engine const&) = default;
|
||||
explicit SPROUT_CONSTEXPR linear_feedback_shift_engine(result_type x0)
|
||||
: x_(init_seed(x0))
|
||||
{}
|
||||
|
|
|
@ -376,6 +376,7 @@ namespace sprout {
|
|||
: x_(init_seed(default_seed))
|
||||
, i_(n)
|
||||
{}
|
||||
mersenne_twister_engine(mersenne_twister_engine const&) = default;
|
||||
explicit SPROUT_CONSTEXPR mersenne_twister_engine(result_type value)
|
||||
: x_(init_seed(value))
|
||||
, i_(n)
|
||||
|
@ -420,7 +421,7 @@ namespace sprout {
|
|||
)
|
||||
{
|
||||
sprout::array<result_type, n> data;
|
||||
for(std::size_t i = 0; i < rhs.i_; ++i) {
|
||||
for (std::size_t i = 0; i < rhs.i_; ++i) {
|
||||
data[i + n - rhs.i_] = rhs.x_[i];
|
||||
}
|
||||
if (rhs.i_ != n) {
|
||||
|
|
|
@ -49,6 +49,7 @@ namespace sprout {
|
|||
: mean_(RealType(0.0))
|
||||
, sigma_(RealType(1.0))
|
||||
{}
|
||||
param_type(param_type const&) = default;
|
||||
explicit SPROUT_CONSTEXPR param_type(RealType mean_arg, RealType sigma_arg = RealType(1.0))
|
||||
: mean_(mean_arg)
|
||||
, sigma_((SPROUT_ASSERT(sigma_arg >= RealType(0)), sigma_arg))
|
||||
|
@ -167,6 +168,7 @@ namespace sprout {
|
|||
, cached_rho_(0)
|
||||
, valid_(false)
|
||||
{}
|
||||
normal_distribution(normal_distribution const&) = default;
|
||||
explicit SPROUT_CONSTEXPR normal_distribution(RealType mean_arg, RealType sigma_arg = RealType(1.0))
|
||||
: mean_(mean_arg)
|
||||
, sigma_((SPROUT_ASSERT(sigma_arg >= RealType(0)), sigma_arg))
|
||||
|
|
|
@ -180,6 +180,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR shuffle_order_engine()
|
||||
: member_type(init_member(base_type()))
|
||||
{}
|
||||
shuffle_order_engine(shuffle_order_engine const&) = default;
|
||||
explicit SPROUT_CONSTEXPR shuffle_order_engine(result_type seed)
|
||||
: member_type(init_member(base_type(seed)))
|
||||
{}
|
||||
|
|
|
@ -123,6 +123,7 @@ namespace sprout {
|
|||
#endif
|
||||
public:
|
||||
SPROUT_CONSTEXPR uniform_01() SPROUT_DEFAULTED_DEFAULT_CONSTRUCTOR_DECL
|
||||
uniform_01(uniform_01 const&) = default;
|
||||
explicit SPROUT_CONSTEXPR uniform_01(param_type const&) SPROUT_NOEXCEPT {}
|
||||
SPROUT_CONSTEXPR result_type min() const SPROUT_NOEXCEPT {
|
||||
return result_type(0);
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace sprout {
|
|||
min_value
|
||||
);
|
||||
} else if (brange < range) {
|
||||
for(; ; ) {
|
||||
for (; ; ) {
|
||||
range_type limit = range_type();
|
||||
if (range == sprout::numeric_limits<range_type>::max()) {
|
||||
limit = range / (range_type(brange) + 1);
|
||||
|
@ -99,7 +99,7 @@ namespace sprout {
|
|||
} else {
|
||||
bucket_size = (brange + 1) / (static_cast<base_unsigned>(range) + 1);
|
||||
}
|
||||
for(; ; ) {
|
||||
for (; ; ) {
|
||||
base_unsigned result = sprout::random::detail::subtract<base_result>()(static_cast<base_result>(eng()), bmin) / bucket_size;
|
||||
if (result <= static_cast<base_unsigned>(range)) {
|
||||
return sprout::random::detail::add<base_unsigned, result_type>()(result, min_value);
|
||||
|
@ -804,6 +804,7 @@ namespace sprout {
|
|||
: min_(0)
|
||||
, max_(sprout::numeric_limits<IntType>::max())
|
||||
{}
|
||||
param_type(param_type const&) = default;
|
||||
explicit SPROUT_CONSTEXPR param_type(IntType min_arg, IntType max_arg = sprout::numeric_limits<IntType>::max())
|
||||
: min_((SPROUT_ASSERT(min_arg <= max_arg), min_arg))
|
||||
, max_(max_arg)
|
||||
|
@ -864,6 +865,7 @@ namespace sprout {
|
|||
: min_(0)
|
||||
, max_(sprout::numeric_limits<IntType>::max())
|
||||
{}
|
||||
uniform_int_distribution(uniform_int_distribution const&) = default;
|
||||
explicit SPROUT_CONSTEXPR uniform_int_distribution(IntType min_arg, IntType max_arg = sprout::numeric_limits<IntType>::max())
|
||||
: min_((SPROUT_ASSERT(min_arg <= max_arg), min_arg))
|
||||
, max_(max_arg)
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace sprout {
|
|||
std::false_type
|
||||
)
|
||||
{
|
||||
for(;;) {
|
||||
for (; ; ) {
|
||||
typedef T result_type;
|
||||
typedef typename Engine::result_type base_result;
|
||||
result_type numerator = static_cast<T>(static_cast<base_result>(eng()) - eng.min());
|
||||
|
@ -54,7 +54,7 @@ namespace sprout {
|
|||
std::true_type
|
||||
)
|
||||
{
|
||||
for(;;) {
|
||||
for (; ; ) {
|
||||
typedef T result_type;
|
||||
typedef typename Engine::result_type base_result;
|
||||
result_type numerator = static_cast<T>(sprout::random::detail::subtract<base_result>()(static_cast<base_result>(eng()), eng.min()));
|
||||
|
@ -413,6 +413,7 @@ namespace sprout {
|
|||
: min_(RealType(0.0))
|
||||
, max_(RealType(1.0))
|
||||
{}
|
||||
param_type(param_type const&) = default;
|
||||
explicit SPROUT_CONSTEXPR param_type(RealType min_arg, RealType max_arg = RealType(1.0))
|
||||
: min_((SPROUT_ASSERT(min_arg <= max_arg), min_arg))
|
||||
, max_(max_arg)
|
||||
|
@ -473,6 +474,7 @@ namespace sprout {
|
|||
: min_(RealType(0.0))
|
||||
, max_(RealType(1.0))
|
||||
{}
|
||||
uniform_real_distribution(uniform_real_distribution const&) = default;
|
||||
explicit SPROUT_CONSTEXPR uniform_real_distribution(RealType min_arg, RealType max_arg = RealType(1.0))
|
||||
: min_((SPROUT_ASSERT(min_arg <= max_arg), min_arg))
|
||||
, max_(max_arg)
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace sprout {
|
|||
: min_(0)
|
||||
, max_(sprout::numeric_limits<IntType>::max())
|
||||
{}
|
||||
param_type(param_type const&) = default;
|
||||
explicit SPROUT_CONSTEXPR param_type(IntType min_arg, IntType max_arg = sprout::numeric_limits<IntType>::max())
|
||||
: min_((SPROUT_ASSERT(min_arg <= max_arg), min_arg))
|
||||
, max_(max_arg)
|
||||
|
@ -234,6 +235,7 @@ namespace sprout {
|
|||
: min_(0)
|
||||
, max_(sprout::numeric_limits<IntType>::max())
|
||||
{}
|
||||
uniform_smallint(uniform_smallint const&) = default;
|
||||
explicit SPROUT_CONSTEXPR uniform_smallint(IntType min_arg, IntType max_arg = sprout::numeric_limits<IntType>::max())
|
||||
: min_((SPROUT_ASSERT(min_arg <= max_arg), min_arg))
|
||||
, max_(max_arg)
|
||||
|
|
|
@ -57,6 +57,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR xor_combine_engine()
|
||||
: rng1_(), rng2_()
|
||||
{}
|
||||
xor_combine_engine(xor_combine_engine const&) = default;
|
||||
explicit SPROUT_CONSTEXPR xor_combine_engine(result_type seed)
|
||||
: rng1_(seed), rng2_(seed)
|
||||
{}
|
||||
|
|
Loading…
Reference in a new issue