fix(templates): add constexpr specifier to TTuple's lifecycle functions

This commit is contained in:
_Redstone_c_ 2022-11-22 23:37:31 +08:00
parent 058f07fedc
commit 246965af79

View File

@ -219,20 +219,20 @@ protected:
TTupleImpl() = default;
template <typename... ArgTypes>
explicit TTupleImpl(FForwardingConstructor, ArgTypes&&... Args)
constexpr explicit TTupleImpl(FForwardingConstructor, ArgTypes&&... Args)
: TTupleBasicElement<Ts, Indices>(Forward<ArgTypes>(Args))...
{ }
template <typename TupleType>
explicit TTupleImpl(FOtherTupleConstructor, TupleType&& InValue)
constexpr explicit TTupleImpl(FOtherTupleConstructor, TupleType&& InValue)
: TTupleBasicElement<Ts, Indices>(Forward<TupleType>(InValue).template GetValue<Indices>())...
{ }
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 <typename... ArgTypes> requires (sizeof...(Ts) >= 1 && sizeof...(ArgTypes) == sizeof...(Ts))
&& (true && ... && CConstructibleFrom<Ts, ArgTypes&&>)
@ -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 <typename... OtherTypes> requires (sizeof...(OtherTypes) == sizeof...(Ts)
&& (true && ... && CAssignableFrom<Ts&, const OtherTypes&>))
constexpr TTuple& operator=(const TTuple<OtherTypes...>& 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 <size_t I> requires (I < sizeof...(Ts)) constexpr decltype(auto) GetValue() & { return static_cast< NAMESPACE_PRIVATE::TTupleBasicElement<TTupleElement<I, TTuple<Ts...>>, I>& >(*this).GetValue(); }
template <size_t I> requires (I < sizeof...(Ts)) constexpr decltype(auto) GetValue() const & { return static_cast<const NAMESPACE_PRIVATE::TTupleBasicElement<TTupleElement<I, TTuple<Ts...>>, I>& >(*this).GetValue(); }