From 070c6be60e0a36920bb91bba89cf92e88354359f Mon Sep 17 00:00:00 2001 From: Andrey Mironov Date: Wed, 28 Jan 2015 19:23:07 +0300 Subject: [PATCH] dbms: add PODArray::resize_fill(size_t, const T&) --- dbms/include/DB/Common/PODArray.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dbms/include/DB/Common/PODArray.h b/dbms/include/DB/Common/PODArray.h index 5e16e49a87b..d819415ceed 100644 --- a/dbms/include/DB/Common/PODArray.h +++ b/dbms/include/DB/Common/PODArray.h @@ -231,6 +231,17 @@ public: c_end = c_start + byte_size(n); } + void resize_fill(size_t n, const T & value) + { + size_t old_size = size(); + if (n > old_size) + { + reserve(n); + std::fill(t_end(), reinterpret_cast(c_end + n - old_size), value); + } + c_end = c_start + byte_size(n); + } + void clear() { c_end = c_start;