1

I have the following code in a file called Console.hpp:

inline std::wstring operator "" _t(const char* s)
{
  std::wstring_convert<codecvt_utf8_utf16<wchar_t>> converter;
  std::wstring wide = converter.from_bytes(s);
  return console::typografix(wide);
}

inline std::wstring operator "" _t(const wchar_t* w, size_t _)
{
  return console::typografix(w);
}

Now, inside Main.cpp, I have an #include "Console.hpp" and am trying to use the suffix

"Like this"_t

Unfortunately I get the following error:

Error C3688 invalid literal suffix '_t'; literal operator or literal operator template 'operator ""_t' not found

Can someone help me figure out what's going on?

Dmitri Nesteruk
  • 23,067
  • 22
  • 97
  • 166

0 Answers0