tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
integer_sequence.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_UTILITY_INTEGER_SEQUENCE_HPP
5#define TETL_UTILITY_INTEGER_SEQUENCE_HPP
6
7#include <etl/_config/all.hpp>
8
9#include <etl/_cstddef/size_t.hpp>
10#include <etl/_type_traits/is_integral.hpp>
11
12namespace etl {
13
14template <typename T, T... Ints>
16 static_assert(is_integral_v<T>, "T must be an integral type.");
17
18 using value_type = T;
19
20 [[nodiscard]] static constexpr auto size() noexcept -> size_t
21 {
22 return sizeof...(Ints);
23 }
24};
25
26template <typename T, T Size>
27using make_integer_sequence = TETL_BUILTIN_INT_SEQ(T, Size);
28
29} // namespace etl
30
31#endif // TETL_UTILITY_INTEGER_SEQUENCE_HPP
Definition adjacent_find.hpp:9
Definition integer_sequence.hpp:15
static constexpr auto size() noexcept -> size_t
Definition integer_sequence.hpp:20