1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include <__tree>
11 #include <map>
12 #include <set>
13 #include <type_traits>
14
15 #include "test_macros.h"
16 #include "min_allocator.h"
17
testKeyValueTrait()18 void testKeyValueTrait() {
19 {
20 typedef int Tp;
21 typedef std::__tree_key_value_types<Tp> Traits;
22 static_assert((std::is_same<Traits::key_type, int>::value), "");
23 static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
24 static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
25 static_assert(Traits::__is_map == false, "");
26 }
27 {
28 typedef std::pair<int, int> Tp;
29 typedef std::__tree_key_value_types<Tp> Traits;
30 static_assert((std::is_same<Traits::key_type, Tp>::value), "");
31 static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
32 static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
33 static_assert(Traits::__is_map == false, "");
34 }
35 {
36 typedef std::pair<const int, int> Tp;
37 typedef std::__tree_key_value_types<Tp> Traits;
38 static_assert((std::is_same<Traits::key_type, Tp>::value), "");
39 static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
40 static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
41 static_assert(Traits::__is_map == false, "");
42 }
43 {
44 typedef std::__value_type<int, int> Tp;
45 typedef std::__tree_key_value_types<Tp> Traits;
46 static_assert((std::is_same<Traits::key_type, int>::value), "");
47 static_assert((std::is_same<Traits::mapped_type, int>::value), "");
48 static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
49 static_assert((std::is_same<Traits::__container_value_type,
50 std::pair<const int, int> >::value), "");
51 static_assert((std::is_same<Traits::__map_value_type,
52 std::pair<const int, int> >::value), "");
53 static_assert(Traits::__is_map == true, "");
54 }
55 }
56
main()57 int main() {
58 testKeyValueTrait();
59 }
60