diff --git a/src/util/StaticVector.hxx b/src/util/StaticVector.hxx index 9ac217e84..cbc13dea0 100644 --- a/src/util/StaticVector.hxx +++ b/src/util/StaticVector.hxx @@ -115,10 +115,8 @@ public: /* we don't need to call any destructor */ the_size = 0; } else { - while (!empty()) { - back().~T(); - --the_size; - } + while (!empty()) + pop_back(); } } @@ -207,4 +205,11 @@ public: ::new(&array[the_size]) T(std::forward(args)...); return *Launder(&array[the_size++]); } + + constexpr void pop_back() noexcept { + assert(!empty()); + + back().~T(); + --the_size; + } };