From 230336fa21bb6c73e06dc2c4c9abcaa9208d6673 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Mon, 23 May 2022 19:21:20 +0000 Subject: Move calcNewSize to implementation file. --- vespalib/src/vespa/vespalib/util/rcuvector.h | 9 ++------- vespalib/src/vespa/vespalib/util/rcuvector.hpp | 10 ++++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'vespalib') diff --git a/vespalib/src/vespa/vespalib/util/rcuvector.h b/vespalib/src/vespa/vespalib/util/rcuvector.h index 1c5cad8ea90..5d084fe3815 100644 --- a/vespalib/src/vespa/vespalib/util/rcuvector.h +++ b/vespalib/src/vespa/vespalib/util/rcuvector.h @@ -49,13 +49,8 @@ private: GrowStrategy _growStrategy; GenerationHolderType &_genHolder; - size_t calcNewSize(size_t baseSize) const { - size_t delta = (baseSize * _growStrategy.getGrowPercent() / 100) + _growStrategy.getGrowDelta(); - return baseSize + std::max(delta, static_cast(1)); - } - size_t calcNewSize() const { - return calcNewSize(_data.capacity()); - } + size_t calcNewSize(size_t baseSize) const; + size_t calcNewSize() const; void expand(size_t newCapacity); void expandAndInsert(const T & v); void update_vector_start(); diff --git a/vespalib/src/vespa/vespalib/util/rcuvector.hpp b/vespalib/src/vespa/vespalib/util/rcuvector.hpp index decaf774e88..3c76ed22471 100644 --- a/vespalib/src/vespa/vespalib/util/rcuvector.hpp +++ b/vespalib/src/vespa/vespalib/util/rcuvector.hpp @@ -17,6 +17,16 @@ RcuVectorHeld::RcuVectorHeld(size_t size, T&& data) template RcuVectorHeld::~RcuVectorHeld() = default; +template +size_t RcuVectorBase::calcNewSize(size_t baseSize) const { + size_t delta = (baseSize * _growStrategy.getGrowFactor()) + _growStrategy.getGrowDelta(); + return baseSize + std::max(delta, static_cast(1)); +} +template +size_t RcuVectorBase::calcNewSize() const { + return calcNewSize(_data.capacity()); +} + template void RcuVectorBase::unsafe_resize(size_t n) { -- cgit v1.2.3