News for hackers. Stuff that matters.
Re:C++20 Idioms for Parameter Packs by mgaunard on Wednesday February 28, 2024 @08:31AM (#39537611)
for demonstration purposes only.

  #include <array>
  #include <tuple>

  constexpr std::array<char, 11> itos(unsigned n) {
      std::array<char, 11> s;
      unsigned i = 0;
      while (n) {
          s[i++] = '0' + (n % 10);
          n /= 10;
      }
      s[i] = '\0';
      return s;
  }
  template<auto V>
  struct static_value {
      static constexpr auto value = V;
  };

  template<class T, unsigned N>
  struct tuple_accessor;
  
  template<class...T, unsigned N>
  struct tuple_accessor<std::tuple<T...>, N> {
      static constexpr const char *name = static_value<itos(N)>::value.data();
  };
Re:C++20 Idioms for Parameter Packs by mazieres on Wednesday February 28, 2024 @11:05PM (#39546301)
Your constexpr function is not legal because it doesn't initialize all the array elements, even though the compiler might let you get away with it. That's easily fixed. More importantly, though, your static_value::value is not a const char *.
Re:C++20 Idioms for Parameter Packs by mgaunard on Thursday February 29, 2024 @03:14AM (#39547377)
That restriction was lifted in 2020.

tuple_accessor::name is a const char* which is what you asked for. static_value here is an implementation detail and the type of its members is irrelevant.