mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-16 15:14:13 +00:00
fix index_tuple implementation: template aliases (if compiler supported)
This commit is contained in:
parent
bb36ef6e8b
commit
3ff1ffb4d9
8 changed files with 78 additions and 21 deletions
|
@ -1,16 +1,22 @@
|
|||
#ifndef SPROUT_INDEX_TUPLE_INDEX_TUPLE_HPP
|
||||
#define SPROUT_INDEX_TUPLE_INDEX_TUPLE_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/index_tuple/index_t.hpp>
|
||||
#include <sprout/index_tuple/integer_sequence.hpp>
|
||||
|
||||
namespace sprout {
|
||||
//
|
||||
// index_t
|
||||
// index_tuple
|
||||
// uindex_tuple
|
||||
//
|
||||
typedef std::ptrdiff_t index_t;
|
||||
#if SPROUT_USE_TEMPLATE_ALIASES
|
||||
template<sprout::index_t... Indexes>
|
||||
using index_tuple = sprout::integer_sequence<sprout::index_t, Indexes...>;
|
||||
|
||||
template<sprout::uindex_t... Indexes>
|
||||
using uindex_tuple = sprout::integer_sequence<sprout::uindex_t, Indexes...>;
|
||||
#else // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||
template<sprout::index_t... Indexes>
|
||||
struct index_tuple
|
||||
: public sprout::integer_sequence<sprout::index_t, Indexes...>
|
||||
|
@ -23,11 +29,6 @@ namespace sprout {
|
|||
{};
|
||||
};
|
||||
|
||||
//
|
||||
// uindex_t
|
||||
// uindex_tuple
|
||||
//
|
||||
typedef std::size_t uindex_t;
|
||||
template<sprout::uindex_t... Indexes>
|
||||
struct uindex_tuple
|
||||
: public sprout::integer_sequence<sprout::uindex_t, Indexes...>
|
||||
|
@ -39,6 +40,7 @@ namespace sprout {
|
|||
: public uindex_tuple<J...>
|
||||
{};
|
||||
};
|
||||
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
|
||||
} // namespace sprout
|
||||
|
||||
#endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_TUPLE_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue