diff --git a/sprout/breed/detail/deduce_domain.hpp b/sprout/breed/detail/deduce_domain.hpp index f10b9a38..431b32ae 100644 --- a/sprout/breed/detail/deduce_domain.hpp +++ b/sprout/breed/detail/deduce_domain.hpp @@ -215,7 +215,7 @@ namespace sprout { template struct deduce_domain : public sprout::breed::detail::deduce_domain_impl< - typename sprout::make_index_tuple::type, + typename sprout::index_pack::type, Args... > {}; diff --git a/sprout/breed/generate.hpp b/sprout/breed/generate.hpp index 48b246c3..d640a497 100644 --- a/sprout/breed/generate.hpp +++ b/sprout/breed/generate.hpp @@ -55,7 +55,7 @@ namespace sprout { } public: static SPROUT_CONSTEXPR type call(src_type const& e) { - return call_impl(sprout::make_index_tuple::make()); + return call_impl(sprout::index_pack::make()); } }; template @@ -74,7 +74,7 @@ namespace sprout { } public: static SPROUT_CONSTEXPR type call(src_type const& e) { - return call_impl(sprout::make_index_tuple::make()); + return call_impl(sprout::index_pack::make()); } }; } // namespace detail diff --git a/sprout/darkroom/lights/light_list.hpp b/sprout/darkroom/lights/light_list.hpp index 56650be1..ffeda36f 100644 --- a/sprout/darkroom/lights/light_list.hpp +++ b/sprout/darkroom/lights/light_list.hpp @@ -51,7 +51,7 @@ namespace sprout { template SPROUT_CONSTEXPR color_type operator()(Intersection const& inter, Objects const& objs) const { - return shade_1(inter, objs, sprout::make_index_tuple::make()); + return shade_1(inter, objs, sprout::index_pack::make()); } }; // diff --git a/sprout/functional/bind/bind.hpp b/sprout/functional/bind/bind.hpp index f42fba66..cf620dd5 100644 --- a/sprout/functional/bind/bind.hpp +++ b/sprout/functional/bind/bind.hpp @@ -181,7 +181,7 @@ namespace sprout { SPROUT_CONSTEXPR auto operator()(CVArg& arg, sprout::tuples::tuple& tuple) const volatile -> decltype(arg(std::declval()...)) { - return call(arg, tuple, sprout::make_index_tuple::make()); + return call(arg, tuple, sprout::index_pack::make()); } }; template @@ -277,7 +277,7 @@ namespace sprout { { private: typedef binder self_type; - typedef typename sprout::make_index_tuple::type bound_indexes; + typedef typename sprout::index_pack::type bound_indexes; private: Functor f_; sprout::tuples::tuple bound_args_; @@ -385,7 +385,7 @@ namespace sprout { class bind_result { private: typedef bind_result self_type; - typedef typename sprout::make_index_tuple::type bound_indexes; + typedef typename sprout::index_pack::type bound_indexes; private: template struct enable_if_void diff --git a/sprout/index_tuple/class.hpp b/sprout/index_tuple/class.hpp index b846f6a2..f2eeaf75 100644 --- a/sprout/index_tuple/class.hpp +++ b/sprout/index_tuple/class.hpp @@ -2,7 +2,8 @@ #define SPROUT_INDEX_TUPLE_CLASS_HPP #include -#include +#include #include +#include #endif // #ifndef SPROUT_INDEX_TUPLE_CLASS_HPP diff --git a/sprout/index_tuple/index_n.hpp b/sprout/index_tuple/index_n.hpp index ea8fc2fa..996e637f 100644 --- a/sprout/index_tuple/index_n.hpp +++ b/sprout/index_tuple/index_n.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include diff --git a/sprout/index_tuple/index_pack.hpp b/sprout/index_tuple/index_pack.hpp new file mode 100644 index 00000000..95200870 --- /dev/null +++ b/sprout/index_tuple/index_pack.hpp @@ -0,0 +1,32 @@ +#ifndef SPROUT_INDEX_TUPLE_INDEX_PACK_HPP +#define SPROUT_INDEX_TUPLE_INDEX_PACK_HPP + +#include +#include +#include +#include + +namespace sprout { + // + // index_pack + // + template + struct index_pack + : public sprout::enable_make_indexes< + typename sprout::integer_pack::type + ::template transfer > + > + {}; + // + // uindex_pack + // + template + struct uindex_pack + : public sprout::enable_make_indexes< + typename sprout::integer_pack::type + ::template transfer > + > + {}; +} // namespace sprout + +#endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_PACK_HPP diff --git a/sprout/index_tuple/index_sequence.hpp b/sprout/index_tuple/index_sequence.hpp new file mode 100644 index 00000000..59f8f169 --- /dev/null +++ b/sprout/index_tuple/index_sequence.hpp @@ -0,0 +1,19 @@ +#ifndef SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_HPP +#define SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_HPP + +#include +#if SPROUT_USE_TEMPLATE_ALIASES +# include +#endif // #if SPROUT_USE_TEMPLATE_ALIASES + +namespace sprout { +#if SPROUT_USE_TEMPLATE_ALIASES + // + // index_sequence + // + template + using index_sequence = sprout::uindex_tuple; +#endif // #if SPROUT_USE_TEMPLATE_ALIASES +} // namespace sprout + +#endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_HPP diff --git a/sprout/index_tuple/index_sequence_for.hpp b/sprout/index_tuple/index_sequence_for.hpp new file mode 100644 index 00000000..9020caa3 --- /dev/null +++ b/sprout/index_tuple/index_sequence_for.hpp @@ -0,0 +1,17 @@ +#ifndef SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_FOR_HPP +#define SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_FOR_HPP + +#include +#include + +namespace sprout { + // + // index_sequence_for + // + template + struct index_sequence_for + : public sprout::uindex_pack + {}; +} // namespace sprout + +#endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_FOR_HPP diff --git a/sprout/index_tuple/index_tuple.hpp b/sprout/index_tuple/index_tuple.hpp index 6590f904..2a9a6383 100644 --- a/sprout/index_tuple/index_tuple.hpp +++ b/sprout/index_tuple/index_tuple.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include namespace sprout { // @@ -13,7 +13,7 @@ namespace sprout { typedef std::ptrdiff_t index_t; template struct index_tuple - : public sprout::integer_seq + : public sprout::integer_sequence { public: typedef index_tuple type; @@ -30,7 +30,7 @@ namespace sprout { typedef std::size_t uindex_t; template struct uindex_tuple - : public sprout::integer_seq + : public sprout::integer_sequence { public: typedef uindex_tuple type; diff --git a/sprout/index_tuple/integer_n.hpp b/sprout/index_tuple/integer_n.hpp index 783af0ca..014d5e85 100644 --- a/sprout/index_tuple/integer_n.hpp +++ b/sprout/index_tuple/integer_n.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include namespace sprout { @@ -15,15 +15,15 @@ namespace sprout { template struct integer_n_next_even; template - struct integer_n_next_even > - : public sprout::integer_seq + struct integer_n_next_even > + : public sprout::integer_sequence {}; template struct integer_n_next_even_odd; template - struct integer_n_next_even_odd, Tail> - : public sprout::integer_seq + struct integer_n_next_even_odd, Tail> + : public sprout::integer_sequence {}; template @@ -33,14 +33,14 @@ namespace sprout { T, I, N, typename std::enable_if<(N == 0)>::type > - : public sprout::integer_seq + : public sprout::integer_sequence {}; template struct integer_n_impl< T, I, N, typename std::enable_if<(N == 1)>::type > - : public sprout::integer_seq + : public sprout::integer_sequence {}; template struct integer_n_impl< diff --git a/sprout/index_tuple/integer_pack.hpp b/sprout/index_tuple/integer_pack.hpp new file mode 100644 index 00000000..44dd495d --- /dev/null +++ b/sprout/index_tuple/integer_pack.hpp @@ -0,0 +1,17 @@ +#ifndef SPROUT_INDEX_TUPLE_INTEGER_PACK_HPP +#define SPROUT_INDEX_TUPLE_INTEGER_PACK_HPP + +#include +#include + +namespace sprout { + // + // integer_pack + // + template + struct integer_pack + : public sprout::make_integer_sequence + {}; +} // namespace sprout + +#endif // #ifndef SPROUT_INDEX_TUPLE_INTEGER_PACK_HPP diff --git a/sprout/index_tuple/integer_range.hpp b/sprout/index_tuple/integer_range.hpp index 42fcb34c..2d035761 100644 --- a/sprout/index_tuple/integer_range.hpp +++ b/sprout/index_tuple/integer_range.hpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include namespace sprout { @@ -18,15 +18,15 @@ namespace sprout { template struct integer_range_next_even; template - struct integer_range_next_even, Next> - : public sprout::integer_seq + struct integer_range_next_even, Next> + : public sprout::integer_sequence {}; template struct integer_range_next_odd; template - struct integer_range_next_odd, Next, Tail> - : public sprout::integer_seq + struct integer_range_next_odd, Next, Tail> + : public sprout::integer_sequence {}; template::type Step, typename std::make_unsigned::type N, typename Enable = void> @@ -36,14 +36,14 @@ namespace sprout { T, First, Step, N, typename std::enable_if<(N == 0)>::type > - : public sprout::integer_seq + : public sprout::integer_sequence {}; template::type Step, typename std::make_unsigned::type N> struct integer_range_impl< T, First, Step, N, typename std::enable_if<(N == 1)>::type > - : public sprout::integer_seq + : public sprout::integer_sequence {}; template::type Step, typename std::make_unsigned::type N> struct integer_range_impl< diff --git a/sprout/index_tuple/integer_seq.hpp b/sprout/index_tuple/integer_seq.hpp deleted file mode 100644 index 002843f8..00000000 --- a/sprout/index_tuple/integer_seq.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef SPROUT_INDEX_TUPLE_INTEGER_SEQ_HPP -#define SPROUT_INDEX_TUPLE_INTEGER_SEQ_HPP - -#include -#include - -namespace sprout { - // - // integer_seq - // - template - struct integer_seq { - public: - typedef integer_seq type; - template - struct rebind - : public integer_seq - {}; - public: - typedef T value_type; - template - struct transfer - : public Seq::template rebind - {}; - public: - SPROUT_STATIC_CONSTEXPR std::size_t size = sizeof...(Is); - }; - template - SPROUT_CONSTEXPR_OR_CONST std::size_t sprout::integer_seq::size; -} // namespace sprout - -#endif // #ifndef SPROUT_INDEX_TUPLE_INTEGER_SEQ_HPP diff --git a/sprout/index_tuple/integer_sequence.hpp b/sprout/index_tuple/integer_sequence.hpp new file mode 100644 index 00000000..f2c65a51 --- /dev/null +++ b/sprout/index_tuple/integer_sequence.hpp @@ -0,0 +1,36 @@ +#ifndef SPROUT_INDEX_TUPLE_INTEGER_SEQUENCE_HPP +#define SPROUT_INDEX_TUPLE_INTEGER_SEQUENCE_HPP + +#include +#include + +namespace sprout { + // + // integer_sequence + // + template + struct integer_sequence { + public: + typedef integer_sequence type; + template + struct rebind + : public integer_sequence + {}; + public: + typedef T value_type; + template + struct transfer + : public Seq::template rebind + {}; + public: + SPROUT_STATIC_CONSTEXPR std::size_t static_size = sizeof...(Is); + public: + static SPROUT_CONSTEXPR size_t size() noexcept { + return static_size; + } + }; + template + SPROUT_CONSTEXPR_OR_CONST std::size_t sprout::integer_sequence::static_size; +} // namespace sprout + +#endif // #ifndef SPROUT_INDEX_TUPLE_INTEGER_SEQUENCE_HPP diff --git a/sprout/index_tuple/make_index_sequence.hpp b/sprout/index_tuple/make_index_sequence.hpp new file mode 100644 index 00000000..6267e1f3 --- /dev/null +++ b/sprout/index_tuple/make_index_sequence.hpp @@ -0,0 +1,18 @@ +#ifndef SPROUT_INDEX_TUPLE_MAKE_INDEX_SEQUENCE_HPP +#define SPROUT_INDEX_TUPLE_MAKE_INDEX_SEQUENCE_HPP + +#include +#include +#include + +namespace sprout { + // + // make_index_sequence + // + template + struct make_index_sequence + : public sprout::make_uindex_tuple + {}; +} // namespace sprout + +#endif // #ifndef SPROUT_INDEX_TUPLE_MAKE_INDEX_SEQUENCE_HPP diff --git a/sprout/index_tuple/make_index_tuple.hpp b/sprout/index_tuple/make_index_tuple.hpp index 28e0d4a2..3a860cb2 100644 --- a/sprout/index_tuple/make_index_tuple.hpp +++ b/sprout/index_tuple/make_index_tuple.hpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include namespace sprout { @@ -14,7 +14,7 @@ namespace sprout { template struct make_index_tuple : public sprout::enable_make_indexes< - typename sprout::make_integer_seq::type + typename sprout::make_integer_sequence::type ::template transfer >::type > {}; @@ -24,7 +24,7 @@ namespace sprout { template struct make_uindex_tuple : public sprout::enable_make_indexes< - typename sprout::make_integer_seq::type + typename sprout::make_integer_sequence::type ::template transfer >::type > {}; diff --git a/sprout/index_tuple/make_integer_seq.hpp b/sprout/index_tuple/make_integer_sequence.hpp similarity index 54% rename from sprout/index_tuple/make_integer_seq.hpp rename to sprout/index_tuple/make_integer_sequence.hpp index cb1cbd88..cc85b227 100644 --- a/sprout/index_tuple/make_integer_seq.hpp +++ b/sprout/index_tuple/make_integer_sequence.hpp @@ -1,5 +1,5 @@ -#ifndef SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQ_HPP -#define SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQ_HPP +#ifndef SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQUENCE_HPP +#define SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQUENCE_HPP #include #include @@ -7,14 +7,14 @@ namespace sprout { // - // make_integer_seq + // make_integer_sequence // template - struct make_integer_seq + struct make_integer_sequence : public sprout::enable_make_indexes< sprout::integer_range > {}; } // namespace sprout -#endif // #ifndef SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQ_HPP +#endif // #ifndef SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQUENCE_HPP diff --git a/sprout/index_tuple/metafunction.hpp b/sprout/index_tuple/metafunction.hpp index 02eaaea0..f4043446 100644 --- a/sprout/index_tuple/metafunction.hpp +++ b/sprout/index_tuple/metafunction.hpp @@ -2,11 +2,15 @@ #define SPROUT_INDEX_TUPLE_METAFUNCTION_HPP #include -#include +#include #include +#include +#include #include #include #include #include +#include +#include #endif // #ifndef SPROUT_INDEX_TUPLE_METAFUNCTION_HPP diff --git a/sprout/index_tuple/tuple.hpp b/sprout/index_tuple/tuple.hpp index b3117956..0308959a 100644 --- a/sprout/index_tuple/tuple.hpp +++ b/sprout/index_tuple/tuple.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include @@ -18,14 +18,14 @@ namespace std { // tuple_size // template - struct tuple_size > + struct tuple_size > : public std::integral_constant {}; // // tuple_element // template - struct tuple_element > { + struct tuple_element > { static_assert(I < sizeof...(Is), "tuple_element<>: index out of range"); public: typedef typename sprout::tppack_c_at::type type; @@ -36,14 +36,14 @@ namespace std { // template struct tuple_size > - : public std::tuple_size > + : public std::tuple_size > {}; // // tuple_element // template struct tuple_element > - : public std::tuple_element > + : public std::tuple_element > {}; // @@ -51,14 +51,14 @@ namespace std { // template struct tuple_size > - : public std::tuple_size > + : public std::tuple_size > {}; // // tuple_element // template struct tuple_element > - : public std::tuple_element > + : public std::tuple_element > {}; #if defined(__clang__) # pragma clang diagnostic pop @@ -70,10 +70,10 @@ namespace sprout { // tuple_get // template - inline SPROUT_CONSTEXPR typename std::tuple_element >::type - tuple_get(sprout::integer_seq) SPROUT_NOEXCEPT { + inline SPROUT_CONSTEXPR typename std::tuple_element >::type + tuple_get(sprout::integer_sequence) SPROUT_NOEXCEPT { static_assert(I < sizeof...(Is), "tuple_get: index out of range"); - typedef typename std::tuple_element >::type type; + typedef typename std::tuple_element >::type type; return type(); } diff --git a/sprout/string/string.hpp b/sprout/string/string.hpp index 244e526d..c020b2a2 100644 --- a/sprout/string/string.hpp +++ b/sprout/string/string.hpp @@ -721,7 +721,7 @@ namespace sprout { make(Args&&... args) { return make_impl( length(args...), - sprout::make_index_tuple::make(), + sprout::index_pack::make(), sprout::forward(args)... ); } @@ -730,7 +730,7 @@ namespace sprout { make(typename copied_type::size_type size, Args&&... args) { return make_impl( size, - sprout::make_index_tuple::make(), + sprout::index_pack::make(), sprout::forward(args)... ); } diff --git a/sprout/tuple/tuple/hash.hpp b/sprout/tuple/tuple/hash.hpp index 00571adb..af7ea479 100644 --- a/sprout/tuple/tuple/hash.hpp +++ b/sprout/tuple/tuple/hash.hpp @@ -26,7 +26,7 @@ namespace sprout { hash_value(sprout::tuples::tuple const& v) { return sprout::tuples::detail::tuple_hash_value_impl( v, - sprout::make_index_tuple::make() + sprout::index_pack::make() ); } } // namespace tuples diff --git a/sprout/type/type_tuple.hpp b/sprout/type/type_tuple.hpp index 24ce84c8..63184678 100644 --- a/sprout/type/type_tuple.hpp +++ b/sprout/type/type_tuple.hpp @@ -22,10 +22,10 @@ namespace sprout { typedef sprout::types::index_iterator begin; typedef sprout::types::index_iterator end; public: - SPROUT_STATIC_CONSTEXPR std::size_t size = sizeof...(Types); + SPROUT_STATIC_CONSTEXPR std::size_t static_size = sizeof...(Types); }; template - SPROUT_CONSTEXPR_OR_CONST std::size_t sprout::types::type_tuple::size; + SPROUT_CONSTEXPR_OR_CONST std::size_t sprout::types::type_tuple::static_size; // // rebind_types diff --git a/sprout/utility/pair/pair.hpp b/sprout/utility/pair/pair.hpp index cc640725..4a9d1696 100644 --- a/sprout/utility/pair/pair.hpp +++ b/sprout/utility/pair/pair.hpp @@ -37,8 +37,8 @@ namespace sprout { : pair( first_args, second_args, - sprout::make_index_tuple::make(), - sprout::make_index_tuple::make() + sprout::index_pack::make(), + sprout::index_pack::make() ) {} #endif // #if SPROUT_USE_DELEGATING_CONSTRUCTORS