diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-05-11 12:13:48 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2018-05-11 14:03:41 +0000 |
commit | 5a852eb51843dc2040c916047349b550aa761451 (patch) | |
tree | c991d17f3b9853420d2e875ce9fab763b24f4b9f /searchlib | |
parent | 30f650c739e824673f173e34e2df7e50d4ad8ea4 (diff) |
Use assignment operator instead of even dirtier memcpy
Diffstat (limited to 'searchlib')
-rw-r--r-- | searchlib/src/vespa/searchlib/common/rcuvector.hpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/searchlib/src/vespa/searchlib/common/rcuvector.hpp b/searchlib/src/vespa/searchlib/common/rcuvector.hpp index 74c61e2d9d3..2b6d9fdc480 100644 --- a/searchlib/src/vespa/searchlib/common/rcuvector.hpp +++ b/searchlib/src/vespa/searchlib/common/rcuvector.hpp @@ -54,8 +54,9 @@ void RcuVectorBase<T>::expand(size_t newCapacity) { std::unique_ptr<Array> tmpData(new Array()); tmpData->reserve(newCapacity); - tmpData->resize(_data.size()); - memcpy(tmpData->begin(), _data.begin(), _data.size() * sizeof(T)); + for (const T & v : _data) { + tmpData->push_back_fast(v); + } tmpData->swap(_data); // atomic switch of underlying data size_t holdSize = tmpData->capacity() * sizeof(T); vespalib::GenerationHeldBase::UP hold(new RcuVectorHeld<Array>(holdSize, std::move(tmpData))); |