string_constant<'H', 'e', 'l', 'l', 'o'>
Sometimes I see C++ code, and I feel deeply sad for the people that are subjected to it. string_constant<'H', 'e', 'l', 'l', 'o'>
Sometimes I see C++ code, and I feel deeply sad for the people that are subjected to it.template<std::size_t N> struct fstr: public std::array<char, N + 1> { using std::array<char, N + 1>::array;
constexpr fstr(const char* str) noexcept : std::array<char, N + 1>() {
for (size_t i = 0; i < N; i++) (*this)[i] = str[i];
}
};template<std::size_t N> fstr(const char (&)[N]) noexcept -> fstr<N - 1>;
template <fstr sz> struct log { log() { std::cout << std::string_view{ sz.data(), sz.size() } << std::endl; } };
int main() { log<"Hello, world!"> _; }