support for N3658 (Compile-time integer sequences): index_tuple

rename: integer_seq -> integer_sequence, make_integer_sequence -> make_integer_sequence
add unsigned-index sequence: index_sequence(alias), make_index_sequence, index_sequence_for
add: integer_pack, index_pack
This commit is contained in:
bolero-MURAKAMI 2013-05-10 19:52:39 +09:00
parent a3aedcf136
commit bb36ef6e8b
24 changed files with 196 additions and 83 deletions

View file

@ -215,7 +215,7 @@ namespace sprout {
template<typename... Args> template<typename... Args>
struct deduce_domain struct deduce_domain
: public sprout::breed::detail::deduce_domain_impl< : public sprout::breed::detail::deduce_domain_impl<
typename sprout::make_index_tuple<sizeof...(Args)>::type, typename sprout::index_pack<Args...>::type,
Args... Args...
> >
{}; {};

View file

@ -55,7 +55,7 @@ namespace sprout {
} }
public: public:
static SPROUT_CONSTEXPR type call(src_type const& e) { static SPROUT_CONSTEXPR type call(src_type const& e) {
return call_impl(sprout::make_index_tuple<sizeof...(Args)>::make()); return call_impl(sprout::index_pack<Args...>::make());
} }
}; };
template<typename Tag, typename... Args> template<typename Tag, typename... Args>
@ -74,7 +74,7 @@ namespace sprout {
} }
public: public:
static SPROUT_CONSTEXPR type call(src_type const& e) { static SPROUT_CONSTEXPR type call(src_type const& e) {
return call_impl(sprout::make_index_tuple<sizeof...(Args)>::make()); return call_impl(sprout::index_pack<Args...>::make());
} }
}; };
} // namespace detail } // namespace detail

View file

@ -51,7 +51,7 @@ namespace sprout {
template<typename Intersection, typename Objects> template<typename Intersection, typename Objects>
SPROUT_CONSTEXPR color_type SPROUT_CONSTEXPR color_type
operator()(Intersection const& inter, Objects const& objs) const { operator()(Intersection const& inter, Objects const& objs) const {
return shade_1(inter, objs, sprout::make_index_tuple<sizeof...(Lights)>::make()); return shade_1(inter, objs, sprout::index_pack<Lights...>::make());
} }
}; };
// //

View file

@ -181,7 +181,7 @@ namespace sprout {
SPROUT_CONSTEXPR auto operator()(CVArg& arg, sprout::tuples::tuple<Args...>& tuple) const volatile SPROUT_CONSTEXPR auto operator()(CVArg& arg, sprout::tuples::tuple<Args...>& tuple) const volatile
-> decltype(arg(std::declval<Args>()...)) -> decltype(arg(std::declval<Args>()...))
{ {
return call(arg, tuple, sprout::make_index_tuple<sizeof...(Args)>::make()); return call(arg, tuple, sprout::index_pack<Args...>::make());
} }
}; };
template<typename Arg> template<typename Arg>
@ -277,7 +277,7 @@ namespace sprout {
{ {
private: private:
typedef binder self_type; typedef binder self_type;
typedef typename sprout::make_index_tuple<sizeof...(BoundArgs)>::type bound_indexes; typedef typename sprout::index_pack<BoundArgs...>::type bound_indexes;
private: private:
Functor f_; Functor f_;
sprout::tuples::tuple<BoundArgs...> bound_args_; sprout::tuples::tuple<BoundArgs...> bound_args_;
@ -385,7 +385,7 @@ namespace sprout {
class bind_result<Result, Functor(BoundArgs...)> { class bind_result<Result, Functor(BoundArgs...)> {
private: private:
typedef bind_result self_type; typedef bind_result self_type;
typedef typename sprout::make_index_tuple<sizeof...(BoundArgs)>::type bound_indexes; typedef typename sprout::index_pack<BoundArgs...>::type bound_indexes;
private: private:
template<typename Res> template<typename Res>
struct enable_if_void struct enable_if_void

View file

@ -2,7 +2,8 @@
#define SPROUT_INDEX_TUPLE_CLASS_HPP #define SPROUT_INDEX_TUPLE_CLASS_HPP
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/index_tuple/integer_seq.hpp> #include <sprout/index_tuple/integer_sequence.hpp>
#include <sprout/index_tuple/index_tuple.hpp> #include <sprout/index_tuple/index_tuple.hpp>
#include <sprout/index_tuple/index_sequence.hpp>
#endif // #ifndef SPROUT_INDEX_TUPLE_CLASS_HPP #endif // #ifndef SPROUT_INDEX_TUPLE_CLASS_HPP

View file

@ -3,6 +3,7 @@
#include <cstddef> #include <cstddef>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/index_tuple/index_tuple.hpp>
#include <sprout/index_tuple/integer_n.hpp> #include <sprout/index_tuple/integer_n.hpp>
#include <sprout/index_tuple/enable_make_indexes.hpp> #include <sprout/index_tuple/enable_make_indexes.hpp>

View file

@ -0,0 +1,32 @@
#ifndef SPROUT_INDEX_TUPLE_INDEX_PACK_HPP
#define SPROUT_INDEX_TUPLE_INDEX_PACK_HPP
#include <sprout/config.hpp>
#include <sprout/index_tuple/index_tuple.hpp>
#include <sprout/index_tuple/integer_pack.hpp>
#include <sprout/index_tuple/enable_make_indexes.hpp>
namespace sprout {
//
// index_pack
//
template<typename... Ts>
struct index_pack
: public sprout::enable_make_indexes<
typename sprout::integer_pack<sprout::index_t, Ts...>::type
::template transfer<sprout::index_tuple<> >
>
{};
//
// uindex_pack
//
template<typename... Ts>
struct uindex_pack
: public sprout::enable_make_indexes<
typename sprout::integer_pack<sprout::uindex_t, Ts...>::type
::template transfer<sprout::uindex_tuple<> >
>
{};
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_PACK_HPP

View file

@ -0,0 +1,19 @@
#ifndef SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_HPP
#define SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_HPP
#include <sprout/config.hpp>
#if SPROUT_USE_TEMPLATE_ALIASES
# include <sprout/index_tuple/index_tuple.hpp>
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
namespace sprout {
#if SPROUT_USE_TEMPLATE_ALIASES
//
// index_sequence
//
template<sprout::uindex_t... Indexes>
using index_sequence = sprout::uindex_tuple<Indexes...>;
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_HPP

View file

@ -0,0 +1,17 @@
#ifndef SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_FOR_HPP
#define SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_FOR_HPP
#include <sprout/config.hpp>
#include <sprout/index_tuple/index_pack.hpp>
namespace sprout {
//
// index_sequence_for
//
template<typename... Ts>
struct index_sequence_for
: public sprout::uindex_pack<Ts...>
{};
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_SEQUENCE_FOR_HPP

View file

@ -3,7 +3,7 @@
#include <cstddef> #include <cstddef>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/index_tuple/integer_seq.hpp> #include <sprout/index_tuple/integer_sequence.hpp>
namespace sprout { namespace sprout {
// //
@ -13,7 +13,7 @@ namespace sprout {
typedef std::ptrdiff_t index_t; typedef std::ptrdiff_t index_t;
template<sprout::index_t... Indexes> template<sprout::index_t... Indexes>
struct index_tuple struct index_tuple
: public sprout::integer_seq<sprout::index_t, Indexes...> : public sprout::integer_sequence<sprout::index_t, Indexes...>
{ {
public: public:
typedef index_tuple type; typedef index_tuple type;
@ -30,7 +30,7 @@ namespace sprout {
typedef std::size_t uindex_t; typedef std::size_t uindex_t;
template<sprout::uindex_t... Indexes> template<sprout::uindex_t... Indexes>
struct uindex_tuple struct uindex_tuple
: public sprout::integer_seq<sprout::uindex_t, Indexes...> : public sprout::integer_sequence<sprout::uindex_t, Indexes...>
{ {
public: public:
typedef uindex_tuple type; typedef uindex_tuple type;

View file

@ -4,7 +4,7 @@
#include <cstddef> #include <cstddef>
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/index_tuple/integer_seq.hpp> #include <sprout/index_tuple/integer_sequence.hpp>
#include <sprout/index_tuple/enable_make_indexes.hpp> #include <sprout/index_tuple/enable_make_indexes.hpp>
namespace sprout { namespace sprout {
@ -15,15 +15,15 @@ namespace sprout {
template<typename T, typename Seq> template<typename T, typename Seq>
struct integer_n_next_even; struct integer_n_next_even;
template<typename T, T... Is> template<typename T, T... Is>
struct integer_n_next_even<T, sprout::integer_seq<T, Is...> > struct integer_n_next_even<T, sprout::integer_sequence<T, Is...> >
: public sprout::integer_seq<T, Is..., Is...> : public sprout::integer_sequence<T, Is..., Is...>
{}; {};
template<typename T, typename Seq, T Tail> template<typename T, typename Seq, T Tail>
struct integer_n_next_even_odd; struct integer_n_next_even_odd;
template<typename T, T... Is, T Tail> template<typename T, T... Is, T Tail>
struct integer_n_next_even_odd<T, sprout::integer_seq<T, Is...>, Tail> struct integer_n_next_even_odd<T, sprout::integer_sequence<T, Is...>, Tail>
: public sprout::integer_seq<T, Is..., Is..., Tail> : public sprout::integer_sequence<T, Is..., Is..., Tail>
{}; {};
template<typename T, T I, std::size_t N, typename Enable = void> template<typename T, T I, std::size_t N, typename Enable = void>
@ -33,14 +33,14 @@ namespace sprout {
T, I, N, T, I, N,
typename std::enable_if<(N == 0)>::type typename std::enable_if<(N == 0)>::type
> >
: public sprout::integer_seq<T> : public sprout::integer_sequence<T>
{}; {};
template<typename T, T I, std::size_t N> template<typename T, T I, std::size_t N>
struct integer_n_impl< struct integer_n_impl<
T, I, N, T, I, N,
typename std::enable_if<(N == 1)>::type typename std::enable_if<(N == 1)>::type
> >
: public sprout::integer_seq<T, I> : public sprout::integer_sequence<T, I>
{}; {};
template<typename T, T I, std::size_t N> template<typename T, T I, std::size_t N>
struct integer_n_impl< struct integer_n_impl<

View file

@ -0,0 +1,17 @@
#ifndef SPROUT_INDEX_TUPLE_INTEGER_PACK_HPP
#define SPROUT_INDEX_TUPLE_INTEGER_PACK_HPP
#include <sprout/config.hpp>
#include <sprout/index_tuple/make_integer_sequence.hpp>
namespace sprout {
//
// integer_pack
//
template<typename T, typename... Ts>
struct integer_pack
: public sprout::make_integer_sequence<T, sizeof...(Ts)>
{};
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INTEGER_PACK_HPP

View file

@ -3,7 +3,7 @@
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/index_tuple/integer_seq.hpp> #include <sprout/index_tuple/integer_sequence.hpp>
#include <sprout/index_tuple/enable_make_indexes.hpp> #include <sprout/index_tuple/enable_make_indexes.hpp>
namespace sprout { namespace sprout {
@ -18,15 +18,15 @@ namespace sprout {
template<typename T, typename Seq, T Next> template<typename T, typename Seq, T Next>
struct integer_range_next_even; struct integer_range_next_even;
template<typename T, T... Is, T Next> template<typename T, T... Is, T Next>
struct integer_range_next_even<T, sprout::integer_seq<T, Is...>, Next> struct integer_range_next_even<T, sprout::integer_sequence<T, Is...>, Next>
: public sprout::integer_seq<T, Is..., (Is + Next)...> : public sprout::integer_sequence<T, Is..., (Is + Next)...>
{}; {};
template<typename T, typename Seq, T Next, T Tail> template<typename T, typename Seq, T Next, T Tail>
struct integer_range_next_odd; struct integer_range_next_odd;
template<typename T, T... Is, T Next, T Tail> template<typename T, T... Is, T Next, T Tail>
struct integer_range_next_odd<T, sprout::integer_seq<T, Is...>, Next, Tail> struct integer_range_next_odd<T, sprout::integer_sequence<T, Is...>, Next, Tail>
: public sprout::integer_seq<T, Is..., (Is + Next)..., Tail> : public sprout::integer_sequence<T, Is..., (Is + Next)..., Tail>
{}; {};
template<typename T, T First, typename std::make_signed<T>::type Step, typename std::make_unsigned<T>::type N, typename Enable = void> template<typename T, T First, typename std::make_signed<T>::type Step, typename std::make_unsigned<T>::type N, typename Enable = void>
@ -36,14 +36,14 @@ namespace sprout {
T, First, Step, N, T, First, Step, N,
typename std::enable_if<(N == 0)>::type typename std::enable_if<(N == 0)>::type
> >
: public sprout::integer_seq<T> : public sprout::integer_sequence<T>
{}; {};
template<typename T, T First, typename std::make_signed<T>::type Step, typename std::make_unsigned<T>::type N> template<typename T, T First, typename std::make_signed<T>::type Step, typename std::make_unsigned<T>::type N>
struct integer_range_impl< struct integer_range_impl<
T, First, Step, N, T, First, Step, N,
typename std::enable_if<(N == 1)>::type typename std::enable_if<(N == 1)>::type
> >
: public sprout::integer_seq<T, First> : public sprout::integer_sequence<T, First>
{}; {};
template<typename T, T First, typename std::make_signed<T>::type Step, typename std::make_unsigned<T>::type N> template<typename T, T First, typename std::make_signed<T>::type Step, typename std::make_unsigned<T>::type N>
struct integer_range_impl< struct integer_range_impl<

View file

@ -1,32 +0,0 @@
#ifndef SPROUT_INDEX_TUPLE_INTEGER_SEQ_HPP
#define SPROUT_INDEX_TUPLE_INTEGER_SEQ_HPP
#include <cstddef>
#include <sprout/config.hpp>
namespace sprout {
//
// integer_seq
//
template<typename T, T... Is>
struct integer_seq {
public:
typedef integer_seq type;
template<T... J>
struct rebind
: public integer_seq<T, J...>
{};
public:
typedef T value_type;
template<typename Seq>
struct transfer
: public Seq::template rebind<Is...>
{};
public:
SPROUT_STATIC_CONSTEXPR std::size_t size = sizeof...(Is);
};
template<typename T, T... Is>
SPROUT_CONSTEXPR_OR_CONST std::size_t sprout::integer_seq<T, Is...>::size;
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INTEGER_SEQ_HPP

View file

@ -0,0 +1,36 @@
#ifndef SPROUT_INDEX_TUPLE_INTEGER_SEQUENCE_HPP
#define SPROUT_INDEX_TUPLE_INTEGER_SEQUENCE_HPP
#include <cstddef>
#include <sprout/config.hpp>
namespace sprout {
//
// integer_sequence
//
template<typename T, T... Is>
struct integer_sequence {
public:
typedef integer_sequence type;
template<T... J>
struct rebind
: public integer_sequence<T, J...>
{};
public:
typedef T value_type;
template<typename Seq>
struct transfer
: public Seq::template rebind<Is...>
{};
public:
SPROUT_STATIC_CONSTEXPR std::size_t static_size = sizeof...(Is);
public:
static SPROUT_CONSTEXPR size_t size() noexcept {
return static_size;
}
};
template<typename T, T... Is>
SPROUT_CONSTEXPR_OR_CONST std::size_t sprout::integer_sequence<T, Is...>::static_size;
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_INTEGER_SEQUENCE_HPP

View file

@ -0,0 +1,18 @@
#ifndef SPROUT_INDEX_TUPLE_MAKE_INDEX_SEQUENCE_HPP
#define SPROUT_INDEX_TUPLE_MAKE_INDEX_SEQUENCE_HPP
#include <sprout/config.hpp>
#include <sprout/index_tuple/index_tuple.hpp>
#include <sprout/index_tuple/make_index_tuple.hpp>
namespace sprout {
//
// make_index_sequence
//
template<sprout::uindex_t N>
struct make_index_sequence
: public sprout::make_uindex_tuple<N>
{};
} // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_MAKE_INDEX_SEQUENCE_HPP

View file

@ -4,7 +4,7 @@
#include <cstddef> #include <cstddef>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/index_tuple/index_tuple.hpp> #include <sprout/index_tuple/index_tuple.hpp>
#include <sprout/index_tuple/make_integer_seq.hpp> #include <sprout/index_tuple/make_integer_sequence.hpp>
#include <sprout/index_tuple/enable_make_indexes.hpp> #include <sprout/index_tuple/enable_make_indexes.hpp>
namespace sprout { namespace sprout {
@ -14,7 +14,7 @@ namespace sprout {
template<sprout::index_t N> template<sprout::index_t N>
struct make_index_tuple struct make_index_tuple
: public sprout::enable_make_indexes< : public sprout::enable_make_indexes<
typename sprout::make_integer_seq<sprout::index_t, N>::type typename sprout::make_integer_sequence<sprout::index_t, N>::type
::template transfer<sprout::index_tuple<> >::type ::template transfer<sprout::index_tuple<> >::type
> >
{}; {};
@ -24,7 +24,7 @@ namespace sprout {
template<sprout::uindex_t N> template<sprout::uindex_t N>
struct make_uindex_tuple struct make_uindex_tuple
: public sprout::enable_make_indexes< : public sprout::enable_make_indexes<
typename sprout::make_integer_seq<sprout::uindex_t, N>::type typename sprout::make_integer_sequence<sprout::uindex_t, N>::type
::template transfer<sprout::uindex_tuple<> >::type ::template transfer<sprout::uindex_tuple<> >::type
> >
{}; {};

View file

@ -1,5 +1,5 @@
#ifndef SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQ_HPP #ifndef SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQUENCE_HPP
#define SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQ_HPP #define SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQUENCE_HPP
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/index_tuple/integer_range.hpp> #include <sprout/index_tuple/integer_range.hpp>
@ -7,14 +7,14 @@
namespace sprout { namespace sprout {
// //
// make_integer_seq // make_integer_sequence
// //
template<typename T, T N> template<typename T, T N>
struct make_integer_seq struct make_integer_sequence
: public sprout::enable_make_indexes< : public sprout::enable_make_indexes<
sprout::integer_range<T, 0, N> sprout::integer_range<T, 0, N>
> >
{}; {};
} // namespace sprout } // namespace sprout
#endif // #ifndef SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQ_HPP #endif // #ifndef SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQUENCE_HPP

View file

@ -2,11 +2,15 @@
#define SPROUT_INDEX_TUPLE_METAFUNCTION_HPP #define SPROUT_INDEX_TUPLE_METAFUNCTION_HPP
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/index_tuple/make_integer_seq.hpp> #include <sprout/index_tuple/make_integer_sequence.hpp>
#include <sprout/index_tuple/make_index_tuple.hpp> #include <sprout/index_tuple/make_index_tuple.hpp>
#include <sprout/index_tuple/integer_pack.hpp>
#include <sprout/index_tuple/index_pack.hpp>
#include <sprout/index_tuple/integer_range.hpp> #include <sprout/index_tuple/integer_range.hpp>
#include <sprout/index_tuple/index_range.hpp> #include <sprout/index_tuple/index_range.hpp>
#include <sprout/index_tuple/integer_n.hpp> #include <sprout/index_tuple/integer_n.hpp>
#include <sprout/index_tuple/index_n.hpp> #include <sprout/index_tuple/index_n.hpp>
#include <sprout/index_tuple/make_index_sequence.hpp>
#include <sprout/index_tuple/index_sequence_for.hpp>
#endif // #ifndef SPROUT_INDEX_TUPLE_METAFUNCTION_HPP #endif // #ifndef SPROUT_INDEX_TUPLE_METAFUNCTION_HPP

View file

@ -5,7 +5,7 @@
#include <tuple> #include <tuple>
#include <type_traits> #include <type_traits>
#include <sprout/config.hpp> #include <sprout/config.hpp>
#include <sprout/index_tuple/integer_seq.hpp> #include <sprout/index_tuple/integer_sequence.hpp>
#include <sprout/index_tuple/index_tuple.hpp> #include <sprout/index_tuple/index_tuple.hpp>
#include <sprout/utility/pack.hpp> #include <sprout/utility/pack.hpp>
@ -18,14 +18,14 @@ namespace std {
// tuple_size // tuple_size
// //
template<typename T, T... Is> template<typename T, T... Is>
struct tuple_size<sprout::integer_seq<T, Is...> > struct tuple_size<sprout::integer_sequence<T, Is...> >
: public std::integral_constant<std::size_t, sizeof...(Is)> : public std::integral_constant<std::size_t, sizeof...(Is)>
{}; {};
// //
// tuple_element // tuple_element
// //
template<std::size_t I, typename T, T... Is> template<std::size_t I, typename T, T... Is>
struct tuple_element<I, sprout::integer_seq<T, Is...> > { struct tuple_element<I, sprout::integer_sequence<T, Is...> > {
static_assert(I < sizeof...(Is), "tuple_element<>: index out of range"); static_assert(I < sizeof...(Is), "tuple_element<>: index out of range");
public: public:
typedef typename sprout::tppack_c_at<I, T, Is...>::type type; typedef typename sprout::tppack_c_at<I, T, Is...>::type type;
@ -36,14 +36,14 @@ namespace std {
// //
template<sprout::index_t... Indexes> template<sprout::index_t... Indexes>
struct tuple_size<sprout::index_tuple<Indexes...> > struct tuple_size<sprout::index_tuple<Indexes...> >
: public std::tuple_size<sprout::integer_seq<sprout::index_t, Indexes...> > : public std::tuple_size<sprout::integer_sequence<sprout::index_t, Indexes...> >
{}; {};
// //
// tuple_element // tuple_element
// //
template<std::size_t I, sprout::index_t... Indexes> template<std::size_t I, sprout::index_t... Indexes>
struct tuple_element<I, sprout::index_tuple<Indexes...> > struct tuple_element<I, sprout::index_tuple<Indexes...> >
: public std::tuple_element<I, sprout::integer_seq<sprout::index_t, Indexes...> > : public std::tuple_element<I, sprout::integer_sequence<sprout::index_t, Indexes...> >
{}; {};
// //
@ -51,14 +51,14 @@ namespace std {
// //
template<sprout::uindex_t... Indexes> template<sprout::uindex_t... Indexes>
struct tuple_size<sprout::uindex_tuple<Indexes...> > struct tuple_size<sprout::uindex_tuple<Indexes...> >
: public std::tuple_size<sprout::integer_seq<sprout::uindex_t, Indexes...> > : public std::tuple_size<sprout::integer_sequence<sprout::uindex_t, Indexes...> >
{}; {};
// //
// tuple_element // tuple_element
// //
template<std::size_t I, sprout::uindex_t... Indexes> template<std::size_t I, sprout::uindex_t... Indexes>
struct tuple_element<I, sprout::uindex_tuple<Indexes...> > struct tuple_element<I, sprout::uindex_tuple<Indexes...> >
: public std::tuple_element<I, sprout::integer_seq<sprout::uindex_t, Indexes...> > : public std::tuple_element<I, sprout::integer_sequence<sprout::uindex_t, Indexes...> >
{}; {};
#if defined(__clang__) #if defined(__clang__)
# pragma clang diagnostic pop # pragma clang diagnostic pop
@ -70,10 +70,10 @@ namespace sprout {
// tuple_get // tuple_get
// //
template<std::size_t I, typename T, T... Is> template<std::size_t I, typename T, T... Is>
inline SPROUT_CONSTEXPR typename std::tuple_element<I, sprout::integer_seq<T, Is...> >::type inline SPROUT_CONSTEXPR typename std::tuple_element<I, sprout::integer_sequence<T, Is...> >::type
tuple_get(sprout::integer_seq<T, Is...>) SPROUT_NOEXCEPT { tuple_get(sprout::integer_sequence<T, Is...>) SPROUT_NOEXCEPT {
static_assert(I < sizeof...(Is), "tuple_get: index out of range"); static_assert(I < sizeof...(Is), "tuple_get: index out of range");
typedef typename std::tuple_element<I, sprout::integer_seq<T, Is...> >::type type; typedef typename std::tuple_element<I, sprout::integer_sequence<T, Is...> >::type type;
return type(); return type();
} }

View file

@ -721,7 +721,7 @@ namespace sprout {
make(Args&&... args) { make(Args&&... args) {
return make_impl( return make_impl(
length(args...), length(args...),
sprout::make_index_tuple<sizeof...(Args)>::make(), sprout::index_pack<Args...>::make(),
sprout::forward<Args>(args)... sprout::forward<Args>(args)...
); );
} }
@ -730,7 +730,7 @@ namespace sprout {
make(typename copied_type::size_type size, Args&&... args) { make(typename copied_type::size_type size, Args&&... args) {
return make_impl( return make_impl(
size, size,
sprout::make_index_tuple<sizeof...(Args)>::make(), sprout::index_pack<Args...>::make(),
sprout::forward<Args>(args)... sprout::forward<Args>(args)...
); );
} }

View file

@ -26,7 +26,7 @@ namespace sprout {
hash_value(sprout::tuples::tuple<Types...> const& v) { hash_value(sprout::tuples::tuple<Types...> const& v) {
return sprout::tuples::detail::tuple_hash_value_impl( return sprout::tuples::detail::tuple_hash_value_impl(
v, v,
sprout::make_index_tuple<sizeof...(Types)>::make() sprout::index_pack<Types...>::make()
); );
} }
} // namespace tuples } // namespace tuples

View file

@ -22,10 +22,10 @@ namespace sprout {
typedef sprout::types::index_iterator<type_tuple, 0> begin; typedef sprout::types::index_iterator<type_tuple, 0> begin;
typedef sprout::types::index_iterator<type_tuple, sizeof...(Types)> end; typedef sprout::types::index_iterator<type_tuple, sizeof...(Types)> end;
public: public:
SPROUT_STATIC_CONSTEXPR std::size_t size = sizeof...(Types); SPROUT_STATIC_CONSTEXPR std::size_t static_size = sizeof...(Types);
}; };
template<typename... Types> template<typename... Types>
SPROUT_CONSTEXPR_OR_CONST std::size_t sprout::types::type_tuple<Types...>::size; SPROUT_CONSTEXPR_OR_CONST std::size_t sprout::types::type_tuple<Types...>::static_size;
// //
// rebind_types // rebind_types

View file

@ -37,8 +37,8 @@ namespace sprout {
: pair( : pair(
first_args, first_args,
second_args, second_args,
sprout::make_index_tuple<sizeof...(Args1)>::make(), sprout::index_pack<Args1...>::make(),
sprout::make_index_tuple<sizeof...(Args2)>::make() sprout::index_pack<Args2...>::make()
) )
{} {}
#endif // #if SPROUT_USE_DELEGATING_CONSTRUCTORS #endif // #if SPROUT_USE_DELEGATING_CONSTRUCTORS