From: Hugo van der Merwe <17109322+hugovdm@users.noreply.github.com> Date: Fri, 19 Jun 2020 12:10:17 +0000 (+0200) Subject: ICU-21174 Add adopt*() to MemoryPool and MaybeStackVector X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6130e46ab7dba72247956e5f472c8d12e3bb9d66;p=icu ICU-21174 Add adopt*() to MemoryPool and MaybeStackVector Also add more const-correctness, including getConstAlias(). --- diff --git a/icu4c/source/common/cmemory.h b/icu4c/source/common/cmemory.h index dccbcee9c0e..e628e344b21 100644 --- a/icu4c/source/common/cmemory.h +++ b/icu4c/source/common/cmemory.h @@ -742,8 +742,8 @@ public: * @param status Is set to U_MEMORY_ALLOCATION_ERROR if allocation of the * needed pool capacity fails. */ - template - void adoptBack(T* ptr, UErrorCode& status) { + template + void adopt(T *ptr, UErrorCode &status) { if (U_FAILURE(status)) { return; } @@ -821,7 +821,7 @@ public: * needed pool capacity fails. */ void adoptBack(T *ptr, UErrorCode &status) { - MemoryPool::adoptBack(ptr, status); + this->adopt(ptr, status); } int32_t length() const {