brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 09412fc Raw
38 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++1710 11#include <unordered_set>12 13#include "associative_container_benchmarks.h"14#include "benchmark/benchmark.h"15 16template <class K>17struct support::adapt_operations<std::unordered_multiset<K>> {18  using ValueType = typename std::unordered_multiset<K>::value_type;19  using KeyType   = typename std::unordered_multiset<K>::key_type;20  static ValueType value_from_key(KeyType const& k) { return k; }21  static KeyType key_from_value(ValueType const& value) { return value; }22 23  using InsertionResult = typename std::unordered_multiset<K>::iterator;24  static auto get_iterator(InsertionResult const& result) { return result; }25 26  template <class Allocator>27  using rebind_alloc = std::unordered_multiset<K, std::hash<K>, std::equal_to<K>, Allocator>;28};29 30int main(int argc, char** argv) {31  support::associative_container_benchmarks<std::unordered_multiset<int>>("std::unordered_multiset<int>");32 33  benchmark::Initialize(&argc, argv);34  benchmark::RunSpecifiedBenchmarks();35  benchmark::Shutdown();36  return 0;37}38