From ed45ac75c1cf3e11b006b2b1cf2d5bd9e6e20327 Mon Sep 17 00:00:00 2001 From: Reece Date: Fri, 25 Mar 2022 22:46:46 +0000 Subject: [PATCH] [+] Strict AuMove/Forward in casts [*] Formatting --- .../auROXTL/Shims/ExtendStlLikeSharedPtr.hpp | 38 +++++++++---------- Include/auROXTL/auCastUtils.hpp | 8 ++-- Include/auROXTL/auTupleUtils.hpp | 3 +- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Include/auROXTL/Shims/ExtendStlLikeSharedPtr.hpp b/Include/auROXTL/Shims/ExtendStlLikeSharedPtr.hpp index 919f5d06..0c1b99f0 100644 --- a/Include/auROXTL/Shims/ExtendStlLikeSharedPtr.hpp +++ b/Include/auROXTL/Shims/ExtendStlLikeSharedPtr.hpp @@ -32,7 +32,7 @@ namespace Aurora::Memory inline IPtrNoOpGet gNoop; } - template + template struct ExSharedPtr : Base_t #if !defined(_AURORA_NULLEXPT_ENABLE_UB) && !defined(_AURORA_NULLEXPT_BRANCH) , private _detail::IPtrGet @@ -71,7 +71,7 @@ namespace Aurora::Memory #endif } - template + template ExSharedPtr(const ExSharedPtr &in) : Base_t(in.BasePointerType(), static_cast(in.get())) { #if !defined(_AURORA_NULLEXPT_ENABLE_UB) @@ -79,7 +79,7 @@ namespace Aurora::Memory #endif } - template + template ExSharedPtr(ExSharedPtr &&in) : Base_t(in.BasePointerType(), static_cast(in.get())) { #if !defined(_AURORA_NULLEXPT_ENABLE_UB) @@ -87,7 +87,7 @@ namespace Aurora::Memory #endif } - template + template ExSharedPtr(ExSharedPtr &&in, element_type *ptr) : Base_t(in.BasePointerType(), ptr) { #if !defined(_AURORA_NULLEXPT_ENABLE_UB) @@ -102,7 +102,7 @@ namespace Aurora::Memory #endif } - template + template ExSharedPtr(const ExSharedPtr &in, element_type *ptr) : Base_t(in.BasePointerType(), ptr) { #if !defined(_AURORA_NULLEXPT_ENABLE_UB) @@ -124,7 +124,7 @@ namespace Aurora::Memory #endif } - template + template ExSharedPtr(Y *in, Deleter_t del, Alloc_t alloc) : Base_t(in, del, alloc) { #if !defined(_AURORA_NULLEXPT_ENABLE_UB) @@ -132,7 +132,7 @@ namespace Aurora::Memory #endif } - template + template ExSharedPtr(Y *in, Deleter_t del) : Base_t(in, del) { #if !defined(_AURORA_NULLEXPT_ENABLE_UB) @@ -140,7 +140,7 @@ namespace Aurora::Memory #endif } - template< class Y, class Deleter > + template < class Y, class Deleter > ExSharedPtr(AURORA_RUNTIME_AU_UNIQUE_PTR &&r) : Base_t(r) { #if !defined(_AURORA_NULLEXPT_ENABLE_UB) @@ -149,7 +149,7 @@ namespace Aurora::Memory } - template + template void swap(ExSharedPtr &in) { Base_t::swap(in.BasePointerType()); @@ -214,7 +214,7 @@ namespace Aurora::Memory return *this; } - template + template ExSharedPtr &operator =(ExSharedPtr &&in) noexcept { Base_t::operator=(AuMove(in.BasePointerType())); @@ -245,7 +245,7 @@ namespace Aurora::Memory return *this; } - template + template ExSharedPtr &operator =(const ExSharedPtr &in) noexcept { Base_t::operator=(in.BasePointerType()); @@ -256,13 +256,13 @@ namespace Aurora::Memory return *this; } - template + template TType2_t &operator*() const { return *operator->(); } - template + template TType2_t *operator->() const { #if defined(_AURORA_NULLEXPT_ENABLE_UB) @@ -275,13 +275,13 @@ namespace Aurora::Memory #endif } - template + template TType2_t &operator*() { return *operator->(); } - template + template TType2_t *operator->() { #if defined(_AURORA_NULLEXPT_ENABLE_UB) @@ -300,13 +300,13 @@ namespace Aurora::Memory } #define ADD_OPERATOR(op) \ - template \ + template \ bool operator op(const T &rhs) noexcept \ { \ return static_cast(*this) op(rhs); \ } \ \ - template< class T > \ + template < class T > \ bool operator op(std::nullptr_t rhs) noexcept \ { \ return static_cast(*this) op(rhs); \ @@ -316,7 +316,7 @@ namespace Aurora::Memory ADD_OPERATOR(==) ADD_OPERATOR(!=) #if defined(AU_LANG_CPP_20) - template< class T > + template < class T > std::strong_ordering operator<=>(const T &rhs) noexcept { return Base_t::operator<=>(rhs); @@ -384,7 +384,7 @@ namespace Aurora::Memory #endif }; - template + template struct ExSharedFromThis : Base_t { ExSharedPtr> SharedFromThis() diff --git a/Include/auROXTL/auCastUtils.hpp b/Include/auROXTL/auCastUtils.hpp index b03d50b2..099e407b 100644 --- a/Include/auROXTL/auCastUtils.hpp +++ b/Include/auROXTL/auCastUtils.hpp @@ -28,13 +28,13 @@ static constexpr AuConditional_t, T, T *> AuStaticCast(Z *other template )> static constexpr AuConditional_t, T, T &> AuStaticCast(Z &other) { - return static_cast, T, T &>>(other); + return static_cast, T, T &>>(AuForward(other)); } template )> static constexpr AuConditional_t, T, T &&> AuStaticCast(Z &&other) { - return static_cast, T, T &&>>(other); + return static_cast, T, T &&>>(AuMove(other)); } template && !AuIsPointer_v)> @@ -52,13 +52,13 @@ static constexpr AuConditional_t, T, T *> AuConstCast(Z *other) template )> static constexpr AuConditional_t, T, T &> AuConstCast(Z &other) { - return const_cast, T, T &>>(other); + return const_cast, T, T &>>(AuForward(other)); } template )> static constexpr AuConditional_t, T, T &&> AuConstCast(Z &&other) { - return const_cast, T, T &&>>(other); + return const_cast, T, T &&>>(AuMove(other)); } template diff --git a/Include/auROXTL/auTupleUtils.hpp b/Include/auROXTL/auTupleUtils.hpp index 2364a351..35023338 100644 --- a/Include/auROXTL/auTupleUtils.hpp +++ b/Include/auROXTL/auTupleUtils.hpp @@ -171,6 +171,7 @@ namespace __audetail template static auto AuTupleTransform(const AuTuple &tuple, const Invokable &translate) { - return __audetail::AuTupleTransformImpl(translate, tuple, + return __audetail::AuTupleTransformImpl(translate, + tuple, AuMakeIndexSequence()); } \ No newline at end of file