Unverified Commit 6ab73113 authored by Andrew Corrigan's avatar Andrew Corrigan Committed by GitHub

Mark grow as FMT_CONSTEXPR20 (#2630)

resolves https://github.com/fmtlib/fmt/issues/2627
parent 713c7c7c
...@@ -872,7 +872,7 @@ class iterator_buffer final : public Traits, public buffer<T> { ...@@ -872,7 +872,7 @@ class iterator_buffer final : public Traits, public buffer<T> {
T data_[buffer_size]; T data_[buffer_size];
protected: protected:
void grow(size_t) override { FMT_CONSTEXPR20 void grow(size_t) override {
if (this->size() == buffer_size) flush(); if (this->size() == buffer_size) flush();
} }
...@@ -906,7 +906,7 @@ class iterator_buffer<T*, T, fixed_buffer_traits> final ...@@ -906,7 +906,7 @@ class iterator_buffer<T*, T, fixed_buffer_traits> final
T data_[buffer_size]; T data_[buffer_size];
protected: protected:
void grow(size_t) override { FMT_CONSTEXPR20 void grow(size_t) override {
if (this->size() == this->capacity()) flush(); if (this->size() == this->capacity()) flush();
} }
...@@ -944,7 +944,7 @@ class iterator_buffer<T*, T, fixed_buffer_traits> final ...@@ -944,7 +944,7 @@ class iterator_buffer<T*, T, fixed_buffer_traits> final
template <typename T> class iterator_buffer<T*, T> final : public buffer<T> { template <typename T> class iterator_buffer<T*, T> final : public buffer<T> {
protected: protected:
void grow(size_t) override {} FMT_CONSTEXPR20 void grow(size_t) override {}
public: public:
explicit iterator_buffer(T* out, size_t = 0) : buffer<T>(out, 0, ~size_t()) {} explicit iterator_buffer(T* out, size_t = 0) : buffer<T>(out, 0, ~size_t()) {}
...@@ -962,7 +962,7 @@ class iterator_buffer<std::back_insert_iterator<Container>, ...@@ -962,7 +962,7 @@ class iterator_buffer<std::back_insert_iterator<Container>,
Container& container_; Container& container_;
protected: protected:
void grow(size_t capacity) override { FMT_CONSTEXPR20 void grow(size_t capacity) override {
container_.resize(capacity); container_.resize(capacity);
this->set(&container_[0], capacity); this->set(&container_[0], capacity);
} }
...@@ -985,7 +985,7 @@ template <typename T = char> class counting_buffer final : public buffer<T> { ...@@ -985,7 +985,7 @@ template <typename T = char> class counting_buffer final : public buffer<T> {
size_t count_ = 0; size_t count_ = 0;
protected: protected:
void grow(size_t) override { FMT_CONSTEXPR20 void grow(size_t) override {
if (this->size() != buffer_size) return; if (this->size() != buffer_size) return;
count_ += this->size(); count_ += this->size();
this->clear(); this->clear();
......
...@@ -667,7 +667,7 @@ class basic_memory_buffer final : public detail::buffer<T> { ...@@ -667,7 +667,7 @@ class basic_memory_buffer final : public detail::buffer<T> {
} }
protected: protected:
void grow(size_t size) override; FMT_CONSTEXPR20 void grow(size_t size) override;
public: public:
using value_type = T; using value_type = T;
...@@ -753,7 +753,7 @@ class basic_memory_buffer final : public detail::buffer<T> { ...@@ -753,7 +753,7 @@ class basic_memory_buffer final : public detail::buffer<T> {
}; };
template <typename T, size_t SIZE, typename Allocator> template <typename T, size_t SIZE, typename Allocator>
void basic_memory_buffer<T, SIZE, Allocator>::grow(size_t size) { FMT_CONSTEXPR20 void basic_memory_buffer<T, SIZE, Allocator>::grow(size_t size) {
#ifdef FMT_FUZZ #ifdef FMT_FUZZ
if (size > 5000) throw std::runtime_error("fuzz mode - won't grow that much"); if (size > 5000) throw std::runtime_error("fuzz mode - won't grow that much");
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment