Mark grow as FMT_CONSTEXPR20 (#2630)

resolves https://github.com/fmtlib/fmt/issues/2627
This commit is contained in:
Andrew Corrigan 2021-12-03 10:13:30 -05:00 committed by GitHub
parent 713c7c7c62
commit 6ab73113fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -872,7 +872,7 @@ class iterator_buffer final : public Traits, public buffer<T> {
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<T*, T, fixed_buffer_traits> 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<T*, T, fixed_buffer_traits> final
template <typename T> class iterator_buffer<T*, T> final : public buffer<T> {
protected:
void grow(size_t) override {}
FMT_CONSTEXPR20 void grow(size_t) override {}
public:
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>,
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 <typename T = char> class counting_buffer final : public buffer<T> {
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();

View File

@ -667,7 +667,7 @@ class basic_memory_buffer final : public detail::buffer<T> {
}
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<T> {
};
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
if (size > 5000) throw std::runtime_error("fuzz mode - won't grow that much");
#endif