libfxd 0.2.dev
A fixed-point library for C++.
Loading...
Searching...
No Matches
hash.hpp
Go to the documentation of this file.
1/*
2 * libfxd - a fixed-point library for C++
3 *
4 * Copyright 2023 Daniel K. O.
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef LIBFXD_HASH_HPP
9#define LIBFXD_HASH_HPP
10
11#include <functional>
12
13#include "concepts.hpp"
14
15
16namespace std {
17
19 template<fxd::fixed_point Fxd>
20 struct hash<Fxd> {
21
23 constexpr
24 size_t
25 operator ()(Fxd f)
26 const noexcept
27 {
28 using H = hash<typename Fxd::raw_type>;
29 return H{}(f.raw_value);
30 }
31
32 };
33
34}
35
36
37#endif
STL namespace.