Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / containers / unord / unord.map / get_allocator.pass.cpp
blob64836abfff033a3dca85bf7f873a91e48634d85f
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 // <unordered_map>
11 // class unordered_map
13 // allocator_type get_allocator() const
15 #include <unordered_map>
16 #include <cassert>
17 #include <string>
19 #include "test_allocator.h"
20 #include "test_macros.h"
22 int main(int, char**) {
23 typedef std::pair<const int, std::string> ValueType;
25 std::allocator<ValueType> alloc;
26 const std::unordered_map<int, std::string> m(alloc);
27 assert(m.get_allocator() == alloc);
30 other_allocator<ValueType> alloc(1);
31 const std::unordered_map<int, std::string, std::hash<int>,
32 std::equal_to<int>,
33 other_allocator<ValueType> > m(alloc);
34 assert(m.get_allocator() == alloc);
37 return 0;