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 <map> |
12 | #include <string> |
13 | |
14 | #include "associative_container_benchmarks.h" |
15 | #include "../../GenerateInput.h" |
16 | #include "benchmark/benchmark.h" |
17 | |
18 | template <class K, class V> |
19 | struct support::adapt_operations<std::multimap<K, V>> { |
20 | using ValueType = typename std::multimap<K, V>::value_type; |
21 | using KeyType = typename std::multimap<K, V>::key_type; |
22 | static ValueType value_from_key(KeyType const& k) { return {k, Generate<V>::arbitrary()}; } |
23 | static KeyType key_from_value(ValueType const& value) { return value.first; } |
24 | |
25 | using InsertionResult = typename std::multimap<K, V>::iterator; |
26 | static auto get_iterator(InsertionResult const& result) { return result; } |
27 | }; |
28 | |
29 | int main(int argc, char** argv) { |
30 | support::associative_container_benchmarks<std::multimap<int, int>>("std::multimap<int, int>" ); |
31 | |
32 | benchmark::Initialize(&argc, argv); |
33 | benchmark::RunSpecifiedBenchmarks(); |
34 | benchmark::Shutdown(); |
35 | return 0; |
36 | } |
37 | |