Conversation
73b240b to
1a282f8
Compare
include/fmt/base.h
Outdated
| else | ||
| #endif | ||
| while (begin != end) *out_++ = *begin++; | ||
| } |
There was a problem hiding this comment.
Let's move the definition to fmt/format.h instead of bringing all the copy machinery here.
|
@user202729 do you still plan to update this PR? |
1a282f8 to
15252c8
Compare
|
Updated. That said, it leads to a bunch of other things such as I can think of a few possibilities such as providing a faster overload in What do you think? Side note, if it makes you feel better, you could just close the PR and comment like "if you want to work on this later you can reopen it", or make a [stale] label and set your pull requests page to by default filter them out. I appreciate that you are very active and keep the number of pending issues and pull requests extraordinarily low. |
c3ef19e to
03ed496
Compare
|
|
||
| // A buffer that writes to an output iterator when flushed. | ||
| template <typename OutputIt, typename T, typename Traits = buffer_traits> | ||
| class iterator_buffer : public Traits, public buffer<T> { |
There was a problem hiding this comment.
I was not suggesting to move iterator_buffer, just the implementation of the function you were modifying. Sorry if it wasn't clear enough.
There was a problem hiding this comment.
If you move only the implementation, but not the interface, won't anything that include base.h but not format.h, get linker error? Besides, there is a header-only compilation option.
You can't just put it in the cpp, since the function is templated (depends on the template parameter OutputIt).
There was a problem hiding this comment.
No, only the consumers who need this will have to include format.h which is OK.
Just a 1-line change to reuse the
fmt::detail::copy()method instead of manually loop over each character. For that, some methods need to be moved around.Demonstration of the speedup in fmtlib/format-benchmark#35 . Arguably
vector<char>is a rare type, but it might be useful for other things (custom string types...?)To make tests pass, I need to check whether the iterator type is move-assignable (
throwing_iteratoris not assignable), although I'd argue that in practice iterators ought to be move-assignable and that test is actually invalid.