You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From a quick look at the code it seems to me that expansion statements are only implemented over init-lists and decomposable types. std::vector is not decomposable because of its private members (that's the error you're seeing). The same is the case for std::span<T>, which is why the workaround with define_static_array didn't work either.
A simple workaround would be something along the lines of
template <typename T, T... Vs>
constexprinline T static_array[sizeof...(Vs)] = {Vs...};
constevalautointern(std::ranges::input_range auto&& r){
std::vector args = {^^std::ranges::range_value_t<decltype(r)>};
for (auto e : r) {
args.push_back(std::meta::reflect_value(e));
}
returnsubstitute(^^static_array, args);
}
structFoo {
int a;
int b;
};
intmain(){
consteval {
// error: constexpr variable '[, , , , , ]' must be initialized by a constant expression// error: cannot decompose private member '__begin_' of 'std::vector<meta::info>'//template for (constexpr auto member : nonstatic_data_members_of(^^Foo)) { /* ... */ }template for (constexprauto member : [:intern(nonstatic_data_members_of(^^Foo)):]) {
/* ... */
}
}
}
Is your feature request related to a problem? Please describe.
I was trying to use the
template for
syntax, but it wasn't clear to me from the proposal how and in what contexts it is supposed to work.I am trying this example ...
I get this error
Thank you for the help!
The text was updated successfully, but these errors were encountered: