[mlir][acc] Introduce MappableType interface (#122146)
[llvm-project.git] / libcxx / test / std / containers / unord / unord.set / find_const.pass.cpp
blob96d17873ba697bac505e15a62027f5b9fac1cf08
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <unordered_set>
11 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
12 // class Alloc = allocator<Value>>
13 // class unordered_set
15 // const_iterator find(const key_type& k) const;
17 #include <unordered_set>
18 #include <cassert>
20 #include "test_macros.h"
21 #include "min_allocator.h"
23 int main(int, char**)
26 typedef std::unordered_set<int> C;
27 typedef int P;
28 P a[] =
30 P(10),
31 P(20),
32 P(30),
33 P(40),
34 P(50),
35 P(60),
36 P(70),
37 P(80)
39 const C c(std::begin(a), std::end(a));
40 C::const_iterator i = c.find(30);
41 assert(*i == 30);
42 i = c.find(5);
43 assert(i == c.cend());
45 #if TEST_STD_VER >= 11
47 typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
48 typedef int P;
49 P a[] =
51 P(10),
52 P(20),
53 P(30),
54 P(40),
55 P(50),
56 P(60),
57 P(70),
58 P(80)
60 const C c(std::begin(a), std::end(a));
61 C::const_iterator i = c.find(30);
62 assert(*i == 30);
63 i = c.find(5);
64 assert(i == c.cend());
66 #endif
68 return 0;