blob: 830806fbb12d70e982fdd9a8c59478aa81cde9fa [file] [log] [blame]
// -*- C++ -*-
/***************************************************************************
*
* type_traits - definition of type_traits types
*
* $Id$
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 2008 Rogue Wave Software, Inc.
*
**************************************************************************/
#ifndef _RWSTD_TYPE_TRAITS_INCLUDED
#define _RWSTD_TYPE_TRAITS_INCLUDED
#include <rw/_defs.h>
#ifdef _RWSTD_NO_EXT_CXX_0X
# error _RWSTD_NO_EXT_CXX_0X defined and C++0x header included
#endif
#include <rw/_meta_help.h>
#include <rw/_meta_cat.h>
#include <rw/_meta_comp.h>
#include <rw/_meta_prop.h>
#include <rw/_meta_rel.h>
#include <rw/_meta_cv.h>
#include <rw/_meta_ref.h>
#include <rw/_meta_sign.h>
#include <rw/_meta_arr.h>
#include <rw/_meta_ptr.h>
#include <rw/_meta_other.h>
_RWSTD_NAMESPACE (std) {
template <class _TypeT, _TypeT _Value>
struct integral_constant
{
typedef integral_constant<_TypeT,_Value> type;
typedef _TypeT value_type;
static const _TypeT value = _Value;
};
#ifndef _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
template<class _TypeT, _TypeT _Value>
const _TypeT integral_constant<_TypeT, _Value>::value;
#endif // _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
typedef integral_constant<bool, true> true_type;
typedef integral_constant<bool, false> false_type;
template <class _TypeT>
struct is_void
: integral_constant<bool, _RW::__rw_is_void<_TypeT>::value>
{
};
template <class _TypeT>
struct is_integral
: integral_constant<bool, _RW::__rw_is_integral<_TypeT>::value>
{
};
template <class _TypeT>
struct is_floating_point
: integral_constant<bool, _RW::__rw_is_floating_point<_TypeT>::value>
{
};
template <class _TypeT>
struct is_array
: integral_constant<bool, _RW::__rw_is_array<_TypeT>::value>
{
};
template <class _TypeT>
struct is_pointer
: integral_constant<bool, _RW::__rw_is_pointer<_TypeT>::value>
{
};
template <class _TypeT>
struct is_lvalue_reference
: integral_constant<bool, _RW::__rw_is_lvalue_reference<_TypeT>::value>
{
};
template <class _TypeT>
struct is_rvalue_reference
: integral_constant<bool, _RW::__rw_is_rvalue_reference<_TypeT>::value>
{
};
template <class _TypeT>
struct is_reference
: integral_constant<bool, _RW::__rw_is_reference<_TypeT>::value>
{
};
template <class _TypeT>
struct is_member_object_pointer
: integral_constant<bool, _RW::__rw_is_member_object_pointer<_TypeT>::value>
{
};
template <class _TypeT>
struct is_member_function_pointer
: integral_constant<bool, _RW::__rw_is_member_function_pointer<_TypeT>::value>
{
};
template <class _TypeT>
struct is_enum
: integral_constant<bool, _RW::__rw_is_enum<_TypeT>::value>
{
};
template <class _TypeT>
struct is_union
: integral_constant<bool, _RW::__rw_is_union<_TypeT>::value >
{
};
template <class _TypeT>
struct is_class
: integral_constant<bool, _RW::__rw_is_class<_TypeT>::value>
{
};
template <class _TypeT>
struct is_function
: integral_constant<bool, _RW::__rw_is_function<_TypeT>::value>
{
};
template <class _TypeT>
struct is_arithmetic
: integral_constant<bool, _RW::__rw_is_arithmetic<_TypeT>::value>
{
};
template <class _TypeT>
struct is_fundamental
: integral_constant<bool, _RW::__rw_is_fundamental<_TypeT>::value>
{
};
template <class _TypeT>
struct is_object
: integral_constant<bool, _RW::__rw_is_object<_TypeT>::value>
{
};
template <class _TypeT>
struct is_scalar
: integral_constant<bool, _RW::__rw_is_scalar<_TypeT>::value>
{
};
template <class _TypeT>
struct is_compound
: integral_constant<bool, _RW::__rw_is_compound<_TypeT>::value>
{
};
template <class _TypeT>
struct is_member_pointer
: integral_constant<bool, _RW::__rw_is_member_pointer<_TypeT>::value>
{
};
template <class _TypeT>
struct is_const
: integral_constant<bool, _RW::__rw_is_const<_TypeT>::value>
{
};
template <class _TypeT>
struct is_volatile
: integral_constant<bool, _RW::__rw_is_volatile<_TypeT>::value>
{
};
template <class _TypeT>
struct is_trivial
: integral_constant<bool, _RW::__rw_is_trivial<_TypeT>::value>
{
};
template <class _TypeT>
struct is_standard_layout
: integral_constant<bool, _RW::__rw_is_standard_layout<_TypeT>::value>
{
};
template <class _TypeT>
struct is_pod
: integral_constant<bool, _RW::__rw_is_pod<_TypeT>::value>
{
};
template <class _TypeT>
struct is_empty
: integral_constant<bool, _RW::__rw_is_empty<_TypeT>::value>
{
};
template <class _TypeT>
struct is_polymorphic
: integral_constant<bool, _RW::__rw_is_polymorphic<_TypeT>::value>
{
};
template <class _TypeT>
struct is_abstract
: integral_constant<bool, _RW::__rw_is_abstract<_TypeT>::value>
{
};
template <class _TypeT>
struct has_trivial_default_constructor
: integral_constant<bool, _RW::__rw_has_trivial_ctor<_TypeT>::value>
{
};
template <class _TypeT>
struct has_trivial_copy_constructor
: integral_constant<bool, _RW::__rw_has_trivial_copy<_TypeT>::value>
{
};
template <class _TypeT>
struct has_trivial_assign
: integral_constant<bool, _RW::__rw_has_trivial_assign<_TypeT>::value>
{
};
template <class _TypeT>
struct has_trivial_destructor
: integral_constant<bool, _RW::__rw_has_trivial_dtor<_TypeT>::value>
{
};
template <class _TypeT>
struct has_nothrow_default_constructor
: integral_constant<bool, _RW::__rw_has_nothrow_ctor<_TypeT>::value>
{
};
template <class _TypeT>
struct has_nothrow_copy_constructor
: integral_constant<bool, _RW::__rw_has_nothrow_copy<_TypeT>::value>
{
};
template <class _TypeT>
struct has_nothrow_assign
: integral_constant<bool, _RW::__rw_has_nothrow_assign<_TypeT>::value>
{
};
template <class _TypeT>
struct has_virtual_destructor
: integral_constant<bool, _RW::__rw_has_virtual_dtor<_TypeT>::value>
{
};
template <class _TypeT>
struct is_signed
: integral_constant<bool, _RW::__rw_is_signed<_TypeT>::value>
{
};
template <class _TypeT>
struct is_unsigned
: integral_constant<bool, _RW::__rw_is_unsigned<_TypeT>::value>
{
};
#ifndef _RWSTD_NO_ALIGN_TRAITS
template <class _TypeT>
struct alignment_of
: integral_constant<_RWSTD_SIZE_T, _RW::__rw_alignment_of<_TypeT>::value>
{
};
#endif // _RWSTD_NO_ALIGN_TRAITS
template <class _TypeT>
struct rank
: integral_constant<_RWSTD_SIZE_T, _RW::__rw_rank<_TypeT>::value>
{
};
template <class _TypeT, unsigned _Bound = 0>
struct extent
: integral_constant<_RWSTD_SIZE_T, _RW::__rw_extent<_TypeT, _Bound>::value>
{
};
template <class _TypeT, class _TypeU>
struct is_same
: integral_constant<bool, _RW::__rw_is_same<_TypeT, _TypeU>::value>
{
};
template <class _TypeT, class _TypeU>
struct is_base_of
: integral_constant<bool, _RW::__rw_is_base_of<_TypeT, _TypeU>::value>
{
};
template <class _TypeT, class _TypeU>
struct is_convertible
: integral_constant<bool, _RW::__rw_is_convertible<_TypeT, _TypeU>::value>
{
};
template <class _TypeT>
struct remove_const
{
typedef typename _RW::__rw_remove_const<_TypeT>::type type;
};
template <class _TypeT>
struct remove_volatile
{
typedef typename _RW::__rw_remove_volatile<_TypeT>::type type;
};
template <class _TypeT>
struct remove_cv
{
typedef typename _RW::__rw_remove_cv<_TypeT>::type type;
};
template <class _TypeT>
struct add_const
{
typedef typename _RW::__rw_add_const<_TypeT>::type type;
};
template <class _TypeT>
struct add_volatile
{
typedef typename _RW::__rw_add_volatile<_TypeT>::type type;
};
template <class _TypeT>
struct add_cv
{
typedef typename _RW::__rw_add_cv<_TypeT>::type type;
};
template <class _TypeT>
struct remove_reference
{
typedef typename _RW::__rw_remove_reference<_TypeT>::type type;
};
template <class _TypeT>
struct add_lvalue_reference
{
typedef typename _RW::__rw_add_lvalue_reference<_TypeT>::type type;
};
template <class _TypeT>
struct add_rvalue_reference
{
typedef typename _RW::__rw_add_rvalue_reference<_TypeT>::type type;
};
template <class _TypeT>
struct make_signed
{
typedef typename _RW::__rw_make_signed<_TypeT>::type type;
};
template <class _TypeT>
struct make_unsigned
{
typedef typename _RW::__rw_make_unsigned<_TypeT>::type type;
};
template <class _TypeT>
struct remove_extent
{
typedef typename _RW::__rw_remove_extent<_TypeT>::type type;
};
template <class _TypeT>
struct remove_all_extents
{
typedef typename _RW::__rw_remove_all_extents<_TypeT>::type type;
};
template <class _TypeT>
struct remove_pointer
{
typedef typename _RW::__rw_remove_pointer<_TypeT>::type type;
};
template <class _TypeT>
struct add_pointer
{
typedef typename _RW::__rw_add_pointer<_TypeT>::type type;
};
#ifndef _RWSTD_NO_ALIGN_TRAITS
template <_RWSTD_SIZE_T _Len,
_RWSTD_SIZE_T _Align = _RW::__rw_default_alignment<_Len>::value>
struct aligned_storage
{
typedef typename _RW::__rw_aligned_storage<_Len, _Align>::type type;
};
# ifndef _RWSTD_NO_VARIADIC_TEMPLATES
template <_RWSTD_SIZE_T _Len, class _TypeT, class... _Types>
struct aligned_union
: _RW::__rw_aligned_union<_Len, _TypeT, _Types...>
{
static const _RWSTD_SIZE_T alignment_value =
_RW::__rw_aligned_union<_Len, _TypeT, _Types...>::_C_align_value;
};
# else // !_RWSTD_NO_VARIADIC_TEMPLATES
template <_RWSTD_SIZE_T _Len,
class _Type1 , class _Type2 = _RW::__rw_empty,
class _Type3 = _RW::__rw_empty, class _Type4 = _RW::__rw_empty,
class _Type5 = _RW::__rw_empty, class _Type6 = _RW::__rw_empty,
class _Type7 = _RW::__rw_empty, class _Type8 = _RW::__rw_empty>
struct aligned_union
: _RW::__rw_aligned_union<_Len,
_Type1, _Type2, _Type3, _Type4,
_Type5, _Type6, _Type7, _Type8>
{
static const _RWSTD_SIZE_T alignment_value =
_RW::__rw_aligned_union<_Len, _Type1, _Type2,
_Type3, _Type4,
_Type5, _Type6,
_Type7, _Type8>::_C_align_value;
};
# endif // !_RWSTD_NO_VARIADIC_TEMPLATES
#endif // !_RWSTD_NO_ALIGN_TRAITS
template <class _TypeT>
struct decay
{
typedef typename _RW::__rw_decay<_TypeT>::type type;
};
template <bool _Enable, class _TypeT = void>
struct enable_if
{
typedef _TypeT type;
};
template <class _TypeT>
struct enable_if<false, _TypeT>
{
};
template <bool _Select, class _TypeT, class _TypeU>
struct conditional
{
typedef typename
_RW::__rw_conditional<_Select, _TypeT, _TypeU>::type type;
};
} // namespace std
#endif // _RWSTD_TYPE_TRAITS_INCLUDED