From f86d17d0d4852c6b200de278dccc207a95a34d68 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Wed, 11 Apr 2012 23:28:29 +0900 Subject: [PATCH] add ptr_fun, mem_fun, mem_fun_ref --- sprout/breed/expr.hpp | 10 +-- sprout/compressed_pair.hpp | 6 +- sprout/darkroom/cameras/simple_camera.hpp | 2 +- sprout/darkroom/materials/texture_map.hpp | 2 +- sprout/darkroom/materials/uniform.hpp | 2 +- sprout/functional.hpp | 1 + sprout/functional/adaptor.hpp | 9 ++ sprout/functional/bind1st.hpp | 4 +- sprout/functional/bind2nd.hpp | 4 +- sprout/functional/mem_fn.hpp | 5 +- sprout/functional/mem_fun.hpp | 91 +++++++++++++++++++++ sprout/functional/mem_fun_ref.hpp | 91 +++++++++++++++++++++ sprout/functional/ptr_fun.hpp | 53 ++++++++++++ sprout/iterator/bytes_iterator.hpp | 2 +- sprout/iterator/reverse_iterator.hpp | 2 +- sprout/iterator/value_iterator.hpp | 2 +- sprout/numeric/dft/fixed/dft.hpp | 2 +- sprout/numeric/dft/fixed/idft.hpp | 2 +- sprout/random/additive_combine.hpp | 2 +- sprout/random/bernoulli_distribution.hpp | 6 +- sprout/random/binomial_distribution.hpp | 6 +- sprout/random/detail/uniform_int_float.hpp | 2 +- sprout/random/geometric_distribution.hpp | 6 +- sprout/random/inversive_congruential.hpp | 2 +- sprout/random/linear_congruential.hpp | 4 +- sprout/random/linear_feedback_shift.hpp | 2 +- sprout/random/mersenne_twister.hpp | 2 +- sprout/random/normal_distribution.hpp | 6 +- sprout/random/random_iterator.hpp | 4 +- sprout/random/shuffle_order.hpp | 4 +- sprout/random/uniform_01.hpp | 4 +- sprout/random/uniform_int_distribution.hpp | 6 +- sprout/random/uniform_real_distribution.hpp | 6 +- sprout/random/uniform_smallint.hpp | 6 +- sprout/random/xor_combine.hpp | 2 +- sprout/tuple/tuple.hpp | 12 +-- sprout/utility/value_holder.hpp | 2 +- sprout/uuid/name_generator.hpp | 2 +- sprout/weed/expr/expr.hpp | 2 +- sprout/weed/parser/char/char.hpp | 4 +- sprout/weed/parser/directive/as_array.hpp | 2 +- sprout/weed/parser/directive/as_tuple.hpp | 2 +- sprout/weed/parser/directive/omit.hpp | 2 +- sprout/weed/parser/directive/repeat.hpp | 4 +- sprout/weed/parser/lim.hpp | 2 +- sprout/weed/parser/string/string.hpp | 4 +- 46 files changed, 322 insertions(+), 76 deletions(-) create mode 100644 sprout/functional/adaptor.hpp create mode 100644 sprout/functional/mem_fun.hpp create mode 100644 sprout/functional/mem_fun_ref.hpp create mode 100644 sprout/functional/ptr_fun.hpp diff --git a/sprout/breed/expr.hpp b/sprout/breed/expr.hpp index bc16a627..a536e11f 100644 --- a/sprout/breed/expr.hpp +++ b/sprout/breed/expr.hpp @@ -127,7 +127,7 @@ namespace sprout { private: sprout::tuples::tuple children_; public: - SPROUT_CONSTEXPR explicit basic_expr(Arg const& arg) + explicit SPROUT_CONSTEXPR basic_expr(Arg const& arg) : children_(arg) {} template @@ -174,7 +174,7 @@ namespace sprout { private: sprout::tuples::tuple children_; public: - SPROUT_CONSTEXPR explicit basic_expr(Args const&... args) + explicit SPROUT_CONSTEXPR basic_expr(Args const&... args) : children_(args...) {} template @@ -238,7 +238,7 @@ namespace sprout { private: sprout::tuples::tuple children_; public: - SPROUT_CONSTEXPR explicit expr(Arg const& arg) + explicit SPROUT_CONSTEXPR expr(Arg const& arg) : children_(arg) {} template @@ -365,7 +365,7 @@ namespace sprout { private: sprout::tuples::tuple children_; public: - SPROUT_CONSTEXPR explicit basic_expr(Args const&... args) + explicit SPROUT_CONSTEXPR basic_expr(Args const&... args) : children_(args...) {} template @@ -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=; diff --git a/sprout/compressed_pair.hpp b/sprout/compressed_pair.hpp index c7e78a6e..a9b9a0c6 100644 --- a/sprout/compressed_pair.hpp +++ b/sprout/compressed_pair.hpp @@ -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() { diff --git a/sprout/darkroom/cameras/simple_camera.hpp b/sprout/darkroom/cameras/simple_camera.hpp index 8394fb30..b9809720 100644 --- a/sprout/darkroom/cameras/simple_camera.hpp +++ b/sprout/darkroom/cameras/simple_camera.hpp @@ -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), diff --git a/sprout/darkroom/materials/texture_map.hpp b/sprout/darkroom/materials/texture_map.hpp index 108f7392..86a76f75 100644 --- a/sprout/darkroom/materials/texture_map.hpp +++ b/sprout/darkroom/materials/texture_map.hpp @@ -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, diff --git a/sprout/darkroom/materials/uniform.hpp b/sprout/darkroom/materials/uniform.hpp index b26955c3..9fb83bab 100644 --- a/sprout/darkroom/materials/uniform.hpp +++ b/sprout/darkroom/materials/uniform.hpp @@ -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 diff --git a/sprout/functional.hpp b/sprout/functional.hpp index 9e82781a..e0f8b237 100644 --- a/sprout/functional.hpp +++ b/sprout/functional.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include diff --git a/sprout/functional/adaptor.hpp b/sprout/functional/adaptor.hpp new file mode 100644 index 00000000..d7f4e994 --- /dev/null +++ b/sprout/functional/adaptor.hpp @@ -0,0 +1,9 @@ +#ifndef SPROUT_FUNCTIONAL_ADAPTOR_HPP +#define SPROUT_FUNCTIONAL_ADAPTOR_HPP + +#include +#include +#include +#include + +#endif // #ifndef SPROUT_FUNCTIONAL_ADAPTOR_HPP diff --git a/sprout/functional/bind1st.hpp b/sprout/functional/bind1st.hpp index e75f9689..2669743a 100644 --- a/sprout/functional/bind1st.hpp +++ b/sprout/functional/bind1st.hpp @@ -1,8 +1,8 @@ #ifndef SPROUT_FUNCTIONAL_BIND1ST_HPP #define SPROUT_FUNCTIONAL_BIND1ST_HPP -#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) @@ -10,7 +10,7 @@ namespace sprout { // D.9.1 Class template binder1st template class binder1st - : public std::unary_function + : public sprout::unary_function { protected: Fn op; diff --git a/sprout/functional/bind2nd.hpp b/sprout/functional/bind2nd.hpp index f5b31200..6f9c29ce 100644 --- a/sprout/functional/bind2nd.hpp +++ b/sprout/functional/bind2nd.hpp @@ -1,8 +1,8 @@ #ifndef SPROUT_FUNCTIONAL_BIND2ND_HPP #define SPROUT_FUNCTIONAL_BIND2ND_HPP -#include #include +#include namespace sprout { // Copyright (C) 2011 RiSK (sscrisk) @@ -10,7 +10,7 @@ namespace sprout { // D.9.3 Class template binder2nd template class binder2nd - : public std::unary_function + : public sprout::unary_function { protected: Fn op; diff --git a/sprout/functional/mem_fn.hpp b/sprout/functional/mem_fn.hpp index 08cb9cff..6c22d430 100644 --- a/sprout/functional/mem_fn.hpp +++ b/sprout/functional/mem_fn.hpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace sprout { // 20.8.10 member function adaptors @@ -14,11 +15,11 @@ namespace sprout { struct maybe_unary_or_binary_function {}; template struct maybe_unary_or_binary_function - : public std::unary_function + : public sprout::unary_function {}; template struct maybe_unary_or_binary_function - : public std::binary_function + : public sprout::binary_function {}; template diff --git a/sprout/functional/mem_fun.hpp b/sprout/functional/mem_fun.hpp new file mode 100644 index 00000000..9c0be29d --- /dev/null +++ b/sprout/functional/mem_fun.hpp @@ -0,0 +1,91 @@ +#ifndef SPROUT_FUNCTIONAL_MEM_FUN_HPP +#define SPROUT_FUNCTIONAL_MEM_FUN_HPP + +#include +#include + +namespace sprout { + // D.8.2.2 adaptors (deprecated) + + template + class mem_fun_t + : public sprout::unary_function + { + 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 + class const_mem_fun_t + : public sprout::unary_function + { + 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 + class mem_fun1_t + : public sprout::binary_function + { + 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 + class const_mem_fun1_t + : public sprout::binary_function + { + 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 + inline SPROUT_CONSTEXPR sprout::mem_fun_t mem_fun(Ret (T::*f)()) { + return sprout::mem_fun_t(f); + } + + template + inline SPROUT_CONSTEXPR sprout::const_mem_fun_t mem_fun(Ret (T::*f)() const) { + return sprout::const_mem_fun_t(f); + } + + template + inline SPROUT_CONSTEXPR sprout::mem_fun1_t mem_fun(Ret (T::*f)(Arg)) { + return sprout::mem_fun1_t(f); + } + + template + inline SPROUT_CONSTEXPR sprout::const_mem_fun1_t mem_fun(Ret (T::*f)(Arg) const) { + return sprout::const_mem_fun1_t(f); + } +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_MEM_FUN_HPP diff --git a/sprout/functional/mem_fun_ref.hpp b/sprout/functional/mem_fun_ref.hpp new file mode 100644 index 00000000..35d2524e --- /dev/null +++ b/sprout/functional/mem_fun_ref.hpp @@ -0,0 +1,91 @@ +#ifndef SPROUT_FUNCTIONAL_MEM_FUN_REF_HPP +#define SPROUT_FUNCTIONAL_MEM_FUN_REF_HPP + +#include +#include + +namespace sprout { + // D.8.2.2 adaptors (deprecated) + + template + class mem_fun_ref_t + : public sprout::unary_function + { + 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 + class const_mem_fun_ref_t + : public sprout::unary_function + { + 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 + class mem_fun1_ref_t + : public sprout::binary_function + { + 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 + class const_mem_fun1_ref_t + : public sprout::binary_function + { + 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 + inline SPROUT_CONSTEXPR sprout::mem_fun_ref_t mem_fun_ref(Ret (T::*f)()) { + return sprout::mem_fun_ref_t(f); + } + + template + inline SPROUT_CONSTEXPR sprout::const_mem_fun_ref_t mem_fun_ref(Ret (T::*f)() const) { + return sprout::const_mem_fun_ref_t(f); + } + + template + inline SPROUT_CONSTEXPR sprout::mem_fun1_ref_t mem_fun_ref(Ret (T::*f)(Arg)) { + return sprout::mem_fun1_ref_t(f); + } + + template + inline SPROUT_CONSTEXPR sprout::const_mem_fun1_ref_t mem_fun_ref(Ret (T::*f)(Arg) const) { + return sprout::const_mem_fun1_ref_t(f); + } +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_MEM_FUN_REF_HPP diff --git a/sprout/functional/ptr_fun.hpp b/sprout/functional/ptr_fun.hpp new file mode 100644 index 00000000..19415b39 --- /dev/null +++ b/sprout/functional/ptr_fun.hpp @@ -0,0 +1,53 @@ +#ifndef SPROUT_FUNCTIONAL_PTR_FUN_HPP +#define SPROUT_FUNCTIONAL_PTR_FUN_HPP + +#include +#include + +namespace sprout { + // D.8.2.1 adaptors (deprecated) + + template + class pointer_to_unary_function + : public sprout::unary_function + { + 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 + inline SPROUT_CONSTEXPR sprout::pointer_to_unary_function ptr_fun(Result (*x)(Arg)) { + return sprout::pointer_to_unary_function(x); + } + + template + class pointer_to_binary_function + : public sprout::binary_function + { + 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 + inline SPROUT_CONSTEXPR sprout::pointer_to_binary_function ptr_fun(Result (*x)(Arg1, Arg2)) { + return sprout::pointer_to_binary_function(x); + } +} // namespace sprout + +#endif // #ifndef SPROUT_FUNCTIONAL_PTR_FUN_HPP diff --git a/sprout/iterator/bytes_iterator.hpp b/sprout/iterator/bytes_iterator.hpp index c7997675..0db1ab43 100644 --- a/sprout/iterator/bytes_iterator.hpp +++ b/sprout/iterator/bytes_iterator.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_() {} diff --git a/sprout/iterator/reverse_iterator.hpp b/sprout/iterator/reverse_iterator.hpp index ce61d190..8de21231 100644 --- a/sprout/iterator/reverse_iterator.hpp +++ b/sprout/iterator/reverse_iterator.hpp @@ -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)) {} diff --git a/sprout/iterator/value_iterator.hpp b/sprout/iterator/value_iterator.hpp index f93ec01e..7ac767d0 100644 --- a/sprout/iterator/value_iterator.hpp +++ b/sprout/iterator/value_iterator.hpp @@ -61,7 +61,7 @@ namespace sprout { , count_() {} value_iterator(value_iterator const&) = default; - SPROUT_CONSTEXPR explicit value_iterator(typename sprout::value_holder::param_type p, std::size_t count = -1) + explicit SPROUT_CONSTEXPR value_iterator(typename sprout::value_holder::param_type p, std::size_t count = -1) : holder_(p) , count_(count) {} diff --git a/sprout/numeric/dft/fixed/dft.hpp b/sprout/numeric/dft/fixed/dft.hpp index 94161e17..ae667357 100644 --- a/sprout/numeric/dft/fixed/dft.hpp +++ b/sprout/numeric/dft/fixed/dft.hpp @@ -26,7 +26,7 @@ namespace sprout { { return sprout::remake( 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) diff --git a/sprout/numeric/dft/fixed/idft.hpp b/sprout/numeric/dft/fixed/idft.hpp index 45aebd62..a5cc4933 100644 --- a/sprout/numeric/dft/fixed/idft.hpp +++ b/sprout/numeric/dft/fixed/idft.hpp @@ -26,7 +26,7 @@ namespace sprout { { return sprout::remake( 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) diff --git a/sprout/random/additive_combine.hpp b/sprout/random/additive_combine.hpp index 8db8a8f5..f17b0324 100644 --- a/sprout/random/additive_combine.hpp +++ b/sprout/random/additive_combine.hpp @@ -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) {} diff --git a/sprout/random/bernoulli_distribution.hpp b/sprout/random/bernoulli_distribution.hpp index 051feba0..a082d57e 100644 --- a/sprout/random/bernoulli_distribution.hpp +++ b/sprout/random/bernoulli_distribution.hpp @@ -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 { diff --git a/sprout/random/binomial_distribution.hpp b/sprout/random/binomial_distribution.hpp index e5843bc5..f4108447 100644 --- a/sprout/random/binomial_distribution.hpp +++ b/sprout/random/binomial_distribution.hpp @@ -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())) diff --git a/sprout/random/detail/uniform_int_float.hpp b/sprout/random/detail/uniform_int_float.hpp index 5b0b9a9d..6670ff51 100644 --- a/sprout/random/detail/uniform_int_float.hpp +++ b/sprout/random/detail/uniform_int_float.hpp @@ -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 { diff --git a/sprout/random/geometric_distribution.hpp b/sprout/random/geometric_distribution.hpp index 39951fdf..1a8d9c05 100644 --- a/sprout/random/geometric_distribution.hpp +++ b/sprout/random/geometric_distribution.hpp @@ -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())) {} diff --git a/sprout/random/inversive_congruential.hpp b/sprout/random/inversive_congruential.hpp index 380dd774..43487e3f 100644 --- a/sprout/random/inversive_congruential.hpp +++ b/sprout/random/inversive_congruential.hpp @@ -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 { diff --git a/sprout/random/linear_congruential.hpp b/sprout/random/linear_congruential.hpp index e51804c1..7a43e46a 100644 --- a/sprout/random/linear_congruential.hpp +++ b/sprout/random/linear_congruential.hpp @@ -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(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 { diff --git a/sprout/random/linear_feedback_shift.hpp b/sprout/random/linear_feedback_shift.hpp index 962202ef..bd8c29be 100644 --- a/sprout/random/linear_feedback_shift.hpp +++ b/sprout/random/linear_feedback_shift.hpp @@ -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 { diff --git a/sprout/random/mersenne_twister.hpp b/sprout/random/mersenne_twister.hpp index ef31f85a..221954f5 100644 --- a/sprout/random/mersenne_twister.hpp +++ b/sprout/random/mersenne_twister.hpp @@ -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) {} diff --git a/sprout/random/normal_distribution.hpp b/sprout/random/normal_distribution.hpp index 03569d34..0b6bb94c 100644 --- a/sprout/random/normal_distribution.hpp +++ b/sprout/random/normal_distribution.hpp @@ -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) diff --git a/sprout/random/random_iterator.hpp b/sprout/random/random_iterator.hpp index 481ba65b..88c010ab 100644 --- a/sprout/random/random_iterator.hpp +++ b/sprout/random/random_iterator.hpp @@ -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 ) diff --git a/sprout/random/shuffle_order.hpp b/sprout/random/shuffle_order.hpp index 373b9433..46f0c6e2 100644 --- a/sprout/random/shuffle_order.hpp +++ b/sprout/random/shuffle_order.hpp @@ -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 { diff --git a/sprout/random/uniform_01.hpp b/sprout/random/uniform_01.hpp index 52248e5a..a43447bd 100644 --- a/sprout/random/uniform_01.hpp +++ b/sprout/random/uniform_01.hpp @@ -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); diff --git a/sprout/random/uniform_int_distribution.hpp b/sprout/random/uniform_int_distribution.hpp index 737b58d0..0969c571 100644 --- a/sprout/random/uniform_int_distribution.hpp +++ b/sprout/random/uniform_int_distribution.hpp @@ -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()) {} diff --git a/sprout/random/uniform_real_distribution.hpp b/sprout/random/uniform_real_distribution.hpp index 37c151ec..35e1e95d 100644 --- a/sprout/random/uniform_real_distribution.hpp +++ b/sprout/random/uniform_real_distribution.hpp @@ -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()) {} diff --git a/sprout/random/uniform_smallint.hpp b/sprout/random/uniform_smallint.hpp index 7035730a..18db9f36 100644 --- a/sprout/random/uniform_smallint.hpp +++ b/sprout/random/uniform_smallint.hpp @@ -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()) {} diff --git a/sprout/random/xor_combine.hpp b/sprout/random/xor_combine.hpp index 961f8147..35d555fe 100644 --- a/sprout/random/xor_combine.hpp +++ b/sprout/random/xor_combine.hpp @@ -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) {} diff --git a/sprout/tuple/tuple.hpp b/sprout/tuple/tuple.hpp index d1dcf5e4..96707306 100644 --- a/sprout/tuple/tuple.hpp +++ b/sprout/tuple/tuple.hpp @@ -72,7 +72,7 @@ namespace sprout { public: tuple_impl() = default; template - 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 @@ -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 - SPROUT_CONSTEXPR explicit tuple_impl(UHead&& h, UTail&&... tail) + explicit SPROUT_CONSTEXPR tuple_impl(UHead&& h, UTail&&... tail) : inherited_type(sprout::forward(tail)...) , base_type(sprout::forward(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::type>::value >::type > - SPROUT_CONSTEXPR explicit tuple(U&& elem) + explicit SPROUT_CONSTEXPR tuple(U&& elem) : inherited_type(sprout::forward(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(elem1), sprout::forward(elem2), sprout::forward(elements)...) {} SPROUT_CONSTEXPR tuple(tuple const&) = default; diff --git a/sprout/utility/value_holder.hpp b/sprout/utility/value_holder.hpp index 4b9a526b..ce2c9f21 100644 --- a/sprout/utility/value_holder.hpp +++ b/sprout/utility/value_holder.hpp @@ -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() { diff --git a/sprout/uuid/name_generator.hpp b/sprout/uuid/name_generator.hpp index 58e49695..6fdfb6a0 100644 --- a/sprout/uuid/name_generator.hpp +++ b/sprout/uuid/name_generator.hpp @@ -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 diff --git a/sprout/weed/expr/expr.hpp b/sprout/weed/expr/expr.hpp index 8a216fd1..2584038c 100644 --- a/sprout/weed/expr/expr.hpp +++ b/sprout/weed/expr/expr.hpp @@ -19,7 +19,7 @@ namespace sprout { args_type args_; public: template - SPROUT_CONSTEXPR explicit expr(As&&... args) + explicit SPROUT_CONSTEXPR expr(As&&... args) : args_(sprout::forward(args)...) {} SPROUT_CONSTEXPR args_type const& args() const { diff --git a/sprout/weed/parser/char/char.hpp b/sprout/weed/parser/char/char.hpp index 91b5ac84..eae24cec 100644 --- a/sprout/weed/parser/char/char.hpp +++ b/sprout/weed/parser/char/char.hpp @@ -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 @@ -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 diff --git a/sprout/weed/parser/directive/as_array.hpp b/sprout/weed/parser/directive/as_array.hpp index 7294f37a..7ddc1e95 100644 --- a/sprout/weed/parser/directive/as_array.hpp +++ b/sprout/weed/parser/directive/as_array.hpp @@ -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)) diff --git a/sprout/weed/parser/directive/as_tuple.hpp b/sprout/weed/parser/directive/as_tuple.hpp index 9e82362b..7c610350 100644 --- a/sprout/weed/parser/directive/as_tuple.hpp +++ b/sprout/weed/parser/directive/as_tuple.hpp @@ -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)) diff --git a/sprout/weed/parser/directive/omit.hpp b/sprout/weed/parser/directive/omit.hpp index 8e45e7fa..945f273c 100644 --- a/sprout/weed/parser/directive/omit.hpp +++ b/sprout/weed/parser/directive/omit.hpp @@ -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)) diff --git a/sprout/weed/parser/directive/repeat.hpp b/sprout/weed/parser/directive/repeat.hpp index e2875096..94a89649 100644 --- a/sprout/weed/parser/directive/repeat.hpp +++ b/sprout/weed/parser/directive/repeat.hpp @@ -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 diff --git a/sprout/weed/parser/lim.hpp b/sprout/weed/parser/lim.hpp index 8e8b1dd0..f2b08158 100644 --- a/sprout/weed/parser/lim.hpp +++ b/sprout/weed/parser/lim.hpp @@ -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 ) diff --git a/sprout/weed/parser/string/string.hpp b/sprout/weed/parser/string/string.hpp index 52343fc8..27e9d0a1 100644 --- a/sprout/weed/parser/string/string.hpp +++ b/sprout/weed/parser/string/string.hpp @@ -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 @@ -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