mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-16 13:21:37 +00:00
Simplify basic_memory_buffer
This commit is contained in:
parent
ed18ca3eae
commit
26bffce66d
@ -749,9 +749,7 @@ class basic_memory_buffer final : public detail::buffer<T> {
|
|||||||
const Allocator& alloc = Allocator())
|
const Allocator& alloc = Allocator())
|
||||||
: alloc_(alloc) {
|
: alloc_(alloc) {
|
||||||
this->set(store_, SIZE);
|
this->set(store_, SIZE);
|
||||||
if (detail::is_constant_evaluated()) {
|
if (detail::is_constant_evaluated()) detail::fill_n(store_, SIZE, T());
|
||||||
detail::fill_n(store_, SIZE, T{});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
FMT_CONSTEXPR20 ~basic_memory_buffer() { deallocate(); }
|
FMT_CONSTEXPR20 ~basic_memory_buffer() { deallocate(); }
|
||||||
|
|
||||||
@ -763,13 +761,8 @@ class basic_memory_buffer final : public detail::buffer<T> {
|
|||||||
size_t size = other.size(), capacity = other.capacity();
|
size_t size = other.size(), capacity = other.capacity();
|
||||||
if (data == other.store_) {
|
if (data == other.store_) {
|
||||||
this->set(store_, capacity);
|
this->set(store_, capacity);
|
||||||
if (detail::is_constant_evaluated()) {
|
|
||||||
detail::copy_str<T>(other.store_, other.store_ + size,
|
detail::copy_str<T>(other.store_, other.store_ + size,
|
||||||
detail::make_checked(store_, capacity));
|
detail::make_checked(store_, capacity));
|
||||||
} else {
|
|
||||||
std::uninitialized_copy(other.store_, other.store_ + size,
|
|
||||||
detail::make_checked(store_, capacity));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this->set(data, capacity);
|
this->set(data, capacity);
|
||||||
// Set pointer to the inline array so that delete is not called
|
// Set pointer to the inline array so that delete is not called
|
||||||
|
Loading…
Reference in New Issue
Block a user