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

truncating_iterator is no std::output_iterator #2156

Closed
burnpanck opened this issue Feb 28, 2021 · 1 comment · Fixed by #2158
Closed

truncating_iterator is no std::output_iterator #2156

burnpanck opened this issue Feb 28, 2021 · 1 comment · Fixed by #2158

Comments

@burnpanck
Copy link

My formatter for a custom type has C++20 delegates to a function that has a requirement template <std::output_iterator<char> It>. Unfortunately, that one fails when used within fmt::format_to_n, because the iterator found in ctx.out() is of type fmt::v6::internal::truncating_iterator<char*, std::false_type>. That one fails to be a std::output_iterator, apparently because it is missing default construction. Potentially, there are other requirements missing.

Is there fundamentally preventing that object from being an output iterator, or has the requirement simply not come up before?

@burnpanck burnpanck changed the title truncating_iterator (and perhaps others) aren't std::output_iterator truncating_iterator is no std::output_iterator Feb 28, 2021
@vitaut
Copy link
Contributor

vitaut commented Feb 28, 2021

Is there fundamentally preventing that object from being an output iterator, or has the requirement simply not come up before?

It hasn't come up before. A PR to make truncating_iterator satisfy output_iterator requirements is welcome.

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

Successfully merging a pull request may close this issue.

2 participants