-
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
Provide more overloads for the wide string flavour #724
Conversation
This code compiles now and is working fine on my machine:
Should handle issue #721 |
863141c
to
04ba6fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the PR! Looks good, but could you add a few unit tests for the new functions?
@@ -1093,12 +1093,18 @@ class basic_format_args { | |||
|
|||
/** An alias to ``basic_format_args<context>``. */ | |||
// It is a separate type rather than a typedef to make symbols readable. | |||
// It is also required to disambiguate 'vformat_to' overloads | |||
// in core.h and format.h - which seems a bit brittle! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate on the disambiguation part and why you think it's brittle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Victor,
this is probably no longer true. During my various attempts, to replace
template <typename Container>
... vformat_to(std::back_insert_iterator<Container> out,
string_view format_str, format_args args) {
...
}
in core.h by
template <typename Container>
... vformat_to(std::back_insert_iterator<Container> out,
basic_string_view<typename Container::value_type> format_str,
basic_format_args<typename buffer_context<typename Container::value_type>::type> args) {
...
}
to reduce code duplication, I got ambiguous overloads of vformat_to
in core.h
and format.h
. My tests from today show that those more-derived structs don't help me to get along with this problem. Sigh ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is not so much due to basic_format_args
, but due to overloads taking string_view
in format.h
. Unfortunately I don't think it's possible to parameterize on character type there: https://godbolt.org/g/bPevXe.
this is probably no longer true
I've removed the comment then.
04ba6fc
to
4350f1c
Compare
Signed-off-by: Daniela Engert <dani@ngrt.de>
4350f1c
to
d735473
Compare
Do you need more test cases? And if so, where? |
Thanks a lot for adding tests, I think these are fine for now. Merged in 2570f1a with minor tweaks. |
Signed-off-by: Daniela Engert dani@ngrt.de