From c5955db494e1d8c5984487bb857ca1eb85a70e7f Mon Sep 17 00:00:00 2001 From: Ole Erik Peistorpet Date: Mon, 3 Jun 2024 14:03:46 +0200 Subject: [PATCH] Simplified _memOwner by base alias --- dynarray.h | 16 +++++++++------- unit_test/test_classes.h | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dynarray.h b/dynarray.h index d1ee9439..0b7a2ec9 100644 --- a/dynarray.h +++ b/dynarray.h @@ -288,16 +288,18 @@ class dynarray struct _memOwner : public _internBase, public _usedAlloc_7KQw { - using ::oel::_detail::DynarrBase::data; // owner - using ::oel::_detail::DynarrBase::end; - using ::oel::_detail::DynarrBase::reservEnd; + using B = ::oel::_detail::DynarrBase; + + using B::data; // owner + using B::end; + using B::reservEnd; constexpr _memOwner(_argAlloc_7KQw & a) noexcept - : ::oel::_detail::DynarrBase{}, _usedAlloc_7KQw{std::move(a)} { + : B{}, _usedAlloc_7KQw{std::move(a)} { } constexpr _memOwner(_memOwner && other) noexcept - : ::oel::_detail::DynarrBase{other}, _usedAlloc_7KQw{std::move(other)} + : B{other}, _usedAlloc_7KQw{std::move(other)} { other.reservEnd = other.end = other.data = nullptr; } @@ -306,8 +308,8 @@ class dynarray { if (data) { - ::oel::_detail::DebugAllocateWrapper<_usedAlloc_7KQw, value_type *> - ::dealloc(*this, data, static_cast(reservEnd - data)); + auto cap = static_cast(reservEnd - data); + ::oel::_detail::DebugAllocateWrapper<_usedAlloc_7KQw, value_type *>::dealloc(*this, data, cap); } } } diff --git a/unit_test/test_classes.h b/unit_test/test_classes.h index a708e032..d99e4bb6 100644 --- a/unit_test/test_classes.h +++ b/unit_test/test_classes.h @@ -275,7 +275,7 @@ struct TrackingAllocator : TrackingAllocatorBase } // Testing collision with internal names in dynarray - using allocator_type = TrackingAllocatorBase; + using allocator_type = TrackingAllocatorBase; using Alloc = void; struct oel {}; struct _detail {};