llvm-project
33 строки · 852.0 Байт
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// <set>
10
11// key_compare key_comp() const;
12// value_compare value_comp() const;
13
14#include <set>
15#include <cassert>
16
17int main(int, char**) {
18typedef std::multiset<int> set_type;
19
20set_type s;
21set_type::iterator i1 = s.insert(1);
22set_type::iterator i2 = s.insert(2);
23
24const set_type& cs = s;
25
26assert(cs.key_comp()(*i1, *i2));
27assert(!cs.key_comp()(*i2, *i1));
28
29assert(cs.value_comp()(*i1, *i2));
30assert(!cs.value_comp()(*i2, *i1));
31
32return 0;
33}
34