Skip to content

Commit

Permalink
marks grow as FMT_CONSTEXPR20
Browse files Browse the repository at this point in the history
resolves fmtlib#2627
  • Loading branch information
andrewcorrigan committed Dec 3, 2021
1 parent 713c7c7 commit d1e1d9d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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()) {}
Expand All @@ -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);
}
Expand All @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d1e1d9d

Please sign in to comment.