Код: Выделить всё
template
void compile_time_index_access(size_t index, F&& f) {
template for(constexpr size_t i : std::ranges::views::iota(from, to)) {
if(i == index) {
f(i);
break;
}
}
}
size_t index = 1;
compile_time_index_access(index,
[] (size_t i) {
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79878950/c-reflection-compile-time-index-access-but-not-with-a-macro[/url]
Мобильная версия