I have a wrapper around fmt that prints to visual studio debug output. I tried to add wide string support:
template <typename Arg, typename... Args>
void fmt(Arg&& arg, Args&&... args)
{
auto out = fmt::format(arg, args...);
if constexpr (std::is_same<Arg, char8_t*>)
OutputDebugStringA(out.c_str());
else if constexpr (std::is_same<Arg, char16_t*>)
OutputDebugStringW(out.c_str());
else
static_assert(false);
}
But it seems are a lot of different types you might want to match together
const char (&)[N]
, const char*
, char*
etc.
How do you handle this elegantly?