|
|
|
|
|
by mgaunard
847 days ago
|
|
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();
};
|
|