Browse Source

[common] Common::Size -> std::size (#2910)

Signed-off-by: lizzie <lizzie@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2910
Reviewed-by: crueter <crueter@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Co-authored-by: lizzie <lizzie@eden-emu.dev>
Co-committed-by: lizzie <lizzie@eden-emu.dev>
pull/2912/head
lizzie 2 months ago
committed by crueter
parent
commit
3a54d322ab
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 15
      src/common/common_funcs.h
  2. 6
      src/core/file_sys/fs_path_utility.h

15
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 <class C>
constexpr auto Size(const C& c) -> decltype(c.size()) {
return std::size(c);
}
template <class C>
constexpr std::size_t Size(const C& c) {
if constexpr (sizeof(C) == 0) {
return 0;
} else {
return std::size(c);
}
}
} // namespace Common

6
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<InvalidCharacters, Common::Size(InvalidCharacters)>(c);
return impl::IsInvalidCharacterImpl<InvalidCharacters, std::size(InvalidCharacters)>(c);
}
constexpr bool IsInvalidCharacterForHostName(char c) {
return impl::IsInvalidCharacterImpl<InvalidCharactersForHostName,
Common::Size(InvalidCharactersForHostName)>(c);
std::size(InvalidCharactersForHostName)>(c);
}
constexpr bool IsInvalidCharacterForMountName(char c) {
return impl::IsInvalidCharacterImpl<InvalidCharactersForMountName,
Common::Size(InvalidCharactersForMountName)>(c);
std::size(InvalidCharactersForMountName)>(c);
}
} // namespace StringTraits

Loading…
Cancel
Save