Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
RobinHood.hpp
Go to the documentation of this file.
1// The Reactive C++ Toolbox.
2// Copyright (C) 2013-2019 Swirly Cloud Limited
3// Copyright (C) 2021 Reactive Markets Limited
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
17#ifndef TOOLBOX_UTIL_ROBINHOOD_HPP
18#define TOOLBOX_UTIL_ROBINHOOD_HPP
19
20#pragma GCC diagnostic push
21#pragma GCC diagnostic ignored "-Wstrict-aliasing"
22#include <toolbox/contrib/robin_hood.h>
23#pragma GCC diagnostic pop
24
25namespace toolbox {
26inline namespace util {
27
29template <typename KeyT>
30using RobinHash = robin_hood::hash<KeyT>;
31
36template <typename KeyT, typename ValueT, typename HashT = RobinHash<KeyT>,
37 typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
38using RobinMap = robin_hood::unordered_map<KeyT, ValueT, HashT, KeyEqualT, MaxLoadFactor100N>;
39
41template <typename KeyT, typename ValueT, typename HashT = RobinHash<KeyT>,
42 typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
44 = robin_hood::unordered_flat_map<KeyT, ValueT, HashT, KeyEqualT, MaxLoadFactor100N>;
45
47template <typename KeyT, typename ValueT, typename HashT = RobinHash<KeyT>,
48 typename KeyEqualT = std::equal_to<KeyT>, std::size_t MaxLoadFactor100N = 80>
50 = robin_hood::unordered_node_map<KeyT, ValueT, HashT, KeyEqualT, MaxLoadFactor100N>;
51
56template <typename KeyT, typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>,
57 std::size_t MaxLoadFactor100N = 80>
58using RobinSet = robin_hood::unordered_set<KeyT, HashT, KeyEqualT, MaxLoadFactor100N>;
59
61template <typename KeyT, typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>,
62 std::size_t MaxLoadFactor100N = 80>
63using RobinFlatSet = robin_hood::unordered_flat_set<KeyT, HashT, KeyEqualT, MaxLoadFactor100N>;
64
66template <typename KeyT, typename HashT = RobinHash<KeyT>, typename KeyEqualT = std::equal_to<KeyT>,
67 std::size_t MaxLoadFactor100N = 80>
68using RobinNodeSet = robin_hood::unordered_node_set<KeyT, HashT, KeyEqualT, MaxLoadFactor100N>;
69
70} // namespace util
71} // namespace toolbox
72
73#endif // TOOLBOX_UTIL_ROBINHOOD_HPP
robin_hood::hash< KeyT > RobinHash
Robin Hood hash function template.
Definition RobinHood.hpp:30
robin_hood::unordered_flat_set< KeyT, HashT, KeyEqualT, MaxLoadFactor100N > RobinFlatSet
Robin Hood unordered flat set.
Definition RobinHood.hpp:63
robin_hood::unordered_flat_map< KeyT, ValueT, HashT, KeyEqualT, MaxLoadFactor100N > RobinFlatMap
Robin Hood unordered flat map.
Definition RobinHood.hpp:44
robin_hood::unordered_node_set< KeyT, HashT, KeyEqualT, MaxLoadFactor100N > RobinNodeSet
Robin Hood unordered node set.
Definition RobinHood.hpp:68
robin_hood::unordered_map< KeyT, ValueT, HashT, KeyEqualT, MaxLoadFactor100N > RobinMap
Definition RobinHood.hpp:38
robin_hood::unordered_node_map< KeyT, ValueT, HashT, KeyEqualT, MaxLoadFactor100N > RobinNodeMap
Robin Hood unordered node map.
Definition RobinHood.hpp:50
robin_hood::unordered_set< KeyT, HashT, KeyEqualT, MaxLoadFactor100N > RobinSet
Definition RobinHood.hpp:58