| 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 | // ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated |
| 10 | |
| 11 | // hash_multimap::insert |
| 12 | |
| 13 | #include <cassert> |
| 14 | #include <ext/hash_map> |
| 15 | |
| 16 | int main(int, char**) { |
| 17 | __gnu_cxx::hash_multimap<int, int> map; |
| 18 | |
| 19 | map.insert(obj: std::make_pair(x: 1, y: 1)); |
| 20 | map.insert(obj: std::make_pair(x: 1, y: 1)); |
| 21 | |
| 22 | assert(map.size() == 2); |
| 23 | assert(map.equal_range(1).first == map.begin()); |
| 24 | assert(map.equal_range(1).second == map.end()); |
| 25 | |
| 26 | std::pair<int, int> arr[] = {std::make_pair(x: 1, y: 1), std::make_pair(x: 1, y: 1)}; |
| 27 | |
| 28 | map.insert(f: arr, l: arr + 2); |
| 29 | |
| 30 | assert(map.size() == 4); |
| 31 | assert(map.equal_range(1).first == map.begin()); |
| 32 | assert(map.equal_range(1).second == map.end()); |
| 33 | |
| 34 | return 0; |
| 35 | } |
| 36 | |