Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
make_index_sequence_repeat_n.hpp
Go to the documentation of this file.
1// Copyright 2026, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INTEGER_SEQUENCES_MAKE_INDEX_SEQUENCE_REPEAT_N_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INTEGER_SEQUENCES_MAKE_INDEX_SEQUENCE_REPEAT_N_HPP_
7
8// IWYU pragma: private, include "arene/base/integer_sequences.hpp"
9// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
10
11#include "arene/base/stdlib_choice/cstddef.hpp"
12#include "arene/base/stdlib_choice/integer_sequence.hpp"
13#include "arene/base/stdlib_choice/integral_constant.hpp"
15
16namespace arene {
17namespace base {
18
19namespace make_index_sequence_repeat_n_detail {
20
21/// @brief adapt a pack of @c std::integral_constant types to @c std::index_sequence
22/// @tparam ICs pack of @c std::integral_constant specializations whose values seed the sequence
23template <class... ICs>
24using to_index_sequence = std::index_sequence<ICs::value...>;
25
26} // namespace make_index_sequence_repeat_n_detail
27
28/// @brief An @c std::index_sequence whose elements are @p Count copies of @p Value.
29/// @tparam Value the value to repeat
30/// @tparam Count the number of copies to emit
31template <std::size_t Value, std::size_t Count>
33 Count,
34 make_index_sequence_repeat_n_detail::to_index_sequence,
36
37} // namespace base
38} // namespace arene
39
40#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INTEGER_SEQUENCES_MAKE_INDEX_SEQUENCE_REPEAT_N_HPP_
A helper class to represent a compile-time constant with the specified type and value....
Definition integral_constant.hpp:23
Definition accumulate.hpp:37
typename repeat_type< N, T, Arg >::type repeat_type_t
Repeat a template argument a specified number of times.
Definition repeat_type.hpp:48
repeat_type_t< Count, make_index_sequence_repeat_n_detail::to_index_sequence, std::integral_constant< std::size_t, Value > > make_index_sequence_repeat_n
An std::index_sequence whose elements are Count copies of Value.
Definition make_index_sequence_repeat_n.hpp:32
Definition accumulate.hpp:36
integer_sequence< size_t, Ints... > index_sequence
A helper alias template for integer_sequence<size_t, Ints>
Definition integer_sequence.hpp:218