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 time format limited to char #922

Closed
XZiar opened this issue Oct 25, 2018 · 1 comment
Closed

Compile time format limited to char #922

XZiar opened this issue Oct 25, 2018 · 1 comment

Comments

@XZiar
Copy link
Contributor

XZiar commented Oct 25, 2018

I don't know why FMT_STRING is limited to use char only since fmt itself support both char and wchar_t. Is it designed to be that?

There several pieces of code hard coded the char_type:

format_string_traits_base<char> {};

fmt/include/fmt/format.h

Lines 2273 to 2274 in 3e75ad9

internal::check_format_string<char, internal::error_handler, Args...>(
string_view(format_str.data(), format_str.size()));

fmt/include/fmt/format.h

Lines 3684 to 3685 in 3e75ad9

static FMT_CONSTEXPR size_t size() { return sizeof(s); } \
explicit operator fmt::string_view() const { return s; } \

It is easy to solve this problem by adding typedef of char_type in the struct S.

@vitaut
Copy link
Contributor

vitaut commented Oct 26, 2018

Is it designed to be that?

No, just noone generalized it yet. It is indeed easy to solve and PRs are 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