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 // XFAIL: FROZEN-CXX03-HEADERS-FIXME 10 11 #include <__tree> 12 #include <map> 13 #include <set> 14 #include <type_traits> 15 16 #include "test_macros.h" 17 #include "min_allocator.h" 18 19 void testKeyValueTrait() { 20 { 21 typedef int Tp; 22 typedef std::__tree_key_value_types<Tp> Traits; 23 static_assert((std::is_same<Traits::key_type, int>::value), ""); 24 static_assert((std::is_same<Traits::__node_value_type, Tp>::value), ""); 25 static_assert((std::is_same<Traits::__container_value_type, Tp>::value), ""); 26 static_assert(Traits::__is_map == false, ""); 27 } 28 { 29 typedef std::pair<int, int> Tp; 30 typedef std::__tree_key_value_types<Tp> Traits; 31 static_assert((std::is_same<Traits::key_type, Tp>::value), ""); 32 static_assert((std::is_same<Traits::__node_value_type, Tp>::value), ""); 33 static_assert((std::is_same<Traits::__container_value_type, Tp>::value), ""); 34 static_assert(Traits::__is_map == false, ""); 35 } 36 { 37 typedef std::pair<const int, int> Tp; 38 typedef std::__tree_key_value_types<Tp> Traits; 39 static_assert((std::is_same<Traits::key_type, Tp>::value), ""); 40 static_assert((std::is_same<Traits::__node_value_type, Tp>::value), ""); 41 static_assert((std::is_same<Traits::__container_value_type, Tp>::value), ""); 42 static_assert(Traits::__is_map == false, ""); 43 } 44 { 45 typedef std::__value_type<int, int> Tp; 46 typedef std::__tree_key_value_types<Tp> Traits; 47 static_assert((std::is_same<Traits::key_type, int>::value), ""); 48 static_assert((std::is_same<Traits::mapped_type, int>::value), ""); 49 static_assert((std::is_same<Traits::__node_value_type, Tp>::value), ""); 50 static_assert((std::is_same<Traits::__container_value_type, 51 std::pair<const int, int> >::value), ""); 52 static_assert((std::is_same<Traits::__map_value_type, 53 std::pair<const int, int> >::value), ""); 54 static_assert(Traits::__is_map == true, ""); 55 } 56 } 57 58 int main(int, char**) { 59 testKeyValueTrait(); 60 61 return 0; 62 } 63