// // stringizer.h // serializer // // Created by Sam Jaffe on 3/15/23. // #pragma once #include #include #include #include #include namespace serializer { using ::std::to_string; inline std::string to_string(char const *str) { return str; } inline std::string to_string(std::string const &str) { return str; } inline std::string to_string(std::string_view str) { return std::string(str); } template std::string to_string(T const * t) { return to_string(*t); } template std::string to_string(T const &elem) { if constexpr (std::is_enum_v) { constexpr auto type = magic_enum::as_flags>; return std::string(magic_enum::enum_name(elem)); } else { static_assert(detail::always_false{}); } } }