From e19fc56d3510bc301f0d8b01dc4d1a193fda0d29 Mon Sep 17 00:00:00 2001 From: Redstone1024 <2824517378@qq.com> Date: Fri, 8 Nov 2024 11:40:13 +0800 Subject: [PATCH] feat(templates): add Num function to TTuple --- Redcraft.Utility/Source/Public/Templates/Tuple.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Redcraft.Utility/Source/Public/Templates/Tuple.h b/Redcraft.Utility/Source/Public/Templates/Tuple.h index e004ffe..6696b97 100644 --- a/Redcraft.Utility/Source/Public/Templates/Tuple.h +++ b/Redcraft.Utility/Source/Public/Templates/Tuple.h @@ -480,6 +480,12 @@ public: template requires (CConstructibleFrom) NODISCARD FORCEINLINE constexpr T Construct() volatile&& { return Helper::template Construct(static_cast< volatile TTuple&&>(*this)); } template requires (CConstructibleFrom) NODISCARD FORCEINLINE constexpr T Construct() const volatile&& { return Helper::template Construct(static_cast(*this)); } + /** @return The number of elements in the tuple. */ + NODISCARD static FORCEINLINE constexpr size_t Num() { return sizeof...(Ts); } + + /** @return true if the tuple is empty, false otherwise. */ + NODISCARD static FORCEINLINE constexpr bool IsEmpty() { return Num() == 0; } + /** Overloads the GetTypeHash algorithm for TTuple. */ NODISCARD friend FORCEINLINE constexpr size_t GetTypeHash(const TTuple& A) requires (true && ... && CHashable) {