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

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

View file

@ -43,7 +43,7 @@ namespace sprout {
SPROUT_CONSTEXPR param_type()
: 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))
{}
SPROUT_CONSTEXPR RealType p() const {
@ -98,10 +98,10 @@ namespace sprout {
SPROUT_CONSTEXPR bernoulli_distribution()
: 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))
{}
SPROUT_CONSTEXPR explicit bernoulli_distribution(param_type const& parm)
explicit SPROUT_CONSTEXPR bernoulli_distribution(param_type const& parm)
: p_(parm.p())
{}
SPROUT_CONSTEXPR RealType p() const {

View file

@ -82,7 +82,7 @@ namespace sprout {
: t_(1)
, 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))
, 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())
, 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))
, p_(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())
, 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())
, p_(parm.p())
, m_(init_m(parm.t(), parm.p()))

View file

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

View file

@ -56,7 +56,7 @@ namespace sprout {
SPROUT_CONSTEXPR param_type()
: 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))
{}
SPROUT_CONSTEXPR RealType p() const {
@ -123,11 +123,11 @@ namespace sprout {
: p_(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))
, 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())
, log_1mp_(init_log_1mp(parm.p()))
{}

View file

@ -66,7 +66,7 @@ namespace sprout {
SPROUT_CONSTEXPR inversive_congruential_engine()
: 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))
{}
SPROUT_CONSTEXPR result_type min() const {

View file

@ -70,7 +70,7 @@ namespace sprout {
SPROUT_CONSTEXPR linear_congruential_engine()
: 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))
{}
SPROUT_CONSTEXPR result_type min() const {
@ -174,7 +174,7 @@ namespace sprout {
SPROUT_CONSTEXPR rand48()
: 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))
{}
SPROUT_CONSTEXPR result_type min() const {

View file

@ -61,7 +61,7 @@ namespace sprout {
SPROUT_CONSTEXPR linear_feedback_shift_engine()
: 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))
{}
SPROUT_CONSTEXPR result_type min() const {

View file

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

View file

@ -52,7 +52,7 @@ namespace sprout {
: mean_(RealType(0.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))
, sigma_(sigma_arg)
{}
@ -168,7 +168,7 @@ namespace sprout {
, cached_rho_(0)
, 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))
, sigma_(sigma_arg)
, r1_(0)
@ -176,7 +176,7 @@ namespace sprout {
, cached_rho_(0)
, valid_(false)
{}
SPROUT_CONSTEXPR explicit normal_distribution(param_type const& parm)
explicit SPROUT_CONSTEXPR normal_distribution(param_type const& parm)
: mean_(parm.mean())
, sigma_(parm.sigma())
, r1_(0)

View file

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

View file

@ -111,10 +111,10 @@ namespace sprout {
SPROUT_CONSTEXPR shuffle_order_engine()
: 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)))
{}
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))
{}
SPROUT_CONSTEXPR result_type min() const {

View file

@ -81,9 +81,9 @@ namespace sprout {
);
}
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 {
return result_type(0);

View file

@ -419,7 +419,7 @@ namespace sprout {
: min_(0)
, 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))
, max_(max_arg)
{}
@ -479,11 +479,11 @@ namespace sprout {
: min_(0)
, 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))
, 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())
, max_(parm.b())
{}

View file

@ -211,7 +211,7 @@ namespace sprout {
: min_(RealType(0.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))
, max_(max_arg)
{}
@ -271,11 +271,11 @@ namespace sprout {
: min_(RealType(0.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))
, 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())
, max_(parm.b())
{}

View file

@ -49,7 +49,7 @@ namespace sprout {
: min_(0)
, 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))
, max_(max_arg)
{}
@ -206,11 +206,11 @@ namespace sprout {
: min_(0)
, 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))
, max_(max_arg)
{}
SPROUT_CONSTEXPR explicit uniform_smallint(param_type const& parm)
explicit SPROUT_CONSTEXPR uniform_smallint(param_type const& parm)
: min_(parm.a())
, max_(parm.b())
{}

View file

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