1 | /*
|
---|
2 | * Copyright (c) 2018 Jaroslav Jindrak
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | #ifndef LIBCPP_UNORDERED_SET
|
---|
30 | #define LIBCPP_UNORDERED_SET
|
---|
31 |
|
---|
32 | #include <initializer_list>
|
---|
33 | #include <internal/hash_map.hpp>
|
---|
34 | #include <functional>
|
---|
35 | #include <memory>
|
---|
36 | #include <utility>
|
---|
37 |
|
---|
38 | namespace std
|
---|
39 | {
|
---|
40 | /**
|
---|
41 | * 23.5.6, class template unordered_set:
|
---|
42 | */
|
---|
43 |
|
---|
44 | template<
|
---|
45 | class Key,
|
---|
46 | class Hash = hash<Key>,
|
---|
47 | class Pred = equal_to<Key>,
|
---|
48 | class Alloc = allocator<Key>
|
---|
49 | >
|
---|
50 | class unordered_set;
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * 23.5.7, class template unordered_multiset:
|
---|
54 | */
|
---|
55 |
|
---|
56 | template<
|
---|
57 | class Key
|
---|
58 | class Hash = hash<Key>,
|
---|
59 | class Pred = equal_to<Key>,
|
---|
60 | class Alloc = allocator<Key>
|
---|
61 | >
|
---|
62 | class unordered_multiset;
|
---|
63 |
|
---|
64 | template<class Key, class Hash, class Pred, class Alloc>
|
---|
65 | void swap(unordered_set<Key, Hash, Pred, Alloc>& lhs,
|
---|
66 | unordered_set<Key, Hash, Pred, Alloc>& rhs)
|
---|
67 | noexcept(noexcept(lhs.swap(rhs)))
|
---|
68 | {
|
---|
69 | lhs.swap(rhs);
|
---|
70 | }
|
---|
71 |
|
---|
72 | template<class Key, class Hash, class Pred, class Alloc>
|
---|
73 | void swap(unordered_multiset<Key, Hash, Pred, Alloc>& lhs,
|
---|
74 | unordered_multiset<Key, Hash, Pred, Alloc>& rhs)
|
---|
75 | noexcept(noexcept(lhs.swap(rhs)))
|
---|
76 | {
|
---|
77 | lhs.swap(rhs);
|
---|
78 | }
|
---|
79 |
|
---|
80 | template<class Key, class Hash, class Pred, class Alloc>
|
---|
81 | bool operator==(unordered_set<Key, Hash, Pred, Alloc>& lhs,
|
---|
82 | unordered_set<Key, Hash, Pred, Alloc>& rhs)
|
---|
83 | {
|
---|
84 | // TODO: implement
|
---|
85 | return false;
|
---|
86 | }
|
---|
87 |
|
---|
88 | template<class Key, class Hash, class Pred, class Alloc>
|
---|
89 | bool operator!=(unordered_set<Key, Hash, Pred, Alloc>& lhs,
|
---|
90 | unordered_set<Key, Hash, Pred, Alloc>& rhs)
|
---|
91 | {
|
---|
92 | return !(lhs == rhs);
|
---|
93 | }
|
---|
94 |
|
---|
95 | template<class Key, class Hash, class Pred, class Alloc>
|
---|
96 | bool operator==(unordered_multiset<Key, Hash, Pred, Alloc>& lhs,
|
---|
97 | unordered_multiset<Key, Hash, Pred, Alloc>& rhs)
|
---|
98 | {
|
---|
99 | // TODO: implement
|
---|
100 | return false;
|
---|
101 | }
|
---|
102 |
|
---|
103 | template<class Key, class Value, class Hash, class Pred, class Alloc>
|
---|
104 | bool operator!=(unordered_multiset<Key, Hash, Pred, Alloc>& lhs,
|
---|
105 | unordered_multiset<Key, Hash, Pred, Alloc>& rhs)
|
---|
106 | {
|
---|
107 | return !(lhs == rhs);
|
---|
108 | }
|
---|
109 | }
|
---|
110 |
|
---|
111 | #endif
|
---|