1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <unordered_set>
11
12// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
13//           class Alloc = allocator<Value>>
14// class unordered_set
15
16// iterator find(const key_type& k);
17
18#include <unordered_set>
19#include <cassert>
20
21#include "min_allocator.h"
22
23int main()
24{
25    {
26        typedef std::unordered_set<int> C;
27        typedef int P;
28        P a[] =
29        {
30            P(10),
31            P(20),
32            P(30),
33            P(40),
34            P(50),
35            P(60),
36            P(70),
37            P(80)
38        };
39        C c(std::begin(a), std::end(a));
40        C::iterator i = c.find(30);
41        assert(*i == 30);
42        i = c.find(5);
43        assert(i == c.cend());
44    }
45#if TEST_STD_VER >= 11
46    {
47        typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
48        typedef int P;
49        P a[] =
50        {
51            P(10),
52            P(20),
53            P(30),
54            P(40),
55            P(50),
56            P(60),
57            P(70),
58            P(80)
59        };
60        C c(std::begin(a), std::end(a));
61        C::iterator i = c.find(30);
62        assert(*i == 30);
63        i = c.find(5);
64        assert(i == c.cend());
65    }
66#endif
67}
68