mirror of
https://github.com/AntelopeIO/cdt-libcxx.git
synced 2026-07-21 13:53:36 +00:00
66e344fa9b
In particular <__tree> defines many of the same types of traits classes. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@261421 91177308-0d34-0410-b5e6-96231b3b80d8
60 lines
2.3 KiB
C++
60 lines
2.3 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
// Source Licenses. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include <__hash_table>
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#include <type_traits>
|
|
|
|
#include "test_macros.h"
|
|
#include "min_allocator.h"
|
|
|
|
void testKeyValueTrait() {
|
|
{
|
|
typedef int Tp;
|
|
typedef std::__hash_key_value_types<Tp> Traits;
|
|
static_assert((std::is_same<Traits::key_type, int>::value), "");
|
|
static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
|
|
static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
|
|
static_assert(Traits::__is_map == false, "");
|
|
}
|
|
{
|
|
typedef std::pair<int, int> Tp;
|
|
typedef std::__hash_key_value_types<Tp> Traits;
|
|
static_assert((std::is_same<Traits::key_type, Tp>::value), "");
|
|
static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
|
|
static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
|
|
static_assert(Traits::__is_map == false, "");
|
|
}
|
|
{
|
|
typedef std::pair<const int, int> Tp;
|
|
typedef std::__hash_key_value_types<Tp> Traits;
|
|
static_assert((std::is_same<Traits::key_type, Tp>::value), "");
|
|
static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
|
|
static_assert((std::is_same<Traits::__container_value_type, Tp>::value), "");
|
|
static_assert(Traits::__is_map == false, "");
|
|
}
|
|
{
|
|
typedef std::__hash_value_type<int, int> Tp;
|
|
typedef std::__hash_key_value_types<Tp> Traits;
|
|
static_assert((std::is_same<Traits::key_type, int>::value), "");
|
|
static_assert((std::is_same<Traits::mapped_type, int>::value), "");
|
|
static_assert((std::is_same<Traits::__node_value_type, Tp>::value), "");
|
|
static_assert((std::is_same<Traits::__container_value_type,
|
|
std::pair<const int, int> >::value), "");
|
|
static_assert((std::is_same<Traits::__map_value_type,
|
|
std::pair<const int, int> >::value), "");
|
|
static_assert(Traits::__is_map == true, "");
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
testKeyValueTrait();
|
|
}
|