From 0b75df992019cd3ace25912f74b6d416926f4a22 Mon Sep 17 00:00:00 2001 From: "Pavel A. Lebedev" Date: Sat, 16 Jul 2016 18:52:10 +0300 Subject: [PATCH] Allow reuse of buffer in reserve with v2 allocator allocation_command uses expand_{fwd,bwd} flags and its result is later compared with the old pointer, but the old pointer was not passed for reuse. --- include/boost/container/vector.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp index 8e5a481..196b8a3 100644 --- a/include/boost/container/vector.hpp +++ b/include/boost/container/vector.hpp @@ -2543,7 +2543,7 @@ class vector //buffer or expand the old one. bool same_buffer_start; size_type real_cap = 0; - pointer reuse = 0; + pointer reuse(this->m_holder.start()); pointer const ret(this->m_holder.allocation_command(allocate_new | expand_fwd | expand_bwd, new_cap, real_cap = new_cap, reuse)); //Check for forward expansion