From 246965af79a1bd16fcfd84311cd4b88048f2436c Mon Sep 17 00:00:00 2001 From: _Redstone_c_ Date: Tue, 22 Nov 2022 23:37:31 +0800 Subject: [PATCH] fix(templates): add constexpr specifier to TTuple's lifecycle functions --- .../Source/Public/Templates/Tuple.h | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Redcraft.Utility/Source/Public/Templates/Tuple.h b/Redcraft.Utility/Source/Public/Templates/Tuple.h index 8fe6117..ddab60b 100644 --- a/Redcraft.Utility/Source/Public/Templates/Tuple.h +++ b/Redcraft.Utility/Source/Public/Templates/Tuple.h @@ -219,20 +219,20 @@ protected: TTupleImpl() = default; template - explicit TTupleImpl(FForwardingConstructor, ArgTypes&&... Args) + constexpr explicit TTupleImpl(FForwardingConstructor, ArgTypes&&... Args) : TTupleBasicElement(Forward(Args))... { } template - explicit TTupleImpl(FOtherTupleConstructor, TupleType&& InValue) + constexpr explicit TTupleImpl(FOtherTupleConstructor, TupleType&& InValue) : TTupleBasicElement(Forward(InValue).template GetValue())... { } - TTupleImpl(const TTupleImpl&) = default; - TTupleImpl(TTupleImpl&&) = default; + constexpr TTupleImpl(const TTupleImpl&) = default; + constexpr TTupleImpl(TTupleImpl&&) = default; - TTupleImpl& operator=(const TTupleImpl&) = default; - TTupleImpl& operator=(TTupleImpl&&) = default; + constexpr TTupleImpl& operator=(const TTupleImpl&) = default; + constexpr TTupleImpl& operator=(TTupleImpl&&) = default; }; @@ -310,7 +310,7 @@ private: public: - TTuple() = default; + constexpr TTuple() = default; template requires (sizeof...(Ts) >= 1 && sizeof...(ArgTypes) == sizeof...(Ts)) && (true && ... && CConstructibleFrom) @@ -332,9 +332,9 @@ public: : Super(NAMESPACE_PRIVATE::OtherTupleConstructor, MoveTemp(InValue)) { } - TTuple(const TTuple&) = default; - TTuple(TTuple&&) = default; - + constexpr TTuple(const TTuple&) = default; + constexpr TTuple(TTuple&&) = default; + template requires (sizeof...(OtherTypes) == sizeof...(Ts) && (true && ... && CAssignableFrom)) constexpr TTuple& operator=(const TTuple& InValue) @@ -351,8 +351,8 @@ public: return *this; } - TTuple& operator=(const TTuple&) = default; - TTuple& operator=(TTuple&&) = default; + constexpr TTuple& operator=(const TTuple&) = default; + constexpr TTuple& operator=(TTuple&&) = default; template requires (I < sizeof...(Ts)) constexpr decltype(auto) GetValue() & { return static_cast< NAMESPACE_PRIVATE::TTupleBasicElement>, I>& >(*this).GetValue(); } template requires (I < sizeof...(Ts)) constexpr decltype(auto) GetValue() const & { return static_cast>, I>& >(*this).GetValue(); }