mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-04 14:14:09 +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
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
|
Loading…
Add table
Add a link
Reference in a new issue