SimiLie
Loading...
Searching...
No Matches
filled_struct.hpp
1// SPDX-FileCopyrightText: 2024 Baptiste Legouix
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include <ddc/ddc.hpp>
7
8namespace sil {
9
10namespace misc {
11
12namespace detail {
13
14template <class T>
15struct FilledStruct;
16
17template <template <class...> class T, class... Arg>
18struct FilledStruct<T<Arg...>>
19{
20 static constexpr T<Arg...> run(auto const n)
21 {
22 return T<Arg...> {
23 n * (ddc::type_seq_rank_v<Arg, ddc::detail::TypeSeq<Arg...>> + 42)
24 / (ddc::type_seq_rank_v<Arg, ddc::detail::TypeSeq<Arg...>> + 42)...};
25 }
26};
27
28} // namespace detail
29
30template <class T, class ElementType = std::size_t>
31inline constexpr T filled_struct(ElementType const n = 0)
32{
33 return detail::FilledStruct<T>::run(n);
34}
35
36} // namespace misc
37
38} // namespace sil
constexpr T filled_struct(ElementType const n=0)
The top-level namespace of SimiLie.
Definition csr.hpp:14