diff options
author | Denis Koronchik <denis@mapswithme.com> | 2014-07-30 13:35:14 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:22:51 +0300 |
commit | 6e78763840c6743bf1417ad50e7fb361a805a0fa (patch) | |
tree | bf49ab189b3799a9b44ea16ffb92fd030257dab3 /base/buffer_vector.hpp | |
parent | 9b93d7da0b8d9c73501bd1865bb336323c7ed625 (diff) |
[optimization] Improve speed of interval index
Diffstat (limited to 'base/buffer_vector.hpp')
-rw-r--r-- | base/buffer_vector.hpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/base/buffer_vector.hpp b/base/buffer_vector.hpp index 01eea4b6bd..3ebb2f4651 100644 --- a/base/buffer_vector.hpp +++ b/base/buffer_vector.hpp @@ -73,6 +73,24 @@ public: m_dynamic.reserve(n); } + void resize_no_init(size_t n) + { + if (m_size == USE_DYNAMIC) + m_dynamic.resize(n); + else + { + if (n <= N) + m_size = n; + else + { + m_dynamic.reserve(n); + SwitchToDynamic(); + m_dynamic.resize(n); + ASSERT_EQUAL(m_dynamic.size(), n, ()); + } + } + } + void resize(size_t n, T c = T()) { if (m_size == USE_DYNAMIC) |