HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
font_grapheme_id.hpp
1// Copyright Take Vos 2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "font_id.hpp"
8#include "grapheme.hpp"
9#include "../hash.hpp"
10
11namespace tt {
12
17 grapheme g;
18
19 [[nodiscard]] size_t hash() const noexcept {
20 return hash_mix(font_id, g);
21 }
22
23 [[nodiscard]] friend bool operator==(font_grapheme_id const &lhs, font_grapheme_id const &rhs) noexcept {
24 return (lhs.font_id == rhs.font_id) && (lhs.g == rhs.g);
25 }
26};
27
28}
29
30namespace std {
31
32template<>
33struct hash<tt::font_grapheme_id> {
34 [[nodiscard]] size_t operator() (tt::font_grapheme_id const &rhs) const noexcept {
35 return rhs.hash();
36 }
37};
38
39}
STL namespace.
Combined font_id + grapheme for use as a key in a std::unordered_map.
Definition font_grapheme_id.hpp:15
Definition grapheme.hpp:21
T operator()(T... args)