mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-02-04 02:51:18 +01:00
[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>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user