-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Format to char*
works for built-in types, but not user types
#793
Comments
Using template <typename FormatContext>
auto format(const ExampleEnum& e, FormatContext& ctx)
{
switch (e)
{
case ExampleEnum::A:
return format_to(ctx.begin(), "A");
case ExampleEnum::B:
return format_to(ctx.begin(), "B");
case ExampleEnum::C:
return format_to(ctx.begin(), "C");
case ExampleEnum::D:
return format_to(ctx.begin(), "D");
};
return format_to(ctx.begin(), "NOT_RECOGNISED");
} I'm not sure if this could cause some issues, though. |
Yes, thank you, however, that isn't an option for me because I want padding and alignment to work like the formatter for |
If I just use |
vitaut
added a commit
that referenced
this issue
Jul 4, 2018
Fixed in c04fb91. Thanks for reporting! |
Thanks, Very kind |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As you can see, I'm trying to use
format_to
to write to a raw pointer. I know that you support 'iterators'. But a raw pointer is an iterator so this should work right? It seems to work for built-in types, but not this user defined formatter that inherits from string_view, as suggested in #787. I tested this on the latest master.The text was updated successfully, but these errors were encountered: