From b71d98774b4fec60e9e0f77f7ed527b2cb4ce784 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 11 Jan 2024 21:22:32 -0800 Subject: [PATCH] Reduce usage of FMT_COSTEXPR20 --- include/fmt/base.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index 137dc1c46164..416d4e10248d 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -810,11 +810,11 @@ template class buffer { protected: // Don't initialize ptr_ since it is not accessed to save a few cycles. FMT_MSC_WARNING(suppress : 26495) - FMT_CONSTEXPR buffer(grow_fun grow, size_t sz) noexcept + FMT_CONSTEXPR20 buffer(grow_fun grow, size_t sz) noexcept : size_(sz), capacity_(sz), grow_(grow) {} - FMT_CONSTEXPR20 buffer(grow_fun grow, T* p = nullptr, size_t sz = 0, - size_t cap = 0) noexcept + constexpr buffer(grow_fun grow, T* p = nullptr, size_t sz = 0, + size_t cap = 0) noexcept : ptr_(p), size_(sz), capacity_(cap), grow_(grow) {} FMT_CONSTEXPR20 ~buffer() = default; @@ -854,7 +854,7 @@ template class buffer { // Tries resizing the buffer to contain *count* elements. If T is a POD type // the new elements may not be initialized. - FMT_CONSTEXPR20 void try_resize(size_t count) { + FMT_CONSTEXPR void try_resize(size_t count) { try_reserve(count); size_ = count <= capacity_ ? count : capacity_; } @@ -863,11 +863,11 @@ template class buffer { // capacity by a smaller amount than requested but guarantees there is space // for at least one additional element either by increasing the capacity or by // flushing the buffer if it is full. - FMT_CONSTEXPR20 void try_reserve(size_t new_capacity) { + FMT_CONSTEXPR void try_reserve(size_t new_capacity) { if (new_capacity > capacity_) grow_(*this, new_capacity); } - FMT_CONSTEXPR20 void push_back(const T& value) { + FMT_CONSTEXPR void push_back(const T& value) { try_reserve(size_ + 1); ptr_[size_++] = value; } @@ -928,7 +928,7 @@ class iterator_buffer : public Traits, public buffer { enum { buffer_size = 256 }; T data_[buffer_size]; - static FMT_CONSTEXPR20 void grow(buffer& buf, size_t) { + static FMT_CONSTEXPR void grow(buffer& buf, size_t) { if (buf.size() == buffer_size) static_cast(buf).flush(); } @@ -968,7 +968,7 @@ class iterator_buffer : public fixed_buffer_traits, enum { buffer_size = 256 }; T data_[buffer_size]; - static FMT_CONSTEXPR20 void grow(buffer& buf, size_t) { + static FMT_CONSTEXPR void grow(buffer& buf, size_t) { if (buf.size() == buf.capacity()) static_cast(buf).flush(); } @@ -1026,7 +1026,7 @@ class iterator_buffer< using value_type = typename container_type::value_type; container_type& container_; - static FMT_CONSTEXPR20 void grow(buffer& buf, size_t capacity) { + static FMT_CONSTEXPR void grow(buffer& buf, size_t capacity) { auto& self = static_cast(buf); self.container_.resize(capacity); self.set(&self.container_[0], capacity); @@ -1048,7 +1048,7 @@ template class counting_buffer : public buffer { T data_[buffer_size]; size_t count_ = 0; - static FMT_CONSTEXPR20 void grow(buffer& buf, size_t) { + static FMT_CONSTEXPR void grow(buffer& buf, size_t) { if (buf.size() != buffer_size) return; static_cast(buf).count_ += buf.size(); buf.clear();