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
10 
11 // <map>
12 
13 // class multimap
14 
15 // template<typename K>
16 //   size_type count(const K& x) const;        // C++14
17 
18 #include <cassert>
19 #include <map>
20 #include <utility>
21 
22 #include "min_allocator.h"
23 #include "private_constructor.h"
24 #include "test_macros.h"
25 
26 struct Comp {
27   using is_transparent = void;
28 
operator ()Comp29   bool operator()(const std::pair<int, int> &lhs,
30                   const std::pair<int, int> &rhs) const {
31     return lhs < rhs;
32   }
33 
operator ()Comp34   bool operator()(const std::pair<int, int> &lhs, int rhs) const {
35     return lhs.first < rhs;
36   }
37 
operator ()Comp38   bool operator()(int lhs, const std::pair<int, int> &rhs) const {
39     return lhs < rhs.first;
40   }
41 };
42 
main(int,char **)43 int main(int, char**) {
44   std::multimap<std::pair<int, int>, int, Comp> s{
45       {{2, 1}, 1}, {{1, 1}, 2}, {{1, 1}, 3}, {{1, 1}, 4}, {{2, 2}, 5}};
46 
47   auto cnt = s.count(1);
48   assert(cnt == 3);
49 
50   return 0;
51 }
52