fix gcc build

This commit is contained in:
BlackMATov
2023-01-31 08:16:25 +07:00
parent fcced26218
commit 71b896de16
2 changed files with 18 additions and 8 deletions

View File

@@ -573,9 +573,14 @@ namespace meta_hpp::detail
hashed_string& operator=(hashed_string&&) = default; hashed_string& operator=(hashed_string&&) = default;
hashed_string& operator=(const hashed_string&) = default; hashed_string& operator=(const hashed_string&) = default;
constexpr hashed_string(const char* str) noexcept : hash_{fnv1a_hash(str)} {} constexpr hashed_string(const char* str) noexcept
constexpr hashed_string(std::string_view str) noexcept : hash_{fnv1a_hash(str)} {} : hash_{fnv1a_hash(str)} {}
constexpr hashed_string(const std::string& str) noexcept : hash_{fnv1a_hash(str)} {}
constexpr hashed_string(std::string_view str) noexcept
: hash_{fnv1a_hash(str)} {}
hashed_string(const std::string& str) noexcept
: hash_{fnv1a_hash(str)} {}
constexpr void swap(hashed_string& other) noexcept { constexpr void swap(hashed_string& other) noexcept {
std::swap(hash_, other.hash_); std::swap(hash_, other.hash_);
@@ -609,7 +614,7 @@ namespace std
{ {
template <> template <>
struct hash<meta_hpp::detail::hashed_string> { struct hash<meta_hpp::detail::hashed_string> {
constexpr size_t operator()(meta_hpp::detail::hashed_string hs) const noexcept { size_t operator()(meta_hpp::detail::hashed_string hs) const noexcept {
return hs.get_hash(); return hs.get_hash();
} }
}; };

View File

@@ -50,9 +50,14 @@ namespace meta_hpp::detail
hashed_string& operator=(hashed_string&&) = default; hashed_string& operator=(hashed_string&&) = default;
hashed_string& operator=(const hashed_string&) = default; hashed_string& operator=(const hashed_string&) = default;
constexpr hashed_string(const char* str) noexcept : hash_{fnv1a_hash(str)} {} constexpr hashed_string(const char* str) noexcept
constexpr hashed_string(std::string_view str) noexcept : hash_{fnv1a_hash(str)} {} : hash_{fnv1a_hash(str)} {}
constexpr hashed_string(const std::string& str) noexcept : hash_{fnv1a_hash(str)} {}
constexpr hashed_string(std::string_view str) noexcept
: hash_{fnv1a_hash(str)} {}
hashed_string(const std::string& str) noexcept
: hash_{fnv1a_hash(str)} {}
constexpr void swap(hashed_string& other) noexcept { constexpr void swap(hashed_string& other) noexcept {
std::swap(hash_, other.hash_); std::swap(hash_, other.hash_);
@@ -86,7 +91,7 @@ namespace std
{ {
template <> template <>
struct hash<meta_hpp::detail::hashed_string> { struct hash<meta_hpp::detail::hashed_string> {
constexpr size_t operator()(meta_hpp::detail::hashed_string hs) const noexcept { size_t operator()(meta_hpp::detail::hashed_string hs) const noexcept {
return hs.get_hash(); return hs.get_hash();
} }
}; };