hash

namespace opentl {
    template <typename T>
    struct hash;
}

A hash functor used to generate hash codes.

Specializations

Member Function

Name Return Type Description
operator()(T value) opentl::size_t Computes the hash of the value.

Example

#include <hash.hpp>

int main() {
    auto i = opentl::hash<int>{}(123);

    int x = 7;
    auto p = opentl::hash<int*>{}(&x);

    auto n = opentl::hash<opentl::nullptr_t>{}(nullptr);

    return static_cast<int>(i ^ p ^ n);
}