Skip to content

The specializations of hash is declared within the namespace beman #13

@YexuanXiao

Description

@YexuanXiao

I noticed that lines 50 to 61 declare beman::hash and its specializations for cstring_view, while lines 371 to 390 define a set of specialization for std::hash. The former cannot be used because they lack definitions. Is this intentional?

// [cstring.view.hash], hash support
template <class T>
struct hash;
template <>
struct hash<cstring_view>;
template <>
struct hash<u8cstring_view>;
template <>
struct hash<u16cstring_view>;
template <>
struct hash<u32cstring_view>;
template <>
struct hash<wcstring_view>;

template <>
struct std::hash<beman::cstring_view> {
auto operator()(const beman::cstring_view& sv) const noexcept { return std::hash<string_view>{}(sv); }
};
template <>
struct std::hash<beman::u8cstring_view> {
auto operator()(const beman::u8cstring_view& sv) const noexcept { return std::hash<u8string_view>{}(sv); }
};
template <>
struct std::hash<beman::u16cstring_view> {
auto operator()(const beman::u16cstring_view& sv) const noexcept { return std::hash<u16string_view>{}(sv); }
};
template <>
struct std::hash<beman::u32cstring_view> {
auto operator()(const beman::u32cstring_view& sv) const noexcept { return std::hash<u32string_view>{}(sv); }
};
template <>
struct std::hash<beman::wcstring_view> {
auto operator()(const beman::wcstring_view& sv) const noexcept { return std::hash<wstring_view>{}(sv); }
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions