From 3a54d322ab603775bdc26827ae44129416b273c2 Mon Sep 17 00:00:00 2001 From: lizzie Date: Fri, 31 Oct 2025 17:22:44 +0100 Subject: [PATCH] [common] Common::Size -> std::size (#2910) Signed-off-by: lizzie Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2910 Reviewed-by: crueter Reviewed-by: MaranBr Co-authored-by: lizzie Co-committed-by: lizzie --- src/common/common_funcs.h | 15 --------------- src/core/file_sys/fs_path_utility.h | 6 +++--- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 4c5a009ec7..2b8a63bd27 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -128,19 +128,4 @@ namespace Common { u64(g) << 48 | u64(h) << 56; } -// std::size() does not support zero-size C arrays. We're fixing that. -template -constexpr auto Size(const C& c) -> decltype(c.size()) { - return std::size(c); -} - -template -constexpr std::size_t Size(const C& c) { - if constexpr (sizeof(C) == 0) { - return 0; - } else { - return std::size(c); - } -} - } // namespace Common diff --git a/src/core/file_sys/fs_path_utility.h b/src/core/file_sys/fs_path_utility.h index d0060c4fc6..9b6addb64f 100644 --- a/src/core/file_sys/fs_path_utility.h +++ b/src/core/file_sys/fs_path_utility.h @@ -60,15 +60,15 @@ constexpr bool IsInvalidCharacterImpl(char c) { } // namespace impl constexpr bool IsInvalidCharacter(char c) { - return impl::IsInvalidCharacterImpl(c); + return impl::IsInvalidCharacterImpl(c); } constexpr bool IsInvalidCharacterForHostName(char c) { return impl::IsInvalidCharacterImpl(c); + std::size(InvalidCharactersForHostName)>(c); } constexpr bool IsInvalidCharacterForMountName(char c) { return impl::IsInvalidCharacterImpl(c); + std::size(InvalidCharactersForMountName)>(c); } } // namespace StringTraits