dice-hash
Hash function for stl types and container
Loading...
Searching...
No Matches
Container_trait.hpp
Go to the documentation of this file.
1#ifndef CONTAINER_TRAIT_H_
2#define CONTAINER_TRAIT_H_
3
11#include <map>
12#include <set>
13#include <type_traits>
14#include <unordered_map>
15#include <unordered_set>
16
17namespace dice::hash {
18
24 template<typename T>
25 struct is_unordered_container : std::false_type {};
26
35 template<class Key, class T, class Hash, class KeyEqual, class Allocator>
36 struct is_unordered_container<std::unordered_map<Key, T, Hash, KeyEqual, Allocator>> : std::true_type {};
37
45 template<class Key, class Hash, class KeyEqual, class Allocator>
46 struct is_unordered_container<std::unordered_set<Key, Hash, KeyEqual, Allocator>> : std::true_type {};
47
52 template<typename T>
54
60 template<typename T>
61 struct is_ordered_container : std::false_type {};
62
70 template<class Key, class T, class Compare, class Allocator>
71 struct is_ordered_container<std::map<Key, T, Compare, Allocator>> : std::true_type {};
72
79 template<class Key, class Compare, class Allocator>
80 struct is_ordered_container<std::set<Key, Compare, Allocator>> : std::true_type {};
81
86 template<typename T>
88
89}// namespace dice::hash
90
91#endif
Home of the DiceHash.
Definition DiceHash.hpp:30
constexpr bool is_unordered_container_v
Helper definition.
Definition Container_trait.hpp:53
constexpr bool is_ordered_container_v
Helper definition.
Definition Container_trait.hpp:87
Typetrait for checking if a type T is an ordered container.
Definition Container_trait.hpp:61
Typetrait for checking if a type T is an unordered container.
Definition Container_trait.hpp:25