mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
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:
parent
a3aedcf136
commit
bb36ef6e8b
24 changed files with 196 additions and 83 deletions
|
@ -215,7 +215,7 @@ namespace sprout {
|
|||
template<typename... Args>
|
||||
struct deduce_domain
|
||||
: public sprout::breed::detail::deduce_domain_impl<
|
||||
typename sprout::make_index_tuple<sizeof...(Args)>::type,
|
||||
typename sprout::index_pack<Args...>::type,
|
||||
Args...
|
||||
>
|
||||
{};
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace sprout {
|
|||
}
|
||||
public:
|
||||
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>
|
||||
|
@ -74,7 +74,7 @@ namespace sprout {
|
|||
}
|
||||
public:
|
||||
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
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace sprout {
|
|||
template<typename Intersection, typename Objects>
|
||||
SPROUT_CONSTEXPR color_type
|
||||
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());
|
||||
}
|
||||
};
|
||||
//
|
||||
|
|
|
@ -181,7 +181,7 @@ namespace sprout {
|
|||
SPROUT_CONSTEXPR auto operator()(CVArg& arg, sprout::tuples::tuple<Args...>& tuple) const volatile
|
||||
-> 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>
|
||||
|
@ -277,7 +277,7 @@ namespace sprout {
|
|||
{
|
||||
private:
|
||||
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:
|
||||
Functor f_;
|
||||
sprout::tuples::tuple<BoundArgs...> bound_args_;
|
||||
|
@ -385,7 +385,7 @@ namespace sprout {
|
|||
class bind_result<Result, Functor(BoundArgs...)> {
|
||||
private:
|
||||
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:
|
||||
template<typename Res>
|
||||
struct enable_if_void
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
#define SPROUT_INDEX_TUPLE_CLASS_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_sequence.hpp>
|
||||
|
||||
#endif // #ifndef SPROUT_INDEX_TUPLE_CLASS_HPP
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple/index_tuple.hpp>
|
||||
#include <sprout/index_tuple/integer_n.hpp>
|
||||
#include <sprout/index_tuple/enable_make_indexes.hpp>
|
||||
|
||||
|
|
32
sprout/index_tuple/index_pack.hpp
Normal file
32
sprout/index_tuple/index_pack.hpp
Normal 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
|
19
sprout/index_tuple/index_sequence.hpp
Normal file
19
sprout/index_tuple/index_sequence.hpp
Normal 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
|
17
sprout/index_tuple/index_sequence_for.hpp
Normal file
17
sprout/index_tuple/index_sequence_for.hpp
Normal 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
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple/integer_seq.hpp>
|
||||
#include <sprout/index_tuple/integer_sequence.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
|
@ -13,7 +13,7 @@ namespace sprout {
|
|||
typedef std::ptrdiff_t index_t;
|
||||
template<sprout::index_t... Indexes>
|
||||
struct index_tuple
|
||||
: public sprout::integer_seq<sprout::index_t, Indexes...>
|
||||
: public sprout::integer_sequence<sprout::index_t, Indexes...>
|
||||
{
|
||||
public:
|
||||
typedef index_tuple type;
|
||||
|
@ -30,7 +30,7 @@ namespace sprout {
|
|||
typedef std::size_t uindex_t;
|
||||
template<sprout::uindex_t... Indexes>
|
||||
struct uindex_tuple
|
||||
: public sprout::integer_seq<sprout::uindex_t, Indexes...>
|
||||
: public sprout::integer_sequence<sprout::uindex_t, Indexes...>
|
||||
{
|
||||
public:
|
||||
typedef uindex_tuple type;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
#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>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -15,15 +15,15 @@ namespace sprout {
|
|||
template<typename T, typename Seq>
|
||||
struct integer_n_next_even;
|
||||
template<typename T, T... Is>
|
||||
struct integer_n_next_even<T, sprout::integer_seq<T, Is...> >
|
||||
: public sprout::integer_seq<T, Is..., Is...>
|
||||
struct integer_n_next_even<T, sprout::integer_sequence<T, Is...> >
|
||||
: public sprout::integer_sequence<T, Is..., Is...>
|
||||
{};
|
||||
|
||||
template<typename T, typename Seq, T Tail>
|
||||
struct integer_n_next_even_odd;
|
||||
template<typename T, T... Is, T Tail>
|
||||
struct integer_n_next_even_odd<T, sprout::integer_seq<T, Is...>, Tail>
|
||||
: public sprout::integer_seq<T, Is..., Is..., Tail>
|
||||
struct integer_n_next_even_odd<T, sprout::integer_sequence<T, Is...>, Tail>
|
||||
: public sprout::integer_sequence<T, Is..., Is..., Tail>
|
||||
{};
|
||||
|
||||
template<typename T, T I, std::size_t N, typename Enable = void>
|
||||
|
@ -33,14 +33,14 @@ namespace sprout {
|
|||
T, I, N,
|
||||
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>
|
||||
struct integer_n_impl<
|
||||
T, I, N,
|
||||
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>
|
||||
struct integer_n_impl<
|
||||
|
|
17
sprout/index_tuple/integer_pack.hpp
Normal file
17
sprout/index_tuple/integer_pack.hpp
Normal 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
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <type_traits>
|
||||
#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>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -18,15 +18,15 @@ namespace sprout {
|
|||
template<typename T, typename Seq, T Next>
|
||||
struct integer_range_next_even;
|
||||
template<typename T, T... Is, T Next>
|
||||
struct integer_range_next_even<T, sprout::integer_seq<T, Is...>, Next>
|
||||
: public sprout::integer_seq<T, Is..., (Is + Next)...>
|
||||
struct integer_range_next_even<T, sprout::integer_sequence<T, Is...>, Next>
|
||||
: public sprout::integer_sequence<T, Is..., (Is + Next)...>
|
||||
{};
|
||||
|
||||
template<typename T, typename Seq, T Next, T Tail>
|
||||
struct integer_range_next_odd;
|
||||
template<typename T, T... Is, T Next, T Tail>
|
||||
struct integer_range_next_odd<T, sprout::integer_seq<T, Is...>, Next, Tail>
|
||||
: public sprout::integer_seq<T, Is..., (Is + Next)..., Tail>
|
||||
struct integer_range_next_odd<T, sprout::integer_sequence<T, 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>
|
||||
|
@ -36,14 +36,14 @@ namespace sprout {
|
|||
T, First, Step, N,
|
||||
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>
|
||||
struct integer_range_impl<
|
||||
T, First, Step, N,
|
||||
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>
|
||||
struct integer_range_impl<
|
||||
|
|
|
@ -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
|
36
sprout/index_tuple/integer_sequence.hpp
Normal file
36
sprout/index_tuple/integer_sequence.hpp
Normal 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
|
18
sprout/index_tuple/make_index_sequence.hpp
Normal file
18
sprout/index_tuple/make_index_sequence.hpp
Normal 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
|
|
@ -4,7 +4,7 @@
|
|||
#include <cstddef>
|
||||
#include <sprout/config.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>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -14,7 +14,7 @@ namespace sprout {
|
|||
template<sprout::index_t N>
|
||||
struct make_index_tuple
|
||||
: 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
|
||||
>
|
||||
{};
|
||||
|
@ -24,7 +24,7 @@ namespace sprout {
|
|||
template<sprout::uindex_t N>
|
||||
struct make_uindex_tuple
|
||||
: 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
|
||||
>
|
||||
{};
|
||||
|
|
|
@ -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 <sprout/config.hpp>
|
||||
#include <sprout/index_tuple/integer_range.hpp>
|
||||
|
@ -7,14 +7,14 @@
|
|||
|
||||
namespace sprout {
|
||||
//
|
||||
// make_integer_seq
|
||||
// make_integer_sequence
|
||||
//
|
||||
template<typename T, T N>
|
||||
struct make_integer_seq
|
||||
struct make_integer_sequence
|
||||
: public sprout::enable_make_indexes<
|
||||
sprout::integer_range<T, 0, N>
|
||||
>
|
||||
{};
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQ_HPP
|
||||
#endif // #ifndef SPROUT_INDEX_TUPLE_MAKE_INTEGER_SEQUENCE_HPP
|
|
@ -2,11 +2,15 @@
|
|||
#define SPROUT_INDEX_TUPLE_METAFUNCTION_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/integer_pack.hpp>
|
||||
#include <sprout/index_tuple/index_pack.hpp>
|
||||
#include <sprout/index_tuple/integer_range.hpp>
|
||||
#include <sprout/index_tuple/index_range.hpp>
|
||||
#include <sprout/index_tuple/integer_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
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#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/utility/pack.hpp>
|
||||
|
||||
|
@ -18,14 +18,14 @@ namespace std {
|
|||
// tuple_size
|
||||
//
|
||||
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)>
|
||||
{};
|
||||
//
|
||||
// tuple_element
|
||||
//
|
||||
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");
|
||||
public:
|
||||
typedef typename sprout::tppack_c_at<I, T, Is...>::type type;
|
||||
|
@ -36,14 +36,14 @@ namespace std {
|
|||
//
|
||||
template<sprout::index_t... 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
|
||||
//
|
||||
template<std::size_t I, sprout::index_t... 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>
|
||||
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
|
||||
//
|
||||
template<std::size_t I, sprout::uindex_t... 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__)
|
||||
# pragma clang diagnostic pop
|
||||
|
@ -70,10 +70,10 @@ namespace sprout {
|
|||
// tuple_get
|
||||
//
|
||||
template<std::size_t I, typename T, T... Is>
|
||||
inline SPROUT_CONSTEXPR typename std::tuple_element<I, sprout::integer_seq<T, Is...> >::type
|
||||
tuple_get(sprout::integer_seq<T, Is...>) SPROUT_NOEXCEPT {
|
||||
inline SPROUT_CONSTEXPR typename std::tuple_element<I, sprout::integer_sequence<T, Is...> >::type
|
||||
tuple_get(sprout::integer_sequence<T, Is...>) SPROUT_NOEXCEPT {
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -721,7 +721,7 @@ namespace sprout {
|
|||
make(Args&&... args) {
|
||||
return make_impl(
|
||||
length(args...),
|
||||
sprout::make_index_tuple<sizeof...(Args)>::make(),
|
||||
sprout::index_pack<Args...>::make(),
|
||||
sprout::forward<Args>(args)...
|
||||
);
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ namespace sprout {
|
|||
make(typename copied_type::size_type size, Args&&... args) {
|
||||
return make_impl(
|
||||
size,
|
||||
sprout::make_index_tuple<sizeof...(Args)>::make(),
|
||||
sprout::index_pack<Args...>::make(),
|
||||
sprout::forward<Args>(args)...
|
||||
);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace sprout {
|
|||
hash_value(sprout::tuples::tuple<Types...> const& v) {
|
||||
return sprout::tuples::detail::tuple_hash_value_impl(
|
||||
v,
|
||||
sprout::make_index_tuple<sizeof...(Types)>::make()
|
||||
sprout::index_pack<Types...>::make()
|
||||
);
|
||||
}
|
||||
} // namespace tuples
|
||||
|
|
|
@ -22,10 +22,10 @@ namespace sprout {
|
|||
typedef sprout::types::index_iterator<type_tuple, 0> begin;
|
||||
typedef sprout::types::index_iterator<type_tuple, sizeof...(Types)> end;
|
||||
public:
|
||||
SPROUT_STATIC_CONSTEXPR std::size_t size = sizeof...(Types);
|
||||
SPROUT_STATIC_CONSTEXPR std::size_t static_size = sizeof...(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
|
||||
|
|
|
@ -37,8 +37,8 @@ namespace sprout {
|
|||
: pair(
|
||||
first_args,
|
||||
second_args,
|
||||
sprout::make_index_tuple<sizeof...(Args1)>::make(),
|
||||
sprout::make_index_tuple<sizeof...(Args2)>::make()
|
||||
sprout::index_pack<Args1...>::make(),
|
||||
sprout::index_pack<Args2...>::make()
|
||||
)
|
||||
{}
|
||||
#endif // #if SPROUT_USE_DELEGATING_CONSTRUCTORS
|
||||
|
|
Loading…
Reference in a new issue