hashable
namespace opentl {
template <typename T>
concept hashable = requires(const T& value) {
{ opentl::hash<T>{}(value) } -> opentl::convertible_to<opentl::size_t>;
};
}
Checks if a type is hashable.
Template Parameters
| Name | Description |
|---|---|
T |
The type to hash. |
Example
#include <hash.hpp>
struct foo {};
static_assert(opentl::hashable<int>);
static_assert(opentl::hashable<int*>);
static_assert(!opentl::hashable<foo>);