Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error when using WStringRef with <<bool #16

Closed
fil222 opened this issue Jan 28, 2014 · 1 comment
Closed

Compile error when using WStringRef with <<bool #16

fil222 opened this issue Jan 28, 2014 · 1 comment

Comments

@fil222
Copy link

fil222 commented Jan 28, 2014

Hi, thanks for your library! I'm just evaluating it for logging purposes and came across one problem. When trying wide char version of the format string:

auto x = fmt::str(fmt::Format(L"{}") << true);
or
std::wstring xx = fmt::str(fmt::Format(L"{}") << std::wstring(L"wstring"));

I got compile time error (VC2010), complaining that:

  void Write(const std::basic_string<char> &s, ...) doesn't accept std::basic_string<wchar_t>

works fine once I changed Write method to this:

  template <typename Char>
  void Write(const std::basic_string<Char> &s, const FormatSpec &spec) {
    FormatString(s.data(), s.size(), spec);
  }

The library looks exactly what I was looking for: replacement-based API (without a need to specify type in format string), type-safe, super fast and small.
For logging purposes, however, it would be nice to be able to turn-off exceptions (replaced by debug assert() + "bad format" result?) instead of try/catch the fmt::Format calls. Have you considered header-only version?
Thanks again
Filip Jerabek

@vitaut
Copy link
Contributor

vitaut commented Jan 28, 2014

Thanks for the bug report, this is fixed now.
As for the turning off exceptions or making the library header-only, it is doable, but not on my TODO list at least for the nearest future. However, patches are very welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants