add ptr_fun, mem_fun, mem_fun_ref

This commit is contained in:
bolero-MURAKAMI 2012-04-11 23:28:29 +09:00
parent 4a8e938887
commit f86d17d0d4
46 changed files with 322 additions and 76 deletions

View file

@ -127,7 +127,7 @@ namespace sprout {
private: private:
sprout::tuples::tuple<Arg> children_; sprout::tuples::tuple<Arg> children_;
public: public:
SPROUT_CONSTEXPR explicit basic_expr(Arg const& arg) explicit SPROUT_CONSTEXPR basic_expr(Arg const& arg)
: children_(arg) : children_(arg)
{} {}
template<long N> template<long N>
@ -174,7 +174,7 @@ namespace sprout {
private: private:
sprout::tuples::tuple<Args...> children_; sprout::tuples::tuple<Args...> children_;
public: public:
SPROUT_CONSTEXPR explicit basic_expr(Args const&... args) explicit SPROUT_CONSTEXPR basic_expr(Args const&... args)
: children_(args...) : children_(args...)
{} {}
template<long N> template<long N>
@ -238,7 +238,7 @@ namespace sprout {
private: private:
sprout::tuples::tuple<Arg> children_; sprout::tuples::tuple<Arg> children_;
public: public:
SPROUT_CONSTEXPR explicit expr(Arg const& arg) explicit SPROUT_CONSTEXPR expr(Arg const& arg)
: children_(arg) : children_(arg)
{} {}
template<long N> template<long N>
@ -365,7 +365,7 @@ namespace sprout {
private: private:
sprout::tuples::tuple<Arg> children_; sprout::tuples::tuple<Arg> children_;
public: public:
SPROUT_CONSTEXPR explicit basic_expr(Args const&... args) explicit SPROUT_CONSTEXPR basic_expr(Args const&... args)
: children_(args...) : children_(args...)
{} {}
template<long N> template<long N>
@ -466,7 +466,7 @@ namespace sprout {
public: public:
SPROUT_BREED_UNEXPR(); SPROUT_BREED_UNEXPR();
public: public:
SPROUT_CONSTEXPR explicit unexpr(Expr const& e) explicit SPROUT_CONSTEXPR unexpr(Expr const& e)
: Expr(e) : Expr(e)
{} {}
using Expr::operator=; using Expr::operator=;

View file

@ -338,10 +338,10 @@ namespace sprout {
SPROUT_CONSTEXPR compressed_pair(first_param_type x, second_param_type y) SPROUT_CONSTEXPR compressed_pair(first_param_type x, second_param_type y)
: base_type(x, y) : base_type(x, y)
{} {}
SPROUT_CONSTEXPR explicit compressed_pair(first_param_type x) explicit SPROUT_CONSTEXPR compressed_pair(first_param_type x)
: base_type(x) : base_type(x)
{} {}
SPROUT_CONSTEXPR explicit compressed_pair(second_param_type y) explicit SPROUT_CONSTEXPR compressed_pair(second_param_type y)
: base_type(y) : base_type(y)
{} {}
first_reference first() { first_reference first() {
@ -402,7 +402,7 @@ namespace sprout {
SPROUT_CONSTEXPR compressed_pair(first_param_type x, second_param_type y) SPROUT_CONSTEXPR compressed_pair(first_param_type x, second_param_type y)
: base_type(x, y) : base_type(x, y)
{} {}
SPROUT_CONSTEXPR explicit compressed_pair(first_param_type x) explicit SPROUT_CONSTEXPR compressed_pair(first_param_type x)
: base_type(x) : base_type(x)
{} {}
first_reference first() { first_reference first() {

View file

@ -99,7 +99,7 @@ namespace sprout {
); );
} }
public: public:
SPROUT_CONSTEXPR explicit basic_simple_camera( explicit SPROUT_CONSTEXPR basic_simple_camera(
unit_type const& far_plane, unit_type const& far_plane,
angle_of_view_reference::values reference_value = angle_of_view_reference::long_side, angle_of_view_reference::values reference_value = angle_of_view_reference::long_side,
position_type const& position = position_type(0, 0, -1), position_type const& position = position_type(0, 0, -1),

View file

@ -131,7 +131,7 @@ namespace sprout {
; ;
} }
public: public:
SPROUT_CONSTEXPR explicit texture_map( explicit SPROUT_CONSTEXPR texture_map(
texture_type const& texture, texture_type const& texture,
unit_type const& scale = 1, unit_type const& scale = 1,
unit_type const& offset_u = 0, unit_type const& offset_u = 0,

View file

@ -17,7 +17,7 @@ namespace sprout {
private: private:
result_type elem_; result_type elem_;
public: public:
SPROUT_CONSTEXPR explicit uniform_element(result_type const& elem) explicit SPROUT_CONSTEXPR uniform_element(result_type const& elem)
: elem_(elem) : elem_(elem)
{} {}
template<typename Unit> template<typename Unit>

View file

@ -4,6 +4,7 @@
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/functional/base.hpp> #include <sprout/functional/base.hpp>
#include <sprout/functional/functor.hpp> #include <sprout/functional/functor.hpp>
#include <sprout/functional/adaptor.hpp>
#include <sprout/functional/ref.hpp> #include <sprout/functional/ref.hpp>
#include <sprout/functional/mem_fn.hpp> #include <sprout/functional/mem_fn.hpp>
#include <sprout/functional/bind.hpp> #include <sprout/functional/bind.hpp>

View file

@ -0,0 +1,9 @@
#ifndef SPROUT_FUNCTIONAL_ADAPTOR_HPP
#define SPROUT_FUNCTIONAL_ADAPTOR_HPP
#include <sprout/config.hpp>
#include <sprout/functional/ptr_fun.hpp>
#include <sprout/functional/mem_fun.hpp>
#include <sprout/functional/mem_fun_ref.hpp>
#endif // #ifndef SPROUT_FUNCTIONAL_ADAPTOR_HPP

View file

@ -1,8 +1,8 @@
#ifndef SPROUT_FUNCTIONAL_BIND1ST_HPP #ifndef SPROUT_FUNCTIONAL_BIND1ST_HPP
#define SPROUT_FUNCTIONAL_BIND1ST_HPP #define SPROUT_FUNCTIONAL_BIND1ST_HPP
#include <functional>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/functional/base.hpp>
namespace sprout { namespace sprout {
// Copyright (C) 2011 RiSK (sscrisk) // Copyright (C) 2011 RiSK (sscrisk)
@ -10,7 +10,7 @@ namespace sprout {
// D.9.1 Class template binder1st // D.9.1 Class template binder1st
template<typename Fn> template<typename Fn>
class binder1st class binder1st
: public std::unary_function<typename Fn::second_argument_type, typename Fn::result_type> : public sprout::unary_function<typename Fn::second_argument_type, typename Fn::result_type>
{ {
protected: protected:
Fn op; Fn op;

View file

@ -1,8 +1,8 @@
#ifndef SPROUT_FUNCTIONAL_BIND2ND_HPP #ifndef SPROUT_FUNCTIONAL_BIND2ND_HPP
#define SPROUT_FUNCTIONAL_BIND2ND_HPP #define SPROUT_FUNCTIONAL_BIND2ND_HPP
#include <functional>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/functional/base.hpp>
namespace sprout { namespace sprout {
// Copyright (C) 2011 RiSK (sscrisk) // Copyright (C) 2011 RiSK (sscrisk)
@ -10,7 +10,7 @@ namespace sprout {
// D.9.3 Class template binder2nd // D.9.3 Class template binder2nd
template<typename Fn> template<typename Fn>
class binder2nd class binder2nd
: public std::unary_function<typename Fn::first_argument_type, typename Fn::result_type> : public sprout::unary_function<typename Fn::first_argument_type, typename Fn::result_type>
{ {
protected: protected:
Fn op; Fn op;

View file

@ -5,6 +5,7 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/utility/forward.hpp> #include <sprout/utility/forward.hpp>
#include <sprout/functional/base.hpp>
namespace sprout { namespace sprout {
// 20.8.10 member function adaptors // 20.8.10 member function adaptors
@ -14,11 +15,11 @@ namespace sprout {
struct maybe_unary_or_binary_function {}; struct maybe_unary_or_binary_function {};
template<typename Res, typename T1> template<typename Res, typename T1>
struct maybe_unary_or_binary_function<Res, T1> struct maybe_unary_or_binary_function<Res, T1>
: public std::unary_function<T1, Res> : public sprout::unary_function<T1, Res>
{}; {};
template<typename Res, typename T1, typename T2> template<typename Res, typename T1, typename T2>
struct maybe_unary_or_binary_function<Res, T1, T2> struct maybe_unary_or_binary_function<Res, T1, T2>
: public std::binary_function<T1, T2, Res> : public sprout::binary_function<T1, T2, Res>
{}; {};
template<typename T, bool> template<typename T, bool>

View file

@ -0,0 +1,91 @@
#ifndef SPROUT_FUNCTIONAL_MEM_FUN_HPP
#define SPROUT_FUNCTIONAL_MEM_FUN_HPP
#include <sprout/config.hpp>
#include <sprout/functional/base.hpp>
namespace sprout {
// D.8.2.2 adaptors (deprecated)
template<typename Ret, typename T>
class mem_fun_t
: public sprout::unary_function<T*, Ret>
{
private:
Ret (T::*f_)();
public:
explicit SPROUT_CONSTEXPR mem_fun_t(Ret (T::*pf)())
: f_(pf)
{}
SPROUT_CONSTEXPR Ret operator()(T* p) const {
return (p->*f_)();
}
};
template<typename Ret, typename T>
class const_mem_fun_t
: public sprout::unary_function<const T*, Ret>
{
private:
Ret (T::*f_)() const;
public:
explicit SPROUT_CONSTEXPR const_mem_fun_t(Ret (T::*pf)() const)
: f_(pf)
{}
SPROUT_CONSTEXPR Ret operator()(const T* p) const {
return (p->*f_)();
}
};
template<typename Ret, typename T, typename Arg>
class mem_fun1_t
: public sprout::binary_function<T*, Arg, Ret>
{
private:
Ret (T::*f_)(Arg);
public:
explicit SPROUT_CONSTEXPR mem_fun1_t(Ret (T::*pf)(Arg))
: f_(pf)
{}
SPROUT_CONSTEXPR Ret operator()(T* p, Arg x) const {
return (p->*f_)(x);
}
};
template<typename Ret, typename T, typename Arg>
class const_mem_fun1_t
: public sprout::binary_function<const T*, Arg, Ret>
{
private:
Ret (T::*f_)(Arg) const;
public:
explicit SPROUT_CONSTEXPR const_mem_fun1_t(Ret (T::*pf)(Arg) const)
: f_(pf)
{}
SPROUT_CONSTEXPR Ret operator()(const T* p, Arg x) const {
return (p->*f_)(x);
}
};
template<typename Ret, typename T>
inline SPROUT_CONSTEXPR sprout::mem_fun_t<Ret, T> mem_fun(Ret (T::*f)()) {
return sprout::mem_fun_t<Ret, T>(f);
}
template<typename Ret, typename T>
inline SPROUT_CONSTEXPR sprout::const_mem_fun_t<Ret, T> mem_fun(Ret (T::*f)() const) {
return sprout::const_mem_fun_t<Ret, T>(f);
}
template<typename Ret, typename T, typename Arg>
inline SPROUT_CONSTEXPR sprout::mem_fun1_t<Ret, T, Arg> mem_fun(Ret (T::*f)(Arg)) {
return sprout::mem_fun1_t<Ret, T, Arg>(f);
}
template<typename Ret, typename T, typename Arg>
inline SPROUT_CONSTEXPR sprout::const_mem_fun1_t<Ret, T, Arg> mem_fun(Ret (T::*f)(Arg) const) {
return sprout::const_mem_fun1_t<Ret, T, Arg>(f);
}
} // namespace sprout
#endif // #ifndef SPROUT_FUNCTIONAL_MEM_FUN_HPP

View file

@ -0,0 +1,91 @@
#ifndef SPROUT_FUNCTIONAL_MEM_FUN_REF_HPP
#define SPROUT_FUNCTIONAL_MEM_FUN_REF_HPP
#include <sprout/config.hpp>
#include <sprout/functional/base.hpp>
namespace sprout {
// D.8.2.2 adaptors (deprecated)
template<typename Ret, typename T>
class mem_fun_ref_t
: public sprout::unary_function<T, Ret>
{
private:
Ret (T::*f_)();
public:
explicit SPROUT_CONSTEXPR mem_fun_ref_t(Ret (T::*pf)())
: f_(pf)
{}
SPROUT_CONSTEXPR Ret operator()(T& r) const {
return (r.*f_)();
}
};
template<typename Ret, typename T>
class const_mem_fun_ref_t
: public sprout::unary_function<T, Ret>
{
private:
Ret (T::*f_)() const;
public:
explicit SPROUT_CONSTEXPR const_mem_fun_ref_t(Ret (T::*pf)() const)
: f_(pf)
{}
SPROUT_CONSTEXPR Ret operator()(const T& r) const {
return (r.*f_)();
}
};
template<typename Ret, typename T, typename Arg>
class mem_fun1_ref_t
: public sprout::binary_function<T, Arg, Ret>
{
private:
Ret (T::*f_)(Arg);
public:
explicit SPROUT_CONSTEXPR mem_fun1_ref_t(Ret (T::*pf)(Arg))
: f_(pf)
{}
SPROUT_CONSTEXPR Ret operator()(T& r, Arg x) const {
return (r.*f_)(x);
}
};
template<typename Ret, typename T, typename Arg>
class const_mem_fun1_ref_t
: public sprout::binary_function<T, Arg, Ret>
{
private:
Ret (T::*f_)(Arg) const;
public:
explicit SPROUT_CONSTEXPR const_mem_fun1_ref_t(Ret (T::*pf)(Arg) const)
: f_(pf)
{}
SPROUT_CONSTEXPR Ret operator()(const T& r, Arg x) const {
return (r.*f_)(x);
}
};
template<typename Ret, typename T>
inline SPROUT_CONSTEXPR sprout::mem_fun_ref_t<Ret, T> mem_fun_ref(Ret (T::*f)()) {
return sprout::mem_fun_ref_t<Ret, T>(f);
}
template<typename Ret, typename T>
inline SPROUT_CONSTEXPR sprout::const_mem_fun_ref_t<Ret, T> mem_fun_ref(Ret (T::*f)() const) {
return sprout::const_mem_fun_ref_t<Ret, T>(f);
}
template<typename Ret, typename T, typename Arg>
inline SPROUT_CONSTEXPR sprout::mem_fun1_ref_t<Ret, T, Arg> mem_fun_ref(Ret (T::*f)(Arg)) {
return sprout::mem_fun1_ref_t<Ret, T, Arg>(f);
}
template<typename Ret, typename T, typename Arg>
inline SPROUT_CONSTEXPR sprout::const_mem_fun1_ref_t<Ret, T, Arg> mem_fun_ref(Ret (T::*f)(Arg) const) {
return sprout::const_mem_fun1_ref_t<Ret, T, Arg>(f);
}
} // namespace sprout
#endif // #ifndef SPROUT_FUNCTIONAL_MEM_FUN_REF_HPP

View file

@ -0,0 +1,53 @@
#ifndef SPROUT_FUNCTIONAL_PTR_FUN_HPP
#define SPROUT_FUNCTIONAL_PTR_FUN_HPP
#include <sprout/config.hpp>
#include <sprout/functional/base.hpp>
namespace sprout {
// D.8.2.1 adaptors (deprecated)
template<typename Arg, typename Result>
class pointer_to_unary_function
: public sprout::unary_function<Arg, Result>
{
protected:
Result (*ptr_)(Arg);
public:
pointer_to_unary_function() = default;
explicit SPROUT_CONSTEXPR pointer_to_unary_function(Result (*x)(Arg))
: ptr_(x)
{}
SPROUT_CONSTEXPR Result operator()(Arg x) const {
return ptr_(x);
}
};
template<typename Arg, typename Result>
inline SPROUT_CONSTEXPR sprout::pointer_to_unary_function<Arg, Result> ptr_fun(Result (*x)(Arg)) {
return sprout::pointer_to_unary_function<Arg, Result>(x);
}
template<typename Arg1, typename Arg2, typename Result>
class pointer_to_binary_function
: public sprout::binary_function<Arg1, Arg2, Result>
{
protected:
Result (*ptr_)(Arg1, Arg2);
public:
pointer_to_binary_function() = default;
explicit SPROUT_CONSTEXPR pointer_to_binary_function(Result (*x)(Arg1, Arg2))
: ptr_(x)
{}
SPROUT_CONSTEXPR Result operator()(Arg1 x, Arg2 y) const {
return ptr_(x, y);
}
};
template<typename Arg1, typename Arg2, typename Result>
inline SPROUT_CONSTEXPR sprout::pointer_to_binary_function<Arg1, Arg2, Result> ptr_fun(Result (*x)(Arg1, Arg2)) {
return sprout::pointer_to_binary_function<Arg1, Arg2, Result>(x);
}
} // namespace sprout
#endif // #ifndef SPROUT_FUNCTIONAL_PTR_FUN_HPP

View file

@ -78,7 +78,7 @@ namespace sprout {
, i_() , i_()
{} {}
bytes_iterator(bytes_iterator const&) = default; bytes_iterator(bytes_iterator const&) = default;
SPROUT_CONSTEXPR explicit bytes_iterator(base_type it) explicit SPROUT_CONSTEXPR bytes_iterator(base_type it)
: it_(it) : it_(it)
, i_() , i_()
{} {}

View file

@ -35,7 +35,7 @@ namespace sprout {
public: public:
reverse_iterator() = default; reverse_iterator() = default;
reverse_iterator(reverse_iterator const&) = default; reverse_iterator(reverse_iterator const&) = default;
SPROUT_CONSTEXPR explicit reverse_iterator(iterator_type it) explicit SPROUT_CONSTEXPR reverse_iterator(iterator_type it)
: current(it) : current(it)
, deref_tmp(sprout::prev(it)) , deref_tmp(sprout::prev(it))
{} {}

View file

@ -61,7 +61,7 @@ namespace sprout {
, count_() , count_()
{} {}
value_iterator(value_iterator const&) = default; value_iterator(value_iterator const&) = default;
SPROUT_CONSTEXPR explicit value_iterator(typename sprout::value_holder<T>::param_type p, std::size_t count = -1) explicit SPROUT_CONSTEXPR value_iterator(typename sprout::value_holder<T>::param_type p, std::size_t count = -1)
: holder_(p) : holder_(p)
, count_(count) , count_(count)
{} {}

View file

@ -26,7 +26,7 @@ namespace sprout {
{ {
return sprout::remake<Result>( return sprout::remake<Result>(
result, result,
sprout::size(result), size,
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
? sprout::detail::dft_element_impl(first, last, Indexes - offset, input_size) ? sprout::detail::dft_element_impl(first, last, Indexes - offset, input_size)
: *sprout::next(sprout::internal_begin(result), Indexes) : *sprout::next(sprout::internal_begin(result), Indexes)

View file

@ -26,7 +26,7 @@ namespace sprout {
{ {
return sprout::remake<Result>( return sprout::remake<Result>(
result, result,
sprout::size(result), size,
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size (Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
? sprout::detail::idft_element_impl(first, last, Indexes - offset, input_size) ? sprout::detail::idft_element_impl(first, last, Indexes - offset, input_size)
: *sprout::next(sprout::internal_begin(result), Indexes) : *sprout::next(sprout::internal_begin(result), Indexes)

View file

@ -52,7 +52,7 @@ namespace sprout {
: mlcg1_() : mlcg1_()
, mlcg2_() , mlcg2_()
{} {}
SPROUT_CONSTEXPR explicit additive_combine_engine(result_type const& seed) explicit SPROUT_CONSTEXPR additive_combine_engine(result_type const& seed)
: mlcg1_(seed) : mlcg1_(seed)
, mlcg2_(seed) , mlcg2_(seed)
{} {}

View file

@ -43,7 +43,7 @@ namespace sprout {
SPROUT_CONSTEXPR param_type() SPROUT_CONSTEXPR param_type()
: p_(RealType(0.5)) : p_(RealType(0.5))
{} {}
SPROUT_CONSTEXPR explicit param_type(RealType p_arg) explicit SPROUT_CONSTEXPR param_type(RealType p_arg)
: p_(arg_check(p_arg)) : p_(arg_check(p_arg))
{} {}
SPROUT_CONSTEXPR RealType p() const { SPROUT_CONSTEXPR RealType p() const {
@ -98,10 +98,10 @@ namespace sprout {
SPROUT_CONSTEXPR bernoulli_distribution() SPROUT_CONSTEXPR bernoulli_distribution()
: p_(RealType(0.5)) : p_(RealType(0.5))
{} {}
SPROUT_CONSTEXPR explicit bernoulli_distribution(RealType p_arg) explicit SPROUT_CONSTEXPR bernoulli_distribution(RealType p_arg)
: p_(arg_check(p_arg)) : p_(arg_check(p_arg))
{} {}
SPROUT_CONSTEXPR explicit bernoulli_distribution(param_type const& parm) explicit SPROUT_CONSTEXPR bernoulli_distribution(param_type const& parm)
: p_(parm.p()) : p_(parm.p())
{} {}
SPROUT_CONSTEXPR RealType p() const { SPROUT_CONSTEXPR RealType p() const {

View file

@ -82,7 +82,7 @@ namespace sprout {
: t_(1) : t_(1)
, p_(0.5) , p_(0.5)
{} {}
SPROUT_CONSTEXPR explicit param_type(IntType t_arg, RealType p_arg = RealType(0.5)) explicit SPROUT_CONSTEXPR param_type(IntType t_arg, RealType p_arg = RealType(0.5))
: t_(arg_check(t_arg, p_arg)) : t_(arg_check(t_arg, p_arg))
, p_(p_arg) , p_(p_arg)
{} {}
@ -366,14 +366,14 @@ namespace sprout {
, btrd_(!init_use_inversion(1, RealType(0.5)) ? init_btrd(1, RealType(0.5)) : btrd_type()) , 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()) , q_n_(init_use_inversion(1, RealType(0.5)) ? init_q_n(1, RealType(0.5)) : RealType())
{} {}
SPROUT_CONSTEXPR explicit binomial_distribution(IntType t_arg, RealType p_arg = RealType(0.5)) explicit SPROUT_CONSTEXPR binomial_distribution(IntType t_arg, RealType p_arg = RealType(0.5))
: t_(arg_check(t_arg, p_arg)) : t_(arg_check(t_arg, p_arg))
, p_(p_arg) , p_(p_arg)
, m_(init_m(t_arg, p_arg)) , m_(init_m(t_arg, p_arg))
, btrd_(!init_use_inversion(t_arg, p_arg) ? init_btrd(t_arg, p_arg) : btrd_type()) , btrd_(!init_use_inversion(t_arg, p_arg) ? init_btrd(t_arg, p_arg) : btrd_type())
, q_n_(init_use_inversion(t_arg, p_arg) ? init_q_n(t_arg, p_arg) : RealType()) , q_n_(init_use_inversion(t_arg, p_arg) ? init_q_n(t_arg, p_arg) : RealType())
{} {}
SPROUT_CONSTEXPR explicit binomial_distribution(param_type const& parm) explicit SPROUT_CONSTEXPR binomial_distribution(param_type const& parm)
: t_(parm.t()) : t_(parm.t())
, p_(parm.p()) , p_(parm.p())
, m_(init_m(parm.t(), parm.p())) , m_(init_m(parm.t(), parm.p()))

View file

@ -30,7 +30,7 @@ namespace sprout {
SPROUT_CONSTEXPR uniform_int_float() SPROUT_CONSTEXPR uniform_int_float()
: rng_() : rng_()
{} {}
SPROUT_CONSTEXPR explicit uniform_int_float(base_type const& rng) explicit SPROUT_CONSTEXPR uniform_int_float(base_type const& rng)
: rng_(rng) : rng_(rng)
{} {}
SPROUT_CONSTEXPR result_type min() const { SPROUT_CONSTEXPR result_type min() const {

View file

@ -56,7 +56,7 @@ namespace sprout {
SPROUT_CONSTEXPR param_type() SPROUT_CONSTEXPR param_type()
: p_(RealType(0.5)) : p_(RealType(0.5))
{} {}
SPROUT_CONSTEXPR explicit param_type(RealType p_arg) explicit SPROUT_CONSTEXPR param_type(RealType p_arg)
: p_(arg_check(p_arg)) : p_(arg_check(p_arg))
{} {}
SPROUT_CONSTEXPR RealType p() const { SPROUT_CONSTEXPR RealType p() const {
@ -123,11 +123,11 @@ namespace sprout {
: p_(RealType(0.5)) : p_(RealType(0.5))
, log_1mp_(init_log_1mp(RealType(0.5))) , log_1mp_(init_log_1mp(RealType(0.5)))
{} {}
SPROUT_CONSTEXPR explicit geometric_distribution(RealType p_arg) explicit SPROUT_CONSTEXPR geometric_distribution(RealType p_arg)
: p_(arg_check(p_arg)) : p_(arg_check(p_arg))
, log_1mp_(init_log_1mp(p_arg)) , log_1mp_(init_log_1mp(p_arg))
{} {}
SPROUT_CONSTEXPR explicit geometric_distribution(param_type const& parm) explicit SPROUT_CONSTEXPR geometric_distribution(param_type const& parm)
: p_(parm.p()) : p_(parm.p())
, log_1mp_(init_log_1mp(parm.p())) , log_1mp_(init_log_1mp(parm.p()))
{} {}

View file

@ -66,7 +66,7 @@ namespace sprout {
SPROUT_CONSTEXPR inversive_congruential_engine() SPROUT_CONSTEXPR inversive_congruential_engine()
: x_(init_seed(default_seed)) : x_(init_seed(default_seed))
{} {}
SPROUT_CONSTEXPR explicit inversive_congruential_engine(IntType const& x0) explicit SPROUT_CONSTEXPR inversive_congruential_engine(IntType const& x0)
: x_(init_seed(x0)) : x_(init_seed(x0))
{} {}
SPROUT_CONSTEXPR result_type min() const { SPROUT_CONSTEXPR result_type min() const {

View file

@ -70,7 +70,7 @@ namespace sprout {
SPROUT_CONSTEXPR linear_congruential_engine() SPROUT_CONSTEXPR linear_congruential_engine()
: x_(init_seed(default_seed)) : x_(init_seed(default_seed))
{} {}
SPROUT_CONSTEXPR explicit linear_congruential_engine(IntType const& x0) explicit SPROUT_CONSTEXPR linear_congruential_engine(IntType const& x0)
: x_(init_seed(x0)) : x_(init_seed(x0))
{} {}
SPROUT_CONSTEXPR result_type min() const { SPROUT_CONSTEXPR result_type min() const {
@ -174,7 +174,7 @@ namespace sprout {
SPROUT_CONSTEXPR rand48() SPROUT_CONSTEXPR rand48()
: lcf_(cnv(static_cast<std::uint32_t>(1))) : lcf_(cnv(static_cast<std::uint32_t>(1)))
{} {}
SPROUT_CONSTEXPR explicit rand48(result_type const& x0) explicit SPROUT_CONSTEXPR rand48(result_type const& x0)
: lcf_(cnv(x0)) : lcf_(cnv(x0))
{} {}
SPROUT_CONSTEXPR result_type min() const { SPROUT_CONSTEXPR result_type min() const {

View file

@ -61,7 +61,7 @@ namespace sprout {
SPROUT_CONSTEXPR linear_feedback_shift_engine() SPROUT_CONSTEXPR linear_feedback_shift_engine()
: x_(init_seed(default_seed)) : x_(init_seed(default_seed))
{} {}
SPROUT_CONSTEXPR explicit linear_feedback_shift_engine(UIntType const& x0) explicit SPROUT_CONSTEXPR linear_feedback_shift_engine(UIntType const& x0)
: x_(init_seed(x0)) : x_(init_seed(x0))
{} {}
SPROUT_CONSTEXPR result_type min() const { SPROUT_CONSTEXPR result_type min() const {

View file

@ -314,7 +314,7 @@ namespace sprout {
: x_(init_seed(default_seed)) : x_(init_seed(default_seed))
, i_(n) , i_(n)
{} {}
SPROUT_CONSTEXPR explicit mersenne_twister_engine(UIntType const& value) explicit SPROUT_CONSTEXPR mersenne_twister_engine(UIntType const& value)
: x_(init_seed(value)) : x_(init_seed(value))
, i_(n) , i_(n)
{} {}

View file

@ -52,7 +52,7 @@ namespace sprout {
: mean_(RealType(0.0)) : mean_(RealType(0.0))
, sigma_(RealType(1.0)) , sigma_(RealType(1.0))
{} {}
SPROUT_CONSTEXPR explicit param_type(RealType mean_arg, RealType sigma_arg = RealType(1.0)) explicit SPROUT_CONSTEXPR param_type(RealType mean_arg, RealType sigma_arg = RealType(1.0))
: mean_(arg_check(mean_arg, sigma_arg)) : mean_(arg_check(mean_arg, sigma_arg))
, sigma_(sigma_arg) , sigma_(sigma_arg)
{} {}
@ -168,7 +168,7 @@ namespace sprout {
, cached_rho_(0) , cached_rho_(0)
, valid_(false) , valid_(false)
{} {}
SPROUT_CONSTEXPR explicit normal_distribution(RealType mean_arg, RealType sigma_arg = RealType(1.0)) explicit SPROUT_CONSTEXPR normal_distribution(RealType mean_arg, RealType sigma_arg = RealType(1.0))
: mean_(arg_check(mean_arg, sigma_arg)) : mean_(arg_check(mean_arg, sigma_arg))
, sigma_(sigma_arg) , sigma_(sigma_arg)
, r1_(0) , r1_(0)
@ -176,7 +176,7 @@ namespace sprout {
, cached_rho_(0) , cached_rho_(0)
, valid_(false) , valid_(false)
{} {}
SPROUT_CONSTEXPR explicit normal_distribution(param_type const& parm) explicit SPROUT_CONSTEXPR normal_distribution(param_type const& parm)
: mean_(parm.mean()) : mean_(parm.mean())
, sigma_(parm.sigma()) , sigma_(parm.sigma())
, r1_(0) , r1_(0)

View file

@ -59,7 +59,7 @@ namespace sprout {
: random_(distribution(engine)) : random_(distribution(engine))
, count_(count) , count_(count)
{} {}
SPROUT_CONSTEXPR explicit random_iterator( explicit SPROUT_CONSTEXPR random_iterator(
random_result_type const& random, random_result_type const& random,
difference_type count = -1 difference_type count = -1
) )
@ -178,7 +178,7 @@ namespace sprout {
: random_(engine()) : random_(engine())
, count_(count) , count_(count)
{} {}
SPROUT_CONSTEXPR explicit random_iterator( explicit SPROUT_CONSTEXPR random_iterator(
random_result_type const& random, random_result_type const& random,
difference_type count = -1 difference_type count = -1
) )

View file

@ -111,10 +111,10 @@ namespace sprout {
SPROUT_CONSTEXPR shuffle_order_engine() SPROUT_CONSTEXPR shuffle_order_engine()
: member_type(init_member(base_type())) : member_type(init_member(base_type()))
{} {}
SPROUT_CONSTEXPR explicit shuffle_order_engine(result_type const& s) explicit SPROUT_CONSTEXPR shuffle_order_engine(result_type const& s)
: member_type(init_member(base_type(s))) : member_type(init_member(base_type(s)))
{} {}
SPROUT_CONSTEXPR explicit shuffle_order_engine(base_type const& rng) explicit SPROUT_CONSTEXPR shuffle_order_engine(base_type const& rng)
: member_type(init_member(rng)) : member_type(init_member(rng))
{} {}
SPROUT_CONSTEXPR result_type min() const { SPROUT_CONSTEXPR result_type min() const {

View file

@ -81,9 +81,9 @@ namespace sprout {
); );
} }
public: public:
SPROUT_CONSTEXPR explicit uniform_01() explicit SPROUT_CONSTEXPR uniform_01()
{} {}
SPROUT_CONSTEXPR explicit uniform_01(param_type const& parm) explicit SPROUT_CONSTEXPR uniform_01(param_type const& parm)
{} {}
SPROUT_CONSTEXPR result_type min() const { SPROUT_CONSTEXPR result_type min() const {
return result_type(0); return result_type(0);

View file

@ -419,7 +419,7 @@ namespace sprout {
: min_(0) : min_(0)
, max_(9) , max_(9)
{} {}
SPROUT_CONSTEXPR explicit param_type(IntType min_arg, IntType max_arg = 9) explicit SPROUT_CONSTEXPR param_type(IntType min_arg, IntType max_arg = 9)
: min_(arg_check(min_arg, max_arg)) : min_(arg_check(min_arg, max_arg))
, max_(max_arg) , max_(max_arg)
{} {}
@ -479,11 +479,11 @@ namespace sprout {
: min_(0) : min_(0)
, max_(9) , max_(9)
{} {}
SPROUT_CONSTEXPR explicit uniform_int_distribution(IntType min_arg, IntType max_arg = 9) explicit SPROUT_CONSTEXPR uniform_int_distribution(IntType min_arg, IntType max_arg = 9)
: min_(arg_check(min_arg, max_arg)) : min_(arg_check(min_arg, max_arg))
, max_(max_arg) , max_(max_arg)
{} {}
SPROUT_CONSTEXPR explicit uniform_int_distribution(param_type const& parm) explicit SPROUT_CONSTEXPR uniform_int_distribution(param_type const& parm)
: min_(parm.a()) : min_(parm.a())
, max_(parm.b()) , max_(parm.b())
{} {}

View file

@ -211,7 +211,7 @@ namespace sprout {
: min_(RealType(0.0)) : min_(RealType(0.0))
, max_(RealType(1.0)) , max_(RealType(1.0))
{} {}
SPROUT_CONSTEXPR explicit param_type(RealType min_arg, RealType max_arg = RealType(1.0)) explicit SPROUT_CONSTEXPR param_type(RealType min_arg, RealType max_arg = RealType(1.0))
: min_(arg_check(min_arg, max_arg)) : min_(arg_check(min_arg, max_arg))
, max_(max_arg) , max_(max_arg)
{} {}
@ -271,11 +271,11 @@ namespace sprout {
: min_(RealType(0.0)) : min_(RealType(0.0))
, max_(RealType(1.0)) , max_(RealType(1.0))
{} {}
SPROUT_CONSTEXPR explicit uniform_real_distribution(RealType min_arg, RealType max_arg = RealType(1.0)) explicit SPROUT_CONSTEXPR uniform_real_distribution(RealType min_arg, RealType max_arg = RealType(1.0))
: min_(arg_check(min_arg, max_arg)) : min_(arg_check(min_arg, max_arg))
, max_(max_arg) , max_(max_arg)
{} {}
SPROUT_CONSTEXPR explicit uniform_real_distribution(param_type const& parm) explicit SPROUT_CONSTEXPR uniform_real_distribution(param_type const& parm)
: min_(parm.a()) : min_(parm.a())
, max_(parm.b()) , max_(parm.b())
{} {}

View file

@ -49,7 +49,7 @@ namespace sprout {
: min_(0) : min_(0)
, max_(9) , max_(9)
{} {}
SPROUT_CONSTEXPR explicit param_type(IntType min_arg, IntType max_arg = 9) explicit SPROUT_CONSTEXPR param_type(IntType min_arg, IntType max_arg = 9)
: min_(arg_check(min_arg, max_arg)) : min_(arg_check(min_arg, max_arg))
, max_(max_arg) , max_(max_arg)
{} {}
@ -206,11 +206,11 @@ namespace sprout {
: min_(0) : min_(0)
, max_(9) , max_(9)
{} {}
SPROUT_CONSTEXPR explicit uniform_smallint(IntType min_arg, IntType max_arg = 9) explicit SPROUT_CONSTEXPR uniform_smallint(IntType min_arg, IntType max_arg = 9)
: min_(arg_check(min_arg, max_arg)) : min_(arg_check(min_arg, max_arg))
, max_(max_arg) , max_(max_arg)
{} {}
SPROUT_CONSTEXPR explicit uniform_smallint(param_type const& parm) explicit SPROUT_CONSTEXPR uniform_smallint(param_type const& parm)
: min_(parm.a()) : min_(parm.a())
, max_(parm.b()) , max_(parm.b())
{} {}

View file

@ -40,7 +40,7 @@ namespace sprout {
: rng1_() : rng1_()
, rng2_() , rng2_()
{} {}
SPROUT_CONSTEXPR explicit xor_combine_engine(result_type const& seed) explicit SPROUT_CONSTEXPR xor_combine_engine(result_type const& seed)
: rng1_(seed) : rng1_(seed)
, rng2_(seed) , rng2_(seed)
{} {}

View file

@ -72,7 +72,7 @@ namespace sprout {
public: public:
tuple_impl() = default; tuple_impl() = default;
template<typename... UTypes> template<typename... UTypes>
SPROUT_CONSTEXPR explicit tuple_impl(UTypes&&... args) SPROUT_NOEXCEPT {} explicit SPROUT_CONSTEXPR tuple_impl(UTypes&&... args) SPROUT_NOEXCEPT {}
SPROUT_CONSTEXPR tuple_impl(tuple_impl const&) = default; SPROUT_CONSTEXPR tuple_impl(tuple_impl const&) = default;
SPROUT_CONSTEXPR tuple_impl(tuple_impl&&) = default; SPROUT_CONSTEXPR tuple_impl(tuple_impl&&) = default;
template<typename... UTypes> template<typename... UTypes>
@ -129,12 +129,12 @@ namespace sprout {
: inherited_type() : inherited_type()
, base_type() , base_type()
{} {}
SPROUT_CONSTEXPR explicit tuple_impl(Head const& h, Tail const&... tail) explicit SPROUT_CONSTEXPR tuple_impl(Head const& h, Tail const&... tail)
: inherited_type(tail...) : inherited_type(tail...)
, base_type(h) , base_type(h)
{} {}
template<typename UHead, typename... UTail> template<typename UHead, typename... UTail>
SPROUT_CONSTEXPR explicit tuple_impl(UHead&& h, UTail&&... tail) explicit SPROUT_CONSTEXPR tuple_impl(UHead&& h, UTail&&... tail)
: inherited_type(sprout::forward<UTail>(tail)...) : inherited_type(sprout::forward<UTail>(tail)...)
, base_type(sprout::forward<UHead>(h)) , base_type(sprout::forward<UHead>(h))
{} {}
@ -248,7 +248,7 @@ namespace sprout {
SPROUT_CONSTEXPR tuple() SPROUT_CONSTEXPR tuple()
: inherited_type() : inherited_type()
{} {}
SPROUT_CONSTEXPR explicit tuple(Types const&... elements) explicit SPROUT_CONSTEXPR tuple(Types const&... elements)
: inherited_type(elements...) : inherited_type(elements...)
{} {}
template< template<
@ -257,7 +257,7 @@ namespace sprout {
!sprout::tuples::is_tuple<typename std::remove_reference<U>::type>::value !sprout::tuples::is_tuple<typename std::remove_reference<U>::type>::value
>::type >::type
> >
SPROUT_CONSTEXPR explicit tuple(U&& elem) explicit SPROUT_CONSTEXPR tuple(U&& elem)
: inherited_type(sprout::forward<U>(elem)) : inherited_type(sprout::forward<U>(elem))
{} {}
template< template<
@ -265,7 +265,7 @@ namespace sprout {
typename U2, typename U2,
typename... UTypes typename... UTypes
> >
SPROUT_CONSTEXPR explicit tuple(U1&& elem1, U2&& elem2, UTypes&&... elements) explicit SPROUT_CONSTEXPR tuple(U1&& elem1, U2&& elem2, UTypes&&... elements)
: inherited_type(sprout::forward<U1>(elem1), sprout::forward<U2>(elem2), sprout::forward<UTypes>(elements)...) : inherited_type(sprout::forward<U1>(elem1), sprout::forward<U2>(elem2), sprout::forward<UTypes>(elements)...)
{} {}
SPROUT_CONSTEXPR tuple(tuple const&) = default; SPROUT_CONSTEXPR tuple(tuple const&) = default;

View file

@ -133,7 +133,7 @@ namespace sprout {
holder_type holder_; holder_type holder_;
public: public:
value_holder() = default; value_holder() = default;
SPROUT_CONSTEXPR explicit value_holder(param_type p) explicit SPROUT_CONSTEXPR value_holder(param_type p)
: holder_(helper_type::hold(p)) : holder_(helper_type::hold(p))
{} {}
operator reference() { operator reference() {

View file

@ -46,7 +46,7 @@ namespace sprout {
SPROUT_CONSTEXPR name_generator() SPROUT_CONSTEXPR name_generator()
: sha_(sprout::sha1().process_range(sprout::uuids::uuid{{0}})) : sha_(sprout::sha1().process_range(sprout::uuids::uuid{{0}}))
{} {}
SPROUT_CONSTEXPR explicit name_generator(sprout::uuids::uuid const& namespace_uuid) explicit SPROUT_CONSTEXPR name_generator(sprout::uuids::uuid const& namespace_uuid)
: sha_(sprout::sha1().process_range(namespace_uuid)) : sha_(sprout::sha1().process_range(namespace_uuid))
{} {}
template<typename Elem, std::size_t N, typename Traits> template<typename Elem, std::size_t N, typename Traits>

View file

@ -19,7 +19,7 @@ namespace sprout {
args_type args_; args_type args_;
public: public:
template<typename... As> template<typename... As>
SPROUT_CONSTEXPR explicit expr(As&&... args) explicit SPROUT_CONSTEXPR expr(As&&... args)
: args_(sprout::forward<As>(args)...) : args_(sprout::forward<As>(args)...)
{} {}
SPROUT_CONSTEXPR args_type const& args() const { SPROUT_CONSTEXPR args_type const& args() const {

View file

@ -35,7 +35,7 @@ namespace sprout {
T t_; T t_;
public: public:
lit_char_p() = default; lit_char_p() = default;
SPROUT_CONSTEXPR explicit lit_char_p(T const& t) explicit SPROUT_CONSTEXPR lit_char_p(T const& t)
: t_(t) : t_(t)
{} {}
template<typename Context, typename Iterator> template<typename Context, typename Iterator>
@ -94,7 +94,7 @@ namespace sprout {
T t_; T t_;
public: public:
char_p() = default; char_p() = default;
SPROUT_CONSTEXPR explicit char_p(T const& t) explicit SPROUT_CONSTEXPR char_p(T const& t)
: t_(t) : t_(t)
{} {}
template<typename Context, typename Iterator> template<typename Context, typename Iterator>

View file

@ -56,7 +56,7 @@ namespace sprout {
} }
public: public:
as_array_p() = default; as_array_p() = default;
SPROUT_CONSTEXPR explicit as_array_p( explicit SPROUT_CONSTEXPR as_array_p(
Parser const& p Parser const& p
) )
: expr_(sprout::weed::make_terminal_or_expr(p)) : expr_(sprout::weed::make_terminal_or_expr(p))

View file

@ -56,7 +56,7 @@ namespace sprout {
} }
public: public:
as_tuple_p() = default; as_tuple_p() = default;
SPROUT_CONSTEXPR explicit as_tuple_p( explicit SPROUT_CONSTEXPR as_tuple_p(
Parser const& p Parser const& p
) )
: expr_(sprout::weed::make_terminal_or_expr(p)) : expr_(sprout::weed::make_terminal_or_expr(p))

View file

@ -51,7 +51,7 @@ namespace sprout {
} }
public: public:
omit_p() = default; omit_p() = default;
SPROUT_CONSTEXPR explicit omit_p( explicit SPROUT_CONSTEXPR omit_p(
Parser const& p Parser const& p
) )
: expr_(sprout::weed::make_terminal_or_expr(p)) : expr_(sprout::weed::make_terminal_or_expr(p))

View file

@ -156,7 +156,7 @@ namespace sprout {
std::size_t count_; std::size_t count_;
public: public:
repeat_p() = default; repeat_p() = default;
SPROUT_CONSTEXPR explicit repeat_p(Parser const& p, std::size_t count = -1) explicit SPROUT_CONSTEXPR repeat_p(Parser const& p, std::size_t count = -1)
: expr_(sprout::weed::make_terminal_or_expr(p)) : expr_(sprout::weed::make_terminal_or_expr(p))
, count_(count) , count_(count)
{} {}
@ -178,7 +178,7 @@ namespace sprout {
private: private:
std::size_t count_; std::size_t count_;
public: public:
SPROUT_CONSTEXPR explicit repeat_g(std::size_t count) explicit SPROUT_CONSTEXPR repeat_g(std::size_t count)
: count_(count) : count_(count)
{} {}
template<typename Parser> template<typename Parser>

View file

@ -41,7 +41,7 @@ namespace sprout {
sprout::weed::limited::category limited_category_; sprout::weed::limited::category limited_category_;
public: public:
limit_p() = default; limit_p() = default;
SPROUT_CONSTEXPR explicit limit_p( explicit SPROUT_CONSTEXPR limit_p(
Parser const& p, Parser const& p,
sprout::weed::limited::category limited_category = sprout::weed::limited::discard sprout::weed::limited::category limited_category = sprout::weed::limited::discard
) )

View file

@ -41,7 +41,7 @@ namespace sprout {
T t_; T t_;
public: public:
lit_str_p() = default; lit_str_p() = default;
SPROUT_CONSTEXPR explicit lit_str_p(T const& t) explicit SPROUT_CONSTEXPR lit_str_p(T const& t)
: t_(t) : t_(t)
{} {}
template<typename Context, typename Iterator> template<typename Context, typename Iterator>
@ -116,7 +116,7 @@ namespace sprout {
T t_; T t_;
public: public:
str_p() = default; str_p() = default;
SPROUT_CONSTEXPR explicit str_p(T const& t) explicit SPROUT_CONSTEXPR str_p(T const& t)
: t_(t) : t_(t)
{} {}
template<typename Context, typename Iterator> template<typename Context, typename Iterator>