1 #ifndef VCSN_MISC_UNORDERED_SET_HH
2 # define VCSN_MISC_UNORDERED_SET_HH
4 # include <unordered_set>
15 template <
typename Key,
typename Hash,
typename KeyEqual,
typename Alloc>
16 struct hash<unordered_set<Key, Hash, KeyEqual, Alloc>>
18 using type = unordered_set<Key, Hash, KeyEqual, Alloc>;
36 template <
typename Key,
typename Hash,
typename KeyEqual,
typename Alloc>
38 has(
const std::unordered_set<Key, Hash, KeyEqual, Alloc>& s,
const Key& k)
40 return s.find(k) != std::end(s);
44 template <
typename Key,
typename Hash,
typename KeyEqual,
typename Alloc>
45 std::unordered_set<Key, Hash, KeyEqual, Alloc>
46 intersection(
const std::unordered_set<Key, Hash, KeyEqual, Alloc>& s1,
47 const std::unordered_set<Key, Hash, KeyEqual, Alloc>& s2)
49 if (s2.size() < s1.size())
53 std::unordered_set<Key, Hash, KeyEqual, Alloc> res;
54 for (
const auto& e : s1)
63 #endif // !VCSN_MISC_UNORDERED_SET_HH
unordered_set< Key, Hash, KeyEqual, Alloc > type
std::set< T, Compare, Alloc > intersection(const std::set< T, Compare, Alloc > &set1, const std::set< T, Compare, Alloc > &set2)
The intersection of two sets.
size_t operator()(const type &ss) const
bool has(const std::map< Key, Value, Compare, Alloc > &s, const Key &e)