llvm-project
43 строки · 1.1 Кб
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//===----------------------------------------------------------------------===//
8
9// UNSUPPORTED: c++03, c++11, c++14, c++17
10
11#include <cassert>
12#include <set>
13
14// <set>
15
16// bool contains(const key_type& x) const;
17
18template <typename T, typename V, typename B, typename... Vals>
19void test(B bad, Vals... args) {
20T set;
21V vals[] = {args...};
22
23for (auto& v : vals) set.insert(v);
24for (auto& v : vals) assert(set.contains(v));
25
26assert(!set.contains(bad));
27}
28
29struct E { int a = 1; double b = 1; char c = 1; };
30
31int main(int, char**)
32{
33{
34test<std::set<int>, int>(14, 10, 11, 12, 13);
35test<std::set<char>, char>('e', 'a', 'b', 'c', 'd');
36}
37{
38test<std::multiset<int>, int>(14, 10, 11, 12, 13);
39test<std::multiset<char>, char>('e', 'a', 'b', 'c', 'd');
40}
41
42return 0;
43}
44