From 2d57549f0c5de2055bf44a57a294c2fbcecaa818 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sat, 2 Apr 2016 13:02:33 -0400 Subject: [PATCH] Define ArrayOf::reinit --- src/MemoryX.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/MemoryX.h b/src/MemoryX.h index fd2ef3942..7c737e382 100644 --- a/src/MemoryX.h +++ b/src/MemoryX.h @@ -364,10 +364,7 @@ public: ArrayOf() {} explicit ArrayOf(size_t count, bool initialize = false) { - if (initialize) - this->reset(safenew X[count]{}); - else - this->reset(safenew X[count]); + reinit(count, initialize); } ArrayOf(const ArrayOf&) = delete; ArrayOf& operator= (ArrayOf &&that) @@ -380,6 +377,14 @@ public: std::unique_ptr::operator=(std::move(that)); return *this; } + + void reinit(size_t count, bool initialize = false) + { + if (initialize) + std::unique_ptr::reset(safenew X[count]{}); + else + std::unique_ptr::reset(safenew X[count]); + } }; /*