Hi,
If this happens, I'd suggest also adding begin() and end() and operator++ for enums, for this makes them almost trivial and would allow for range-based for() loops over non-sequential enums.
Btw, would the first parameter of std::enum_element<> mean value assigned or position (or would we have both)?
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHK%2B-Fu051CUsD-u%3D%3DXYA5VmEx9ubJTtVQvnNkJ9_XjVTj7qmQ%40mail.gmail.com.
Please take a look at the current proposal for static (compile-time) reflection: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0194r1.htmlOnce in the standard you will be able to achieve such functionality by doing:using meta_foo = reflexpr(foo); // obtains foo's meta-object (internal) representationstatic_assert(std::meta::get_size_v<meta_foo> == 3);
static_assert(std::meta::reflects_same_v<std::meta::get_element_m<0, meta_foo>, reflexpr(foo::bar));static_assert(std::meta::reflects_same_v<std::meta::get_element_m<1, meta_foo>, reflexpr(foo::baz));static_assert(std::meta::reflects_same_v<std::meta::get_element_m<2, meta_foo>, reflexpr(foo::quux));
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHK%2B-FsRq6%2Bv64PePNK44Tn6hX-Xi3NRpUzq%3Dez75KxuML9VcA%40mail.gmail.com.
if tuple's were allowed introspection earlier, why not enums too?