SILICON
Loading...
Searching...
No Matches
TransparentStringHash Struct Reference

Transparent hash functor for string-like keys. More...

#include <transparent_string.hpp>

Public Types

using is_transparent = void

Public Member Functions

std::size_t operator() (std::string_view value) const noexcept
std::size_t operator() (const std::string &value) const noexcept
std::size_t operator() (const char *value) const noexcept

Detailed Description

Transparent hash functor for string-like keys.

This helper enables heterogeneous lookup in associative containers keyed by std::string. With it, callers can search the container using std::string_view, std::string, or string literals without first building a temporary std::string.

Typical use: std::unordered_map<std::string, T, TransparentStringHash, TransparentStringEqual>

The is_transparent marker is what tells the standard library that the hash supports mixed lookup key types.

Definition at line 40 of file transparent_string.hpp.

Member Typedef Documentation

◆ is_transparent

using is_transparent = void

Definition at line 41 of file transparent_string.hpp.

Member Function Documentation

◆ operator()() [1/3]

std::size_t operator() ( const char * value) const
inlinenodiscardnoexcept

Definition at line 53 of file transparent_string.hpp.

◆ operator()() [2/3]

std::size_t operator() ( const std::string & value) const
inlinenodiscardnoexcept

Definition at line 48 of file transparent_string.hpp.

◆ operator()() [3/3]

std::size_t operator() ( std::string_view value) const
inlinenodiscardnoexcept

Definition at line 43 of file transparent_string.hpp.


The documentation for this struct was generated from the following file: