Conversation
9778e35 to
73b240b
Compare
73b240b to
1a282f8
Compare
| void flush() { | ||
| auto size = this->size(); | ||
| this->clear(); | ||
| const T* begin = data_; | ||
| const T* end = begin + this->limit(size); | ||
| while (begin != end) *out_++ = *begin++; | ||
| #if defined(__cpp_if_constexpr) | ||
| if constexpr (std::is_move_assignable<OutputIt>::value) | ||
| out_ = copy<T>(begin, end, out_); | ||
| 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
03ed496 to
2e1c57c
Compare
|
I followed the suggestion, and sure enough, What then? Move the tests in |
|
I see, the problems is that the definition of |
2e1c57c to
1a282f8
Compare
|
in retrospect, with #4716 , this wouldn't be too useful. (maybe |
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.