40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Copyright 2024 Bloomberg Finance L.P.
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// UNSUPPORTED: c++03 || c++11 || c++14 || c++17 || c++20
|
|
// ADDITIONAL_COMPILE_FLAGS: -freflection
|
|
// ADDITIONAL_COMPILE_FLAGS: -Wno-inconsistent-missing-override
|
|
|
|
// <experimental/reflection>
|
|
//
|
|
// [reflection]
|
|
|
|
#include <meta>
|
|
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
template<typename T>
|
|
consteval std::meta::info make_integer_seq_refl(T N) {
|
|
std::vector args{^^T};
|
|
for (T k = 0; k < N; ++k) {
|
|
args.push_back(std::meta::reflect_constant(k));
|
|
}
|
|
return substitute(^^std::integer_sequence, args);
|
|
}
|
|
|
|
template<typename T, T N>
|
|
using make_integer_sequence = [:make_integer_seq_refl<T>(N):];
|
|
|
|
int main() {
|
|
constexpr auto s = ::make_integer_sequence<size_t, 5>();
|
|
(void) s;
|
|
}
|