mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
add ptr_fun, mem_fun, mem_fun_ref
This commit is contained in:
parent
4a8e938887
commit
f86d17d0d4
46 changed files with 322 additions and 76 deletions
|
@ -127,7 +127,7 @@ namespace sprout {
|
|||
private:
|
||||
sprout::tuples::tuple<Arg> children_;
|
||||
public:
|
||||
SPROUT_CONSTEXPR explicit basic_expr(Arg const& arg)
|
||||
explicit SPROUT_CONSTEXPR basic_expr(Arg const& arg)
|
||||
: children_(arg)
|
||||
{}
|
||||
template<long N>
|
||||
|
@ -174,7 +174,7 @@ namespace sprout {
|
|||
private:
|
||||
sprout::tuples::tuple<Args...> children_;
|
||||
public:
|
||||
SPROUT_CONSTEXPR explicit basic_expr(Args const&... args)
|
||||
explicit SPROUT_CONSTEXPR basic_expr(Args const&... args)
|
||||
: children_(args...)
|
||||
{}
|
||||
template<long N>
|
||||
|
@ -238,7 +238,7 @@ namespace sprout {
|
|||
private:
|
||||
sprout::tuples::tuple<Arg> children_;
|
||||
public:
|
||||
SPROUT_CONSTEXPR explicit expr(Arg const& arg)
|
||||
explicit SPROUT_CONSTEXPR expr(Arg const& arg)
|
||||
: children_(arg)
|
||||
{}
|
||||
template<long N>
|
||||
|
@ -365,7 +365,7 @@ namespace sprout {
|
|||
private:
|
||||
sprout::tuples::tuple<Arg> children_;
|
||||
public:
|
||||
SPROUT_CONSTEXPR explicit basic_expr(Args const&... args)
|
||||
explicit SPROUT_CONSTEXPR basic_expr(Args const&... args)
|
||||
: children_(args...)
|
||||
{}
|
||||
template<long N>
|
||||
|
@ -466,7 +466,7 @@ namespace sprout {
|
|||
public:
|
||||
SPROUT_BREED_UNEXPR();
|
||||
public:
|
||||
SPROUT_CONSTEXPR explicit unexpr(Expr const& e)
|
||||
explicit SPROUT_CONSTEXPR unexpr(Expr const& e)
|
||||
: Expr(e)
|
||||
{}
|
||||
using Expr::operator=;
|
||||
|
|
|
@ -338,10 +338,10 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR compressed_pair(first_param_type x, second_param_type 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)
|
||||
{}
|
||||
SPROUT_CONSTEXPR explicit compressed_pair(second_param_type y)
|
||||
explicit SPROUT_CONSTEXPR compressed_pair(second_param_type y)
|
||||
: base_type(y)
|
||||
{}
|
||||
first_reference first() {
|
||||
|
@ -402,7 +402,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR compressed_pair(first_param_type x, second_param_type 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)
|
||||
{}
|
||||
first_reference first() {
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace sprout {
|
|||
);
|
||||
}
|
||||
public:
|
||||
SPROUT_CONSTEXPR explicit basic_simple_camera(
|
||||
explicit SPROUT_CONSTEXPR basic_simple_camera(
|
||||
unit_type const& far_plane,
|
||||
angle_of_view_reference::values reference_value = angle_of_view_reference::long_side,
|
||||
position_type const& position = position_type(0, 0, -1),
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace sprout {
|
|||
;
|
||||
}
|
||||
public:
|
||||
SPROUT_CONSTEXPR explicit texture_map(
|
||||
explicit SPROUT_CONSTEXPR texture_map(
|
||||
texture_type const& texture,
|
||||
unit_type const& scale = 1,
|
||||
unit_type const& offset_u = 0,
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace sprout {
|
|||
private:
|
||||
result_type elem_;
|
||||
public:
|
||||
SPROUT_CONSTEXPR explicit uniform_element(result_type const& elem)
|
||||
explicit SPROUT_CONSTEXPR uniform_element(result_type const& elem)
|
||||
: elem_(elem)
|
||||
{}
|
||||
template<typename Unit>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <sprout/config.hpp>
|
||||
#include <sprout/functional/base.hpp>
|
||||
#include <sprout/functional/functor.hpp>
|
||||
#include <sprout/functional/adaptor.hpp>
|
||||
#include <sprout/functional/ref.hpp>
|
||||
#include <sprout/functional/mem_fn.hpp>
|
||||
#include <sprout/functional/bind.hpp>
|
||||
|
|
9
sprout/functional/adaptor.hpp
Normal file
9
sprout/functional/adaptor.hpp
Normal 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
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef SPROUT_FUNCTIONAL_BIND1ST_HPP
|
||||
#define SPROUT_FUNCTIONAL_BIND1ST_HPP
|
||||
|
||||
#include <functional>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/functional/base.hpp>
|
||||
|
||||
namespace sprout {
|
||||
// Copyright (C) 2011 RiSK (sscrisk)
|
||||
|
@ -10,7 +10,7 @@ namespace sprout {
|
|||
// D.9.1 Class template binder1st
|
||||
template<typename Fn>
|
||||
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:
|
||||
Fn op;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef SPROUT_FUNCTIONAL_BIND2ND_HPP
|
||||
#define SPROUT_FUNCTIONAL_BIND2ND_HPP
|
||||
|
||||
#include <functional>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/functional/base.hpp>
|
||||
|
||||
namespace sprout {
|
||||
// Copyright (C) 2011 RiSK (sscrisk)
|
||||
|
@ -10,7 +10,7 @@ namespace sprout {
|
|||
// D.9.3 Class template binder2nd
|
||||
template<typename Fn>
|
||||
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:
|
||||
Fn op;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/utility/forward.hpp>
|
||||
#include <sprout/functional/base.hpp>
|
||||
|
||||
namespace sprout {
|
||||
// 20.8.10 member function adaptors
|
||||
|
@ -14,11 +15,11 @@ namespace sprout {
|
|||
struct maybe_unary_or_binary_function {};
|
||||
template<typename Res, typename 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>
|
||||
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>
|
||||
|
|
91
sprout/functional/mem_fun.hpp
Normal file
91
sprout/functional/mem_fun.hpp
Normal 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
|
91
sprout/functional/mem_fun_ref.hpp
Normal file
91
sprout/functional/mem_fun_ref.hpp
Normal 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
|
53
sprout/functional/ptr_fun.hpp
Normal file
53
sprout/functional/ptr_fun.hpp
Normal 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
|
|
@ -78,7 +78,7 @@ namespace sprout {
|
|||
, i_()
|
||||
{}
|
||||
bytes_iterator(bytes_iterator const&) = default;
|
||||
SPROUT_CONSTEXPR explicit bytes_iterator(base_type it)
|
||||
explicit SPROUT_CONSTEXPR bytes_iterator(base_type it)
|
||||
: it_(it)
|
||||
, i_()
|
||||
{}
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace sprout {
|
|||
public:
|
||||
reverse_iterator() = 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)
|
||||
, deref_tmp(sprout::prev(it))
|
||||
{}
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace sprout {
|
|||
, count_()
|
||||
{}
|
||||
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)
|
||||
, count_(count)
|
||||
{}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace sprout {
|
|||
{
|
||||
return sprout::remake<Result>(
|
||||
result,
|
||||
sprout::size(result),
|
||||
size,
|
||||
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
|
||||
? sprout::detail::dft_element_impl(first, last, Indexes - offset, input_size)
|
||||
: *sprout::next(sprout::internal_begin(result), Indexes)
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace sprout {
|
|||
{
|
||||
return sprout::remake<Result>(
|
||||
result,
|
||||
sprout::size(result),
|
||||
size,
|
||||
(Indexes >= offset && Indexes < offset + size && Indexes < offset + input_size
|
||||
? sprout::detail::idft_element_impl(first, last, Indexes - offset, input_size)
|
||||
: *sprout::next(sprout::internal_begin(result), Indexes)
|
||||
|
|
|
@ -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)
|
||||
{}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()))
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()))
|
||||
{}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
{}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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())
|
||||
{}
|
||||
|
|
|
@ -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())
|
||||
{}
|
||||
|
|
|
@ -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())
|
||||
{}
|
||||
|
|
|
@ -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)
|
||||
{}
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace sprout {
|
|||
public:
|
||||
tuple_impl() = default;
|
||||
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&&) = default;
|
||||
template<typename... UTypes>
|
||||
|
@ -129,12 +129,12 @@ namespace sprout {
|
|||
: inherited_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...)
|
||||
, base_type(h)
|
||||
{}
|
||||
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)...)
|
||||
, base_type(sprout::forward<UHead>(h))
|
||||
{}
|
||||
|
@ -248,7 +248,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR tuple()
|
||||
: inherited_type()
|
||||
{}
|
||||
SPROUT_CONSTEXPR explicit tuple(Types const&... elements)
|
||||
explicit SPROUT_CONSTEXPR tuple(Types const&... elements)
|
||||
: inherited_type(elements...)
|
||||
{}
|
||||
template<
|
||||
|
@ -257,7 +257,7 @@ namespace sprout {
|
|||
!sprout::tuples::is_tuple<typename std::remove_reference<U>::type>::value
|
||||
>::type
|
||||
>
|
||||
SPROUT_CONSTEXPR explicit tuple(U&& elem)
|
||||
explicit SPROUT_CONSTEXPR tuple(U&& elem)
|
||||
: inherited_type(sprout::forward<U>(elem))
|
||||
{}
|
||||
template<
|
||||
|
@ -265,7 +265,7 @@ namespace sprout {
|
|||
typename U2,
|
||||
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)...)
|
||||
{}
|
||||
SPROUT_CONSTEXPR tuple(tuple const&) = default;
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace sprout {
|
|||
holder_type holder_;
|
||||
public:
|
||||
value_holder() = default;
|
||||
SPROUT_CONSTEXPR explicit value_holder(param_type p)
|
||||
explicit SPROUT_CONSTEXPR value_holder(param_type p)
|
||||
: holder_(helper_type::hold(p))
|
||||
{}
|
||||
operator reference() {
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR name_generator()
|
||||
: 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))
|
||||
{}
|
||||
template<typename Elem, std::size_t N, typename Traits>
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace sprout {
|
|||
args_type args_;
|
||||
public:
|
||||
template<typename... As>
|
||||
SPROUT_CONSTEXPR explicit expr(As&&... args)
|
||||
explicit SPROUT_CONSTEXPR expr(As&&... args)
|
||||
: args_(sprout::forward<As>(args)...)
|
||||
{}
|
||||
SPROUT_CONSTEXPR args_type const& args() const {
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace sprout {
|
|||
T t_;
|
||||
public:
|
||||
lit_char_p() = default;
|
||||
SPROUT_CONSTEXPR explicit lit_char_p(T const& t)
|
||||
explicit SPROUT_CONSTEXPR lit_char_p(T const& t)
|
||||
: t_(t)
|
||||
{}
|
||||
template<typename Context, typename Iterator>
|
||||
|
@ -94,7 +94,7 @@ namespace sprout {
|
|||
T t_;
|
||||
public:
|
||||
char_p() = default;
|
||||
SPROUT_CONSTEXPR explicit char_p(T const& t)
|
||||
explicit SPROUT_CONSTEXPR char_p(T const& t)
|
||||
: t_(t)
|
||||
{}
|
||||
template<typename Context, typename Iterator>
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace sprout {
|
|||
}
|
||||
public:
|
||||
as_array_p() = default;
|
||||
SPROUT_CONSTEXPR explicit as_array_p(
|
||||
explicit SPROUT_CONSTEXPR as_array_p(
|
||||
Parser const& p
|
||||
)
|
||||
: expr_(sprout::weed::make_terminal_or_expr(p))
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace sprout {
|
|||
}
|
||||
public:
|
||||
as_tuple_p() = default;
|
||||
SPROUT_CONSTEXPR explicit as_tuple_p(
|
||||
explicit SPROUT_CONSTEXPR as_tuple_p(
|
||||
Parser const& p
|
||||
)
|
||||
: expr_(sprout::weed::make_terminal_or_expr(p))
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace sprout {
|
|||
}
|
||||
public:
|
||||
omit_p() = default;
|
||||
SPROUT_CONSTEXPR explicit omit_p(
|
||||
explicit SPROUT_CONSTEXPR omit_p(
|
||||
Parser const& p
|
||||
)
|
||||
: expr_(sprout::weed::make_terminal_or_expr(p))
|
||||
|
|
|
@ -156,7 +156,7 @@ namespace sprout {
|
|||
std::size_t count_;
|
||||
public:
|
||||
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))
|
||||
, count_(count)
|
||||
{}
|
||||
|
@ -178,7 +178,7 @@ namespace sprout {
|
|||
private:
|
||||
std::size_t count_;
|
||||
public:
|
||||
SPROUT_CONSTEXPR explicit repeat_g(std::size_t count)
|
||||
explicit SPROUT_CONSTEXPR repeat_g(std::size_t count)
|
||||
: count_(count)
|
||||
{}
|
||||
template<typename Parser>
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace sprout {
|
|||
sprout::weed::limited::category limited_category_;
|
||||
public:
|
||||
limit_p() = default;
|
||||
SPROUT_CONSTEXPR explicit limit_p(
|
||||
explicit SPROUT_CONSTEXPR limit_p(
|
||||
Parser const& p,
|
||||
sprout::weed::limited::category limited_category = sprout::weed::limited::discard
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace sprout {
|
|||
T t_;
|
||||
public:
|
||||
lit_str_p() = default;
|
||||
SPROUT_CONSTEXPR explicit lit_str_p(T const& t)
|
||||
explicit SPROUT_CONSTEXPR lit_str_p(T const& t)
|
||||
: t_(t)
|
||||
{}
|
||||
template<typename Context, typename Iterator>
|
||||
|
@ -116,7 +116,7 @@ namespace sprout {
|
|||
T t_;
|
||||
public:
|
||||
str_p() = default;
|
||||
SPROUT_CONSTEXPR explicit str_p(T const& t)
|
||||
explicit SPROUT_CONSTEXPR str_p(T const& t)
|
||||
: t_(t)
|
||||
{}
|
||||
template<typename Context, typename Iterator>
|
||||
|
|
Loading…
Reference in a new issue