[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / associative / multiset / equal_range_transparent.pass.cpp
blob06b4550933794fef9545ecfed286a58781514375
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 // UNSUPPORTED: c++03, c++11
11 // <set>
13 // class multiset
15 // template<typename K>
16 // pair<iterator,iterator> equal_range(const K& x); //
17 // C++14
18 // template<typename K>
19 // pair<const_iterator,const_iterator> equal_range(const K& x) const; //
20 // C++14
22 #include <cassert>
23 #include <set>
24 #include <utility>
26 struct Comp {
27 using is_transparent = void;
29 bool operator()(const std::pair<int, int> &lhs,
30 const std::pair<int, int> &rhs) const {
31 return lhs < rhs;
34 bool operator()(const std::pair<int, int> &lhs, int rhs) const {
35 return lhs.first < rhs;
38 bool operator()(int lhs, const std::pair<int, int> &rhs) const {
39 return lhs < rhs.first;
43 int main(int, char**) {
44 std::multiset<std::pair<int, int>, Comp> s{{2, 1}, {1, 1}, {1, 1}, {1, 1}, {2, 2}};
46 auto er = s.equal_range(1);
47 long nels = 0;
49 for (auto it = er.first; it != er.second; it++) {
50 assert(it->first == 1);
51 nels++;
54 assert(nels == 3);
56 return 0;