[+] Early reimplementation of string views
This commit is contained in:
parent
16b3c024c8
commit
d2200907da
@ -290,6 +290,17 @@ namespace AuHash
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct equal<AuROString>
|
||||
{
|
||||
using is_transparent = void;
|
||||
|
||||
bool operator()(std::string_view lhs, std::string_view rhs) const
|
||||
{
|
||||
return lhs == rhs;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct equal<std::basic_string<char, std::char_traits<char>, Aurora::Memory::StringAllocator<char>>>
|
||||
{
|
||||
@ -366,6 +377,30 @@ namespace AuHash
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<AuROString>
|
||||
{
|
||||
using is_transparent = void;
|
||||
using transparent_key_equal = equal<std::string>;
|
||||
|
||||
size_t operator()(AuROString txt) const
|
||||
{
|
||||
return hash<std::string_view>{}(txt);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<AuRONString>
|
||||
{
|
||||
using is_transparent = void;
|
||||
using transparent_key_equal = equal<std::string>;
|
||||
|
||||
size_t operator()(AuROString txt) const
|
||||
{
|
||||
return hash<std::string_view>{}(txt);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash<std::basic_string<char, std::char_traits<char>, Aurora::Memory::StringAllocator<char>>>
|
||||
{
|
||||
@ -426,6 +461,19 @@ namespace AuHash
|
||||
{
|
||||
bool operator()(AuRONString lhs, AuRONString rhs) const
|
||||
{
|
||||
#if 0
|
||||
return AuFnv1aRuntime(lhs.data(), lhs.size()) < AuFnv1aRuntime(rhs.data(), rhs.size());
|
||||
#else
|
||||
return hash<std::string_view>{}(AuROString(lhs)) < hash<std::string_view>{}(AuROString(lhs));
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct less<AuROString>
|
||||
{
|
||||
bool operator()(AuROString lhs, AuROString rhs) const
|
||||
{
|
||||
#if 0
|
||||
return AuFnv1aRuntime(lhs.data(), lhs.size()) < AuFnv1aRuntime(rhs.data(), rhs.size());
|
||||
#else
|
||||
|
@ -14,10 +14,18 @@
|
||||
#define AURORA_RUNTIME_MEMCMP std::memcmp
|
||||
#endif
|
||||
|
||||
static auline int AuMemcmp(const void *dest, const void *src, size_t n)
|
||||
{
|
||||
return AURORA_RUNTIME_MEMCMP(dest, src, n);
|
||||
}
|
||||
#if defined(AURORA_RUNTIME_MEMCMP_) && AURORA_RUNTIME_MEMCMP_ == 1
|
||||
|
||||
#define AuMemcmp AURORA_RUNTIME_MEMCMP
|
||||
|
||||
#else
|
||||
|
||||
static auline int AuMemcmp(const void *dest, const void *src, size_t n)
|
||||
{
|
||||
return AURORA_RUNTIME_MEMCMP(dest, src, n);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(AURORA_RUNTIME_MEMSET)
|
||||
#define AURORA_RUNTIME_MEMSET std::memset
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user