Update format.h
optimize loop
This commit is contained in:
parent
e718ec3e93
commit
b3e6d017a5
@ -759,7 +759,7 @@ using is_fast_float = bool_constant<std::numeric_limits<T>::is_iec559 &&
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
template <typename U>
|
template <typename U>
|
||||||
void buffer<T>::append(const U* begin, const U* end) {
|
void buffer<T>::append(const U* begin, const U* end) {
|
||||||
do {
|
while (begin != end) {
|
||||||
auto count = to_unsigned(end - begin);
|
auto count = to_unsigned(end - begin);
|
||||||
try_reserve(size_ + count);
|
try_reserve(size_ + count);
|
||||||
auto free_cap = capacity_ - size_;
|
auto free_cap = capacity_ - size_;
|
||||||
@ -767,7 +767,7 @@ void buffer<T>::append(const U* begin, const U* end) {
|
|||||||
std::uninitialized_copy_n(begin, count, make_checked(ptr_ + size_, count));
|
std::uninitialized_copy_n(begin, count, make_checked(ptr_ + size_, count));
|
||||||
size_ += count;
|
size_ += count;
|
||||||
begin += count;
|
begin += count;
|
||||||
} while (begin != end);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename OutputIt, typename T, typename Traits>
|
template <typename OutputIt, typename T, typename Traits>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user