From d1e1d9dc9db0b837ea05a99dce0bd1720bd4876e Mon Sep 17 00:00:00 2001 From: Andrew Corrigan Date: Fri, 3 Dec 2021 08:15:01 -0500 Subject: [PATCH] marks grow as FMT_CONSTEXPR20 resolves https://github.com/fmtlib/fmt/issues/2627 --- include/fmt/core.h | 10 +++++----- include/fmt/format.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index a006b5bb46a8..e87b706c4b85 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -872,7 +872,7 @@ class iterator_buffer final : public Traits, public buffer { T data_[buffer_size]; protected: - void grow(size_t) override { + FMT_CONSTEXPR20 void grow(size_t) override { if (this->size() == buffer_size) flush(); } @@ -906,7 +906,7 @@ class iterator_buffer final T data_[buffer_size]; protected: - void grow(size_t) override { + FMT_CONSTEXPR20 void grow(size_t) override { if (this->size() == this->capacity()) flush(); } @@ -944,7 +944,7 @@ class iterator_buffer final template class iterator_buffer final : public buffer { protected: - void grow(size_t) override {} + FMT_CONSTEXPR20 void grow(size_t) override {} public: explicit iterator_buffer(T* out, size_t = 0) : buffer(out, 0, ~size_t()) {} @@ -962,7 +962,7 @@ class iterator_buffer, Container& container_; protected: - void grow(size_t capacity) override { + FMT_CONSTEXPR20 void grow(size_t capacity) override { container_.resize(capacity); this->set(&container_[0], capacity); } @@ -985,7 +985,7 @@ template class counting_buffer final : public buffer { size_t count_ = 0; protected: - void grow(size_t) override { + FMT_CONSTEXPR20 void grow(size_t) override { if (this->size() != buffer_size) return; count_ += this->size(); this->clear(); diff --git a/include/fmt/format.h b/include/fmt/format.h index e52b7644b1fc..3cf123ee4e10 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -667,7 +667,7 @@ class basic_memory_buffer final : public detail::buffer { } protected: - void grow(size_t size) override; + FMT_CONSTEXPR20 void grow(size_t size) override; public: using value_type = T; @@ -753,7 +753,7 @@ class basic_memory_buffer final : public detail::buffer { }; template -void basic_memory_buffer::grow(size_t size) { +FMT_CONSTEXPR20 void basic_memory_buffer::grow(size_t size) { #ifdef FMT_FUZZ if (size > 5000) throw std::runtime_error("fuzz mode - won't grow that much"); #endif