C++ @programming.dev lysdexic @programming.dev 1y ago P2996R4 - Reflection for C++26 isocpp.org Reflection for C++26 1 crossposts InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)HA Hacker News @lemmy.smeargle.fans bot @lemmy.smeargle.fans BOT 1y ago Reflection for C++26 isocpp.org /files/papers/P2996R4.html
“Simple” enum to string template <typename E> requires std::is_enum_v<E> constexpr std::string enum_to_string(E value) { template for (constexpr auto e : std::meta::enumerators_of(^E)) { if (value == [:e:]) { return std::string(std::meta::name_of(e)); } } return "<unnamed>"; } They have taken us for absolute fools.
No requires(requires(...No decltype((auto))No noexcept(noexcept(...To be fair, it's quite an advancement considering what I was expecting.Just about my only question is why the return is a string and not a `string_view``.
C++ feature creep continues...