• @0x0
    link
    324 hours ago

    C++ feature creep continues…

  • @[email protected]
    link
    fedilink
    2
    edit-2
    23 hours ago

    “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.

    • @[email protected]
      link
      fedilink
      English
      119 hours ago

      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``.