Add support for setting and taking ownership on a pointer in UniquePtrList.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-07-25 14:28:00 +02:00
parent 287b50fb2f
commit 5fda89bc72
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 9 additions and 0 deletions

View File

@ -41,6 +41,15 @@ namespace ArbUt {
#endif #endif
return _vector[index]; return _vector[index];
} }
ValueT* TakeOwnership(size_t index) {
auto p = _vector[index];
_vector[index] = nullptr;
return p;
}
void Set(size_t index, ValueT* ptr) {
delete _vector[index];
_vector[index] = ptr;
}
inline void Remove(size_t index) { inline void Remove(size_t index) {
#ifndef NO_ASSERT #ifndef NO_ASSERT