diff --git a/Redcraft.Utility/Source/Public/Templates/Container.h b/Redcraft.Utility/Source/Public/Templates/Container.h index 976b4d1..0079552 100644 --- a/Redcraft.Utility/Source/Public/Templates/Container.h +++ b/Redcraft.Utility/Source/Public/Templates/Container.h @@ -7,8 +7,8 @@ NAMESPACE_REDCRAFT_BEGIN NAMESPACE_MODULE_BEGIN(Redcraft) NAMESPACE_MODULE_BEGIN(Utility) -/** @return The pointer or iterator to the container element storage. */ -template requires (requires(T&& Container) { Container.GetData(); }) +/** @return The pointer to the container element storage. */ +template requires (requires(T&& Container) { { Container.GetData() } -> CPointer; }) FORCEINLINE constexpr decltype(auto) GetData(T&& Container) { return Container.GetData(); @@ -21,7 +21,7 @@ template FORCEINLINE constexpr const T* GetData(const T(& template FORCEINLINE constexpr const T* GetData(const T(&& Container)[N]) { return Container; } /** Overloads the GetData algorithm for T::data(). */ -template requires (requires(T&& Container) { Container.data(); }) +template requires (requires(T&& Container) { { Container.data() } -> CPointer; }) FORCEINLINE constexpr decltype(auto) GetData(T&& Container) { return Container.data(); @@ -29,13 +29,13 @@ FORCEINLINE constexpr decltype(auto) GetData(T&& Container) /** Overloads the GetData algorithm for initializer_list. */ template -FORCEINLINE constexpr decltype(auto) GetData(initializer_list Container) +FORCEINLINE constexpr const T* GetData(initializer_list Container) { return Container.begin(); } /** @return The number of elements in the container. */ -template requires (requires(T&& Container) { Container.Num(); }) +template requires (requires(T&& Container) { { Container.Num() } -> CConvertibleTo; }) FORCEINLINE constexpr decltype(auto) GetNum(T&& Container) { return Container.Num(); @@ -48,7 +48,7 @@ template FORCEINLINE constexpr size_t GetNum(const T(& C template FORCEINLINE constexpr size_t GetNum(const T(&& Container)[N]) { return N; } /** Overloads the GetNum algorithm for T::size(). */ -template requires (requires(T&& Container) { Container.size(); }) +template requires (requires(T&& Container) { { Container.size() } -> CConvertibleTo; }) FORCEINLINE constexpr decltype(auto) GetNum(T&& Container) { return Container.size(); @@ -56,7 +56,7 @@ FORCEINLINE constexpr decltype(auto) GetNum(T&& Container) /** Overloads the GetNum algorithm for initializer_list. */ template -FORCEINLINE constexpr decltype(auto) GetNum(initializer_list Container) +FORCEINLINE constexpr size_t GetNum(initializer_list Container) { return Container.size(); }