You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by vi...@apache.org on 2008/06/13 07:53:52 UTC
svn commit: r667365 [2/3] - in /stdcxx/branches/4.3.x: etc/config/src/
include/ include/rw/ tests/utilities/
Added: stdcxx/branches/4.3.x/include/rw/_meta_sign.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_sign.h?rev=667365&view=auto
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_meta_sign.h (added)
+++ stdcxx/branches/4.3.x/include/rw/_meta_sign.h Thu Jun 12 22:53:51 2008
@@ -0,0 +1,291 @@
+/***************************************************************************
+ *
+ * This is an internal header file used to implement the C++ Standard
+ * Library. It should never be #included directly by a program.
+ *
+ * $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_META_TRANS_SIGN_H_INCLUDED
+#define _RWSTD_META_TRANS_SIGN_H_INCLUDED
+
+#include <rw/_defs.h>
+#include <rw/_meta_other.h>
+#include <rw/_meta_rel.h>
+#include <rw/_meta_cv.h>
+#include <rw/_static_assert.h>
+
+_RWSTD_NAMESPACE (__rw) {
+
+/**
+ * Provides typedefs mapping non-boolean integral types to signed
+ * and unsigned integral types of the same base type.
+ */
+template <class _TypeT>
+struct __rw_sign_helper
+{
+ typedef void _C_Sint;
+ typedef void _C_Uint;
+};
+
+template <>
+struct __rw_sign_helper<char>
+{
+ typedef signed char _C_Sint;
+ typedef unsigned char _C_Uint;
+};
+
+template <>
+struct __rw_sign_helper<wchar_t>
+{
+ typedef _RWSTD_SWCHAR_INT_T _C_Sint;
+ typedef _RWSTD_UWCHAR_INT_T _C_Uint;
+};
+
+template <>
+struct __rw_sign_helper<signed char>
+{
+ typedef signed char _C_Sint;
+ typedef unsigned char _C_Uint;
+};
+
+template <>
+struct __rw_sign_helper<unsigned char>
+{
+ typedef signed char _C_Sint;
+ typedef unsigned char _C_Uint;
+};
+
+template <>
+struct __rw_sign_helper<signed short>
+{
+ typedef signed short _C_Sint;
+ typedef unsigned short _C_Uint;
+};
+
+template <>
+struct __rw_sign_helper<unsigned short>
+{
+ typedef signed short _C_Sint;
+ typedef unsigned short _C_Uint;
+};
+
+template <>
+struct __rw_sign_helper<signed int>
+{
+ typedef signed int _C_Sint;
+ typedef unsigned int _C_Uint;
+};
+
+template <>
+struct __rw_sign_helper<unsigned int>
+{
+ typedef signed int _C_Sint;
+ typedef unsigned int _C_Uint;
+};
+
+template <>
+struct __rw_sign_helper<signed long>
+{
+ typedef signed long _C_Sint;
+ typedef unsigned long _C_Uint;
+};
+
+template <>
+struct __rw_sign_helper<unsigned long>
+{
+ typedef signed long _C_Sint;
+ typedef unsigned long _C_Uint;
+};
+
+
+#ifndef _RWSTD_NO_LONG_LONG
+
+template <>
+struct __rw_sign_helper<signed long long>
+{
+ typedef signed long long _C_Sint;
+ typedef unsigned long long _C_Uint;
+};
+
+template <>
+struct __rw_sign_helper<unsigned long long>
+{
+ typedef signed long long _C_Sint;
+ typedef unsigned long long _C_Uint;
+};
+
+#endif // !_RWSTD_NO_LONG_LONG
+
+
+/**
+ * Class template provides typedefs mapping enumeration types to integral
+ * types of the same size.
+ */
+template <_RWSTD_SIZE_T _Size>
+struct __rw_enum_helper
+{
+ typedef void _C_Sint;
+ typedef void _C_Uint;
+};
+
+template <>
+struct __rw_enum_helper<_RWSTD_CHAR_SIZE>
+{
+ typedef signed char _C_Sint;
+ typedef unsigned char _C_Uint;
+};
+
+template <>
+struct __rw_enum_helper<_RWSTD_SHRT_SIZE>
+{
+ typedef signed short _C_Sint;
+ typedef unsigned short _C_Uint;
+};
+
+template <>
+struct __rw_enum_helper<_RWSTD_INT_SIZE>
+{
+ typedef signed int _C_Sint;
+ typedef unsigned int _C_Uint;
+};
+
+#if (_RWSTD_INT_SIZE != _RWSTD_LONG_SIZE)
+
+template <>
+struct __rw_enum_helper<_RWSTD_LONG_SIZE>
+{
+ typedef signed long _C_Sint;
+ typedef unsigned long _C_Uint;
+};
+
+#endif // (_RWSTD_INT_SIZE != _RWSTD_LONG_SIZE)
+
+#ifndef _RWSTD_NO_LONG_LONG
+# if (_RWSTD_LONG_SIZE != _RWSTD_LLONG_SIZE)
+
+template <>
+struct __rw_enum_helper<sizeof (long long)> //_RWSTD_LLONG_SIZE>
+{
+ typedef signed long long _C_Sint;
+ typedef unsigned long long _C_Uint;
+};
+
+# endif // _RWSTD_LONG_SIZE != _RWSTD_LLONG_SIZE
+#endif // !_RWSTD_NO_LONG_LONG
+
+/**
+ * If _TypeT names a (possibly cv-qualified) signed integral type then the
+ * member typedef type shall name the type _TypeT. Otherwise, if _TypeT
+ * names a (possibly cv-qualified) unsigned integral type, then type shall
+ * name the corresponding signed integral type with the same cv-qualifiers
+ * as _TypeT. Otherwise, _TypeT shall name the signed integral type with
+ * the smallest rank for which sizeof(_TypeT) == sizeof(_C_type), with the
+ * same cv-qualifiers as _TypeT.
+ *
+ * note requires _TypeT shall be a (possibly cv-qualified) integral or
+ * enum type, but not a bool type.
+ */
+template <class _TypeT>
+struct __rw_make_signed
+{
+private:
+ //_RWSTD_STATIC_ASSERT ( __rw_is_integral<_TypeT>::value
+ // || __rw_is_enum<_TypeT>::value);
+
+ typedef typename __rw_remove_cv<_TypeT>::type _NoCV_TypeT;
+
+ //_RWSTD_STATIC_ASSERT (!__rw_is_same<_NoCV_TypeT, bool>::value);
+
+ typedef typename
+ __rw_conditional<__rw_is_integral<_NoCV_TypeT>::value,
+ typename __rw_sign_helper<_NoCV_TypeT>::_C_Sint,
+ typename __rw_enum_helper< sizeof (_TypeT) >::_C_Sint
+ >::type _NoCV_TypeU;
+
+ typedef typename
+ __rw_conditional<__rw_is_const<_TypeT>::value,
+ typename __rw_add_const<_NoCV_TypeU>::type,
+ _NoCV_TypeU>::type _NoV_TypeU;
+
+ typedef typename
+ __rw_conditional<__rw_is_volatile<_TypeT>::value,
+ typename __rw_add_volatile<_NoV_TypeU>::type,
+ _NoV_TypeU>::type _TypeU;
+
+public:
+ typedef _TypeU type;
+};
+
+//#define _RWSTD_MAKE_SIGNED(T) typename _RW::__rw_make_signed<T>::type
+
+/**
+ * If _TypeT names a (possibly cv-qualified) unsigned integral type then the
+ * member typedef type shall name the type _TypeT. Otherwise, if _TypeT
+ * names a (possibly cv-qualified) ununsigned integral type, then type shall
+ * name the corresponding unsigned integral type with the same cv-qualifiers
+ * as _TypeT. Otherwise, _TypeT shall name the unsigned integral type with
+ * the smallest rank for which sizeof(_TypeT) == sizeof(_C_type), with the
+ * same cv-qualifiers as _TypeT.
+ *
+ * note requires _TypeT shall be a (possibly cv-qualified) integral or
+ * enum type, but not a bool type.
+ */
+template <class _TypeT>
+struct __rw_make_unsigned
+{
+private:
+ //_RWSTD_STATIC_ASSERT ( __rw_is_integral<_TypeT>::value
+ // || __rw_is_enum<_TypeT>::value);
+
+ typedef typename __rw_remove_cv<_TypeT>::type _NoCV_TypeT;
+
+ //_RWSTD_STATIC_ASSERT (!__rw_is_same<_NoCV_TypeT, bool>::value);
+
+ typedef typename
+ __rw_conditional<__rw_is_integral<_NoCV_TypeT>::value,
+ typename __rw_sign_helper<_NoCV_TypeT>::_C_Uint,
+ typename __rw_enum_helper< sizeof (_TypeT) >::_C_Uint
+ >::type _NoCV_TypeU;
+
+ typedef typename
+ __rw_conditional<__rw_is_const<_TypeT>::value,
+ typename __rw_add_const<_NoCV_TypeU>::type,
+ _NoCV_TypeU>::type _NoV_TypeU;
+
+ typedef typename
+ __rw_conditional<__rw_is_volatile<_TypeT>::value,
+ typename __rw_add_volatile<_NoV_TypeU>::type,
+ _NoV_TypeU>::type _TypeU;
+
+public:
+ typedef _TypeU type;
+};
+
+//#define _RWSTD_MAKE_UNSIGNED(T) typename _RW::__rw_make_unsigned<T>::type
+
+} // namespace __rw
+
+
+#endif // _RWSTD_META_TRANS_SIGN_H_INCLUDED
Propchange: stdcxx/branches/4.3.x/include/rw/_meta_sign.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: stdcxx/branches/4.3.x/include/rw/_meta_sign.h
------------------------------------------------------------------------------
svn:keywords = Id
Added: stdcxx/branches/4.3.x/include/rw/_static_assert.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_static_assert.h?rev=667365&view=auto
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_static_assert.h (added)
+++ stdcxx/branches/4.3.x/include/rw/_static_assert.h Thu Jun 12 22:53:51 2008
@@ -0,0 +1,66 @@
+/***************************************************************************
+ *
+ * This is an internal header file used to implement the C++ Standard
+ * Library. It should never be #included directly by a program.
+ *
+ * $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_RW_STATIC_ASSERT_H_INCLUDED
+#define _RWSTD_RW_STATIC_ASSERT_H_INCLUDED
+
+#include <rw/_defs.h>
+
+_RWSTD_NAMESPACE (__rw) {
+
+/**
+ * Template used to perform compile time assertions at class or global scope.
+ */
+template <bool _Cond>
+struct __rw_static_assert
+{
+};
+
+template <bool _Cond>
+struct __rw_assert_failed;
+
+template <>
+struct __rw_assert_failed<true>
+{
+};
+
+} // namespace __rw
+
+#ifndef _RWSTD_NO_STATIC_ASSERT
+
+# define _RWSTD_STATIC_ASSERT(Cond) \
+ typedef \
+ _RW::__rw_static_assert<sizeof (__rw_assert_failed<(Cond)>) != 0> \
+ _RWSTD_PASTE(__static_assert,__LINE__)
+
+#else
+# define _RWSTD_STATIC_ASSERT(Cond,Mesg) static_assert(Cond, Mesg)
+#endif // _RWSTD_NO_STATIC_ASSERT
+
+#endif // _RWSTD_RW_STATIC_ASSERT_H_INCLUDED
Propchange: stdcxx/branches/4.3.x/include/rw/_static_assert.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: stdcxx/branches/4.3.x/include/rw/_static_assert.h
------------------------------------------------------------------------------
svn:keywords = Id
Modified: stdcxx/branches/4.3.x/include/type_traits
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/type_traits?rev=667365&r1=667364&r2=667365&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/type_traits (original)
+++ stdcxx/branches/4.3.x/include/type_traits Thu Jun 12 22:53:51 2008
@@ -32,17 +32,172 @@
#include <rw/_defs.h>
-#ifndef _RWSTD_NO_EXT_CXX_0X
+#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) {
/**
+ * @defgroup meta_help Helper classes [meta.help]
+ */
+
+/**
+ * @defgroup meta_unary Unary Type Traits [meta.unary]
+ *
+ * A UnaryTypeTrait describes a property of a type. It shall be a
+ * class template that takes one template type argument and, optionally,
+ * additional arguments that help define the property being described.
+ * It shall be DefaultConstructible, CopyConstructible, and publicly
+ * derived, directly or indirectly, from a specialization of the template
+ * integral_constant, with the arguments to the template integral_constant
+ * determined by the requirements for the particular property being
+ * described.
+ *
+ * This sub-clause contains templates that may be used to query the
+ * properties of a type at compile time.
+ *
+ * Each of these templates shall be a UnaryTypeTrait, publicly derived
+ * directly or indirectly from true_type if the corresponding condition
+ * is true, otherwise from false_type.
+ */
+
+/**
+ * @defgroup meta_unary_cat Primary Type Categories [meta.unary.cat]
+ * @ingroup meta_unary
+ *
+ * These type categories correspond to the descriptions given in section
+ * [basic.types] of the C++ standard.
+ *
+ * For any given type T, the result of applying one of these templates
+ * to T and to cv-qualified T shall yield the same result.
+ *
+ * @note For any given type T, exactly one of the primary type
+ * categories has a \c value member that evaluates to true.
+ */
+
+/**
+ * @defgroup meta_unary_comp Composite Type Categories [meta.unary.comp]
+ * @ingroup meta_unary
+ *
+ * These templates provide convenient compositions of the primary type
+ * categories.
+ *
+ * For any given type T, the result of applying one of these templates
+ * to T, and to cv-qualified T shall yield the same result.
+ */
+
+/**
+ * @defgroup meta_unary_prop Type Properties [meta.unary.prop]
+ * @ingroup meta_unary
+ *
+ * These templates provide access to some of the more important properties
+ * of types.
+ *
+ * It is unspecified whether the library defines any full or partial
+ * specialisations of any of these templates. A program may specialise
+ * any of these templates on a user-defined type, provided the semantics
+ * of the specialisation match those given for the template in its
+ * description.
+ *
+ * For all of the class templates X declared in this clause, instantiating
+ * that template with a template-argument that is a class template
+ * specialization may result in the implicit instantiation of the template
+ * argument if and only if the semantics of X require that the argument
+ * must be a complete type.
+ */
+
+/**
+ * @defgroup meta_rel Relationships between types [meta.rel]
+ *
+ * This sub-clause contains templates that may be used to query
+ * relationships between types at compile time.
+ *
+ * Each of these templates shall be a BinaryTypeTrait, publicly
+ * derived directly or indirectly from true_type if the
+ * corresponding condition is true, otherwise from false_type.
+ */
+
+/**
+ * @defgroup meta_trans Transformations between types [meta.trans]
+ *
+ * A TransformationTrait modifies a property of a type. It shall
+ * be a class template that takes one template type argument and,
+ * optionally, additional arguments that help define the modification.
+ * It shall define a nested type named type, which shall be a synonym
+ * for the modified type.
+ *
+ * This sub-clause contains templates that may be used to transform
+ * one type to another following some predefined rule.
+ *
+ * Each of the templates in this subclause shall be a
+ * TransformationTrait.
+ */
+
+/**
+ * @defgroup meta_trans_cv Const-volatile modifications [meta.trans.cv]
+ * @ingroup meta_trans
+ *
+ * This sub-clause contains templates used to add and remove const
+ * and volatile qualifiers from types.
+ */
+
+/**
+ * @defgroup meta_trans_ref Reference modification [meta.trans.ref]
+ * @ingroup meta_trans
+ *
+ * This sub-clause contains templates used to add and remove reference
+ * semantics from types.
+ */
+
+/**
+ * @defgroup meta_trans_sign Sign modifications [meta.trans.sign]
+ * @ingroup meta_trans
+ *
+ * This sub-clause contains templates used to transform from signed
+ * to unsigned representation or vice-versa.
+ */
+
+/**
+ * @defgroup meta_trans_arr Array modifications [meta.trans.arr]
+ * @ingroup meta_trans
+ *
+ * This sub-clause contains templates used to manage array types.
+ */
+
+/**
+ * @defgroup meta_trans_pointer Pointer modifications [meta.trans.ptr]
+ * @ingroup meta_trans
+ *
+ * This sub-clause contains templates used to manage pointer types.
+ */
+
+/**
+ * @defgroup meta_trans_other Other transformations [meta.trans.other]
+ * @ingroup meta_trans
+ */
+
+/**
+ * @ingroup meta_help
+ *
* The class template integral_constant and its associated typedefs
* true_type and false_type are used as base classes to define the
* interface for various type traits.
*/
template <class _TypeT, _TypeT _Value>
-struct integral_constant
+struct integral_constant : _RW::__rw_integral_constant<_TypeT, _Value>
{
/**
* Describes the type of this integral_constant.
@@ -54,10 +209,10 @@
*/
typedef _TypeT value_type;
- /**
- * The actual integral constant value.
- */
- static const _TypeT value = _Value;
+ ///**
+ // * The actual integral constant value.
+ // */
+ //static const _TypeT value = _Value;
};
#ifndef _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
@@ -68,19 +223,907 @@
#endif // _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
/**
- * Convenience typedef that is intended to be used as a base class
+ * @ingroup meta_help
+ *
+ * Convenience typedef that are intended to be used as a base class
* for boolean type traits that are true.
*/
typedef integral_constant<bool, true> true_type;
/**
- * Convenience typedef that is intended to be used as a base class
+ * @ingroup meta_help
+ *
+ * Convenience typedef that are intended to be used as a base class
* for boolean type traits that are false.
*/
typedef integral_constant<bool, false> false_type;
-} // namespace std
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is void or a cv-qualified void.
+ */
+template <class _TypeT>
+struct is_void
+ : integral_constant<bool, _RW::__rw_is_void<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is an integral type.
+ *
+ * Types \c bool, \c char, \c wchar_t, and the signed and unsigned integer
+ * types are collectively called integral types. The signed and unsigned
+ * integer types include signed and unsigned versions of \c char, \c short,
+ * \c int, \c long and \c long \c long.
+ */
+template <class _TypeT>
+struct is_integral
+ : integral_constant<bool, _RW::__rw_is_integral<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * * \e UnaryTypeTrait to determine if _TypeT is a floating point type.
+ *
+ * Types \c float, \c double, \c long \c double, and cv-qualified versions
+ * of those types make up the set of floating point types.
+ */
+template <class _TypeT>
+struct is_floating_point
+ : integral_constant<bool, _RW::__rw_is_floating_point<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is an array type.
+ */
+template <class _TypeT>
+struct is_array
+ : integral_constant<bool, _RW::__rw_is_array<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a pointer type.
+ *
+ * Includes function pointers, but not pointers to non-static member
+ * functions.
+ */
+template <class _TypeT>
+struct is_pointer
+ : integral_constant<bool, _RW::__rw_is_pointer<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is an lvalue reference type.
+ */
+template <class _TypeT>
+struct is_lvalue_reference
+ : integral_constant<bool, _RW::__rw_is_lvalue_reference<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is an rvalue reference type.
+ */
+template <class _TypeT>
+struct is_rvalue_reference
+ : integral_constant<bool, _RW::__rw_is_rvalue_reference<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a reference type.
+ *
+ * Includes references to functions.
+ */
+template <class _TypeT>
+struct is_reference
+ : integral_constant<bool, _RW::__rw_is_reference<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a pointer to non-static
+ * member pointer.
+ */
+template <class _TypeT>
+struct is_member_object_pointer
+ : integral_constant<bool, _RW::__rw_is_member_object_pointer<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a pointer to non-static
+ * member function.
+ */
+template <class _TypeT>
+struct is_member_function_pointer
+ : integral_constant<bool, _RW::__rw_is_member_function_pointer<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is an enumeration type.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct is_enum
+ : integral_constant<bool, _RW::__rw_is_enum<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a union type
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct is_union
+ : integral_constant<bool, _RW::__rw_is_union<_TypeT>::value >
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a class type but not
+ * a union type.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ *
+ * @note a C++ struct is of class type.
+ */
+template <class _TypeT>
+struct is_class
+ : integral_constant<bool, _RW::__rw_is_class<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_cat
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a function type.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct is_function
+ : integral_constant<bool, _RW::__rw_is_function<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_comp
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is an arithmetic type.
+ *
+ * Arithmetic types include both integral and floating point types.
+ */
+template <class _TypeT>
+struct is_arithmetic
+ : integral_constant<bool, _RW::__rw_is_arithmetic<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_comp
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a fundamental type.
+ *
+ * Fundamental types are all the types provided natively. These types include
+ * all arithmetic types and all void types.
+ */
+template <class _TypeT>
+struct is_fundamental
+ : integral_constant<bool, _RW::__rw_is_fundamental<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_comp
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is an object type.
+ *
+ * An object type is a (possibly cv-qualified) type that is not a function
+ * type, not a reference type, and not a void type.
+ */
+template <class _TypeT>
+struct is_object
+ : integral_constant<bool, _RW::__rw_is_object<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_comp
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a scalar type.
+ *
+ * Arithmetic types, enumeration types, pointer types, pointer to member
+ * types, and cv-qualified versions of these types are collectively called
+ * scalar types.
+ */
+template <class _TypeT>
+struct is_scalar
+ : integral_constant<bool, _RW::__rw_is_scalar<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_comp
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a compound type.
+ *
+ * Compound types are arrays, functions, pointers, references, classes
+ * unions, enumerations and pointers to non-static class members.
+ */
+template <class _TypeT>
+struct is_compound
+ : integral_constant<bool, _RW::__rw_is_compound<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_comp
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a pointer to a member
+ * object or pointer to member function type.
+ */
+template <class _TypeT>
+struct is_member_pointer
+ : integral_constant<bool, _RW::__rw_is_member_pointer<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is const-qualified.
+ */
+template <class _TypeT>
+struct is_const
+ : integral_constant<bool, _RW::__rw_is_const<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is volatile-qualified.
+ */
+template <class _TypeT>
+struct is_volatile
+ : integral_constant<bool, _RW::__rw_is_volatile<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a trivial type.
+ *
+ * _TypeT shall be a complete type, an array of unknown bound, or
+ * possibly cv-qualified void.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct is_trivial
+ : integral_constant<bool, _RW::__rw_is_trivial<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a type with standard
+ * layout.
+ *
+ * _TypeT shall be a complete type, an array of unknown bound, or
+ * possibly cv-qualified void.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct is_standard_layout
+ : integral_constant<bool, _RW::__rw_is_standard_layout<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a plain-old-data type.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct is_pod
+ : integral_constant<bool, _RW::__rw_is_pod<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is an empty class.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct is_empty
+ : integral_constant<bool, _RW::__rw_is_empty<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a polymorphic class.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct is_polymorphic
+ : integral_constant<bool, _RW::__rw_is_polymorphic<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is an abstract class.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct is_abstract
+ : integral_constant<bool, _RW::__rw_is_abstract<_TypeT>::value>
+{
+};
-#endif // _RWSTD_NO_EXT_CXX_0X
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a trivial type or a
+ * class type with a trivial default constructor, or an array of
+ * such a class type.
+ *
+ * _TypeT shall be a complete type, an array of unknown bound, or
+ * possibly cv-qualified void.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct has_trivial_default_constructor
+ : integral_constant<bool, _RW::__rw_has_trivial_ctor<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a trivial type or
+ * a class type with a trivial copy constructor, or an array of
+ * such a class type.
+ *
+ * _TypeT shall be a complete type, an array of unknown bound, or
+ * possibly cv-qualified void.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct has_trivial_copy_constructor
+ : integral_constant<bool, _RW::__rw_has_trivial_copy<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if the assignment operator for _TypeT
+ * is trivial.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct has_trivial_assign
+ : integral_constant<bool, _RW::__rw_has_trivial_assign<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if the destructor for _TypeT is trivial.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct has_trivial_destructor
+ : integral_constant<bool, _RW::__rw_has_trivial_dtor<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if the default constructor for _TypeT
+ * has an empty exception specification or can otherwise be deduced to
+ * never throw an exception.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct has_nothrow_default_constructor
+ : integral_constant<bool, _RW::__rw_has_nothrow_ctor<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if the copy constructor for _TypeT has
+ * an empty exception specification or can otherwise be deduced to never
+ * throw an exception.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct has_nothrow_copy_constructor
+ : integral_constant<bool, _RW::__rw_has_nothrow_copy<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if the assignment operator has an empty
+ * exception specification or can otherwise be deduced never to throw an
+ * exception.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct has_nothrow_assign
+ : integral_constant<bool, _RW::__rw_has_nothrow_assign<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT has a virtual destructor.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct has_virtual_destructor
+ : integral_constant<bool, _RW::__rw_has_virtual_dtor<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is a signed arithmetic
+ * type.
+ */
+template <class _TypeT>
+struct is_signed
+ : integral_constant<bool, _RW::__rw_is_signed<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if _TypeT is an unsigned arithmetic
+ * type.
+ */
+template <class _TypeT>
+struct is_unsigned
+ : integral_constant<bool, _RW::__rw_is_unsigned<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine the alignment of objects of type
+ * _TypeT.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT>
+struct alignment_of
+ : integral_constant<int, _RW::__rw_alignment_of<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine the rank of objects of type _TypeT.
+ */
+template <class _TypeT>
+struct rank
+ : integral_constant<int, _RW::__rw_rank<_TypeT>::value>
+{
+};
+
+/**
+ * @ingroup meta_unary_prop
+ *
+ * \e UnaryTypeTrait to determine if the extent of the I'th bound of
+ * objects of type _TypeT.
+ */
+template <class _TypeT, unsigned _Bound = 0>
+struct extent
+ : integral_constant<int, _RW::__rw_extent<_TypeT, _Bound>::value>
+{
+};
+
+/**
+ * @ingroup meta_rel
+ *
+ * \e UnaryTypeTrait to determine if _TypeT and _TypeU are exactly the
+ * same type.
+ */
+template <class _TypeT, class _TypeU>
+struct is_same
+ : integral_constant<bool, _RW::__rw_is_same<_TypeT, _TypeU>::value>
+{
+};
+
+/**
+ * @ingroup meta_rel
+ *
+ * \e BinaryyTypeTrait to determine if _TypeT is a base class of _TypeU
+ * or _TypeT and _TypeU name the same non-union class type without regard
+ * to cv-qualifiers.
+ *
+ * @note Base classes that are private, protected or ambiguous are,
+ * nonetheless, base classes.
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT, class _TypeU>
+struct is_base_of
+ : integral_constant<int, _RW::__rw_is_base_of<_TypeT, _TypeU>::value>
+{
+};
+
+/**
+ * @ingroup meta_rel
+ *
+ * \e BinaryTypeTrait to determine if lvalue of type _TypeT is implicitly
+ * convertible to _TypeU ([conv]).
+ *
+ * @note This may not be accurate for class types if the necessary
+ * compiler support is not available.
+ */
+template <class _TypeT, class _TypeU>
+struct is_convertible
+ : integral_constant<int, _RW::__rw_is_convertible<_TypeT, _TypeU>::value>
+{
+};
+
+/**
+ * @ingroup meta_trans_cv
+ *
+ * \e TransformationTrait to remove any top-level const-qualifier.
+ *
+ * The member typedef \c type shall be the same as _TypeT except that
+ * any top level const-qualifier has been removed
+ */
+template <class _TypeT>
+struct remove_const
+{
+ typedef _TYPENAME _RW::__rw_remove_const<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_cv
+ *
+ * \e TransformationTrait to remove any top-level volatile-qualifier.
+ *
+ * The member typedef \c type shall be the same as _TypeT except that
+ * any top level volatile-qualifier has been removed
+ */
+template <class _TypeT>
+struct remove_volatile
+{
+ typedef _TYPENAME _RW::__rw_remove_volatile<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_cv
+ *
+ * \e TransformationTrait to remove any top-level cv-qualifiers.
+ *
+ * The member typedef \c type shall be the same as _TypeT except that
+ * any top level cv-qualifier has been removed
+ */
+template <class _TypeT>
+struct remove_cv
+{
+ typedef _TYPENAME _RW::__rw_remove_cv<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_cv
+ *
+ * \e TransformationTrait to add a top-level const-qualifier.
+ *
+ * If _TypeT is a reference, function, or other type level const-
+ * qualified type then \c type shall be the same as _TypeT,
+ * otherwise _TypeT const
+ */
+template <class _TypeT>
+struct add_const
+{
+ typedef _TYPENAME _RW::__rw_add_const<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_cv
+ *
+ * \e TransformationTrait to add a top-level volatile-qualifier.
+ *
+ * If _TypeT is a reference, function, or other type level volatile-
+ * qualified type then \c type shall be the same as _TypeT,
+ * otherwise _TypeT volatile
+ */
+template <class _TypeT>
+struct add_volatile
+{
+ typedef _TYPENAME _RW::__rw_add_volatile<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_cv
+ *
+ * \e TransformationTrait to add a top-level const and volatile-qualifier.
+ *
+ */
+template <class _TypeT>
+struct add_cv
+{
+ typedef _TYPENAME _RW::__rw_add_cv<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_ref
+ *
+ * \e TransformationTrait to remove a reference from _TypeT.
+ *
+ * The member typedef \c type shall be the same as _TypeT, except
+ * any reference qualifier has been removed
+ */
+template <class _TypeT>
+struct remove_reference
+{
+ typedef _TYPENAME _RW::__rw_remove_reference<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_ref
+ *
+ * \e TransformationTrait to add a reference to _TypeT.
+ */
+template <class _TypeT>
+struct add_lvalue_reference
+{
+ typedef _TYPENAME _RW::__rw_add_lvalue_reference<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_ref
+ *
+ * \e TransformationTrait to add an rvalue-reference to _TypeT.
+ */
+template <class _TypeT>
+struct add_rvalue_reference
+{
+ typedef _TYPENAME _RW::__rw_add_rvalue_reference<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_sign
+ *
+ * \e TransformationTrait to get a signed type from an enum or non-
+ * boolean integral type.
+ */
+template <class _TypeT>
+struct make_signed
+{
+ typedef _TYPENAME _RW::__rw_make_signed<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_sign
+ *
+ * \e TransformationTrait to get an unsigned type from an enum or non-
+ * boolean integral type.
+ */
+template <class _TypeT>
+struct make_unsigned
+{
+ typedef _TYPENAME _RW::__rw_make_unsigned<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_arr
+ *
+ * \e TransformationTrait to remove a dimension from the type _TypeT.
+ *
+ * If _TypeT is 'array of _TypeU', the member typedef \c type shall
+ * be _TypeU, otherwise _TypeT.
+ */
+template <class _TypeT>
+struct remove_extent
+{
+ typedef _TYPENAME _RW::__rw_remove_extent<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_arr
+ *
+ * \e TransformationTrait to remove all dimensions from the type
+ * _TypeT.
+ *
+ * If _TypeT is 'multi-dimensional array of _TypeU', the member typedef
+ * \c type shall be _TypeU otherwise _TypeT.
+ */
+template <class _TypeT>
+struct remove_all_extents
+{
+ typedef _TYPENAME _RW::__rw_remove_all_extents<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_pointer
+ *
+ * \e TransformationTrait to remove a pointer from the type _TypeT.
+ *
+ * The member typedef \c type shall be the same as _TypeT, except
+ * any top level indirection has been removed.
+ *
+ * @note pointers to members are left unchanged
+ */
+template <class _TypeT>
+struct remove_pointer
+{
+ typedef _TYPENAME _RW::__rw_remove_pointer<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_pointer
+ *
+ * \e TransformationTrait to add a pointer to the type _TypeT.
+ */
+template <class _TypeT>
+struct add_pointer
+{
+ typedef _TYPENAME _RW::__rw_add_pointer<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_other
+ */
+template <_RWSTD_SIZE_T _Len, _RWSTD_SIZE_T _Align>
+struct aligned_storage
+{
+ typedef _TYPENAME _RW::__rw_aligned_storage<_Len, _Align>::_C_Type type;
+};
+
+///**
+// * @ingroup meta_trans_other
+// *
+// * @note This may not be accurate for class types if the necessary
+// * compiler support is not available.
+// */
+//template <_RWSTD_SIZE_T _Len, class... Types>
+//struct aligned_union
+//{
+//}
+
+/**
+ * @ingroup meta_trans_other
+ *
+ * \e TransformationTrait to do array-to-pointer and function-to-pointer
+ * type conversions.
+ *
+ * Let \c U be \c remove_reference<T>::type. If \c is_array<U>::value is
+ * true, the member typedef type shall equal remove_extent<U>::type*. If
+ * \c is_function<U>::value is true, the member typedef shall equal
+ * \c add_pointer<U>::type. Otherwise the member typedef type equals \c U.
+ */
+template <class _TypeT>
+struct decay
+{
+ typedef _TYPENAME _RW::__rw_decay<_TypeT>::type type;
+};
+
+/**
+ * @ingroup meta_trans_other
+ *
+ * If _Enable is true, the member typedef \c type shall equal _TypeT;
+ * otherwise, there shall be no member typedef \c type.
+ */
+template <bool _Enable, class _TypeT = void>
+struct enable_if
+{
+ typedef _TypeT type;
+};
+
+/**
+ *
+ */
+template <class _TypeT>
+struct enable_if<false, _TypeT>
+{
+};
+
+/**
+ * @ingroup meta_trans_other
+ *
+ * If _Select is true, the member typedef \c type shall equal _TypeT
+ * otherwise \c type shall equal _TypeU.
+ */
+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
Modified: stdcxx/branches/4.3.x/tests/utilities/20.meta.help.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.meta.help.cpp?rev=667365&r1=667364&r2=667365&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.meta.help.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.meta.help.cpp Thu Jun 12 22:53:51 2008
@@ -1,7 +1,7 @@
// -*- C++ -*-
/***************************************************************************
*
- * 20.meta.help.cpp - test exercising tr.meta.help
+ * 20.meta.help.cpp - test exercising meta.help
*
* $Id$
*
@@ -23,17 +23,17 @@
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
- * Copyright 1999-2008 Rogue Wave Software, Inc.
+ * Copyright 2008 Rogue Wave Software, Inc.
*
**************************************************************************/
-#include <type_traits>
-
#include <rw_driver.h>
// compile out all test code if extensions disabled
#ifndef _RWSTD_NO_EXT_CXX_0X
+#include <type_traits>
+
/**************************************************************************/
template <class T, class U>
@@ -249,7 +249,7 @@
int main (int argc, char *argv[])
{
return rw_test (argc, argv, __FILE__,
- "tr.meta.help",
+ "meta.help",
0 /* no comment */,
run_test,
0);
Added: stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp?rev=667365&view=auto
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp (added)
+++ stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp Thu Jun 12 22:53:51 2008
@@ -0,0 +1,392 @@
+// -*- C++ -*-
+/***************************************************************************
+ *
+ * 20.meta.rel.cpp - test exercising meta.rel
+ *
+ * $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 1999-2008 Rogue Wave Software, Inc.
+ *
+ **************************************************************************/
+
+#include <type_traits>
+
+#include <rw_driver.h>
+
+// compile out all test code if extensions disabled
+#ifndef _RWSTD_NO_EXT_CXX_0X
+
+/**************************************************************************/
+
+enum enum_A { E_a = 0 };
+enum enum_B { E_b = 0 };
+
+struct struct_A {
+ int i_; float f_;
+};
+
+struct struct_AA {
+ int i_; float f_;
+};
+
+class class_B {
+ int i_; float f_;
+};
+
+class class_BB {
+ int i_; float f_;
+};
+
+struct convertible_to_A
+{
+ operator struct_A ();
+};
+
+struct constructible_from_B
+{
+ constructible_from_B (class_B);
+};
+
+template <class T>
+struct derived_ : T
+{
+};
+
+template <class T>
+struct derived_private_ : private T
+{
+};
+
+template <class T>
+struct derived_protected_ : protected T
+{
+};
+
+template <class T>
+struct derived_with_conversion_ : T
+{
+ derived_with_conversion_ (const T&);
+};
+
+class incomplete_;
+
+union union_C {
+ int i_; float f_;
+};
+
+union union_CC {
+ int i_; float f_;
+};
+
+/**************************************************************************/
+
+void test_trait (int line, bool value, bool expect,
+ const char* trait, const char* typeT, const char* typeU)
+{
+ rw_assert (value == expect, 0, line,
+ "%s<%s, %s>::type is%{?}n't%{;} %b as expected",
+ trait, typeT, typeU, value != expect, expect);
+}
+
+#define TEST(Trait,TypeT,TypeU,Expect) \
+ test_trait (__LINE__, Trait<TypeT,TypeU>::value, Expect, \
+ #Trait, #TypeT, #TypeU)
+
+static void test_is_same ()
+{
+ TEST (std::is_same, bool, bool, true);
+ TEST (std::is_same, char, char, true);
+ TEST (std::is_same, short, short, true);
+ TEST (std::is_same, int, int, true);
+ TEST (std::is_same, long, long, true);
+ TEST (std::is_same, float, float, true);
+ TEST (std::is_same, double, double, true);
+
+ TEST (std::is_same, enum_A, enum_A, true);
+ TEST (std::is_same, enum_B, enum_B, true);
+
+ TEST (std::is_same, struct_A, struct_A, true);
+ TEST (std::is_same, derived_<struct_A>,
+ derived_<struct_A>, true);
+
+ TEST (std::is_same, class_B, class_B, true);
+ TEST (std::is_same, derived_<class_B>,
+ derived_<class_B>, true);
+
+ // other combinations should fail
+ TEST (std::is_same, signed char, char, false);
+ TEST (std::is_same, char, signed char, false);
+ TEST (std::is_same, unsigned char, char, false);
+ TEST (std::is_same, char, unsigned char, false);
+
+ TEST (std::is_same, signed char, unsigned char, false);
+ TEST (std::is_same, unsigned char, signed char, false);
+ TEST (std::is_same, signed short, unsigned short, false);
+ TEST (std::is_same, unsigned short, signed short, false);
+ TEST (std::is_same, signed int, unsigned int, false);
+ TEST (std::is_same, unsigned int, signed int, false);
+ TEST (std::is_same, signed long, unsigned long, false);
+ TEST (std::is_same, unsigned long, signed long, false);
+
+ TEST (std::is_same, enum_A, char, false);
+ TEST (std::is_same, enum_A, short, false);
+ TEST (std::is_same, enum_A, int, false);
+ TEST (std::is_same, enum_A, long, false);
+
+ TEST (std::is_same, enum_A, unsigned char, false);
+ TEST (std::is_same, enum_A, unsigned short, false);
+ TEST (std::is_same, enum_A, unsigned int, false);
+ TEST (std::is_same, enum_A, unsigned long, false);
+
+ TEST (std::is_same, struct_A, derived_<struct_A>, false);
+ TEST (std::is_same, class_B, derived_<class_B>, false);
+
+ TEST (std::is_same, int[], int*, false);
+ TEST (std::is_same, int*, int[], false);
+}
+
+static void test_is_base_of ()
+{
+ TEST (std::is_base_of, bool, bool, false);
+ TEST (std::is_base_of, char, char, false);
+ TEST (std::is_base_of, short, short, false);
+ TEST (std::is_base_of, int, int, false);
+ TEST (std::is_base_of, long, long, false);
+ TEST (std::is_base_of, float, float, false);
+ TEST (std::is_base_of, double, double, false);
+
+ TEST (std::is_base_of, enum_A, enum_A, false);
+ TEST (std::is_base_of, enum_B, enum_B, false);
+
+ TEST (std::is_base_of, struct_A, struct_A, true);
+ TEST (std::is_base_of, derived_<struct_A>,
+ derived_<struct_A>, true);
+
+ TEST (std::is_base_of, class_B, class_B, true);
+ TEST (std::is_base_of, derived_<class_B>,
+ derived_<class_B>, true);
+
+ TEST (std::is_base_of, union_C, union_C, true);
+
+ // public inheritance
+ TEST (std::is_base_of, struct_A, derived_<struct_A>, true);
+ TEST (std::is_base_of, class_B, derived_<class_B>, true);
+
+ // protected inheritance
+ TEST (std::is_convertible, derived_protected_<struct_A> , struct_A , true); // slice
+ TEST (std::is_convertible, derived_protected_<struct_A>*, struct_A*, true);
+ TEST (std::is_convertible, derived_protected_<struct_A>&, struct_A&, true);
+
+ // private inheritance
+ TEST (std::is_convertible, derived_private_<struct_A> , struct_A , true); // slice
+ TEST (std::is_convertible, derived_private_<struct_A>*, struct_A*, true);
+ TEST (std::is_convertible, derived_private_<struct_A>&, struct_A&, true);
+
+ // other combinations should fail
+ TEST (std::is_base_of, signed char, char, false);
+ TEST (std::is_base_of, char, signed char, false);
+ TEST (std::is_base_of, unsigned char, char, false);
+ TEST (std::is_base_of, char, unsigned char, false);
+
+ TEST (std::is_base_of, signed char, unsigned char, false);
+ TEST (std::is_base_of, unsigned char, signed char, false);
+ TEST (std::is_base_of, signed short, unsigned short, false);
+ TEST (std::is_base_of, unsigned short, signed short, false);
+ TEST (std::is_base_of, signed int, unsigned int, false);
+ TEST (std::is_base_of, unsigned int, signed int, false);
+ TEST (std::is_base_of, signed long, unsigned long, false);
+ TEST (std::is_base_of, unsigned long, signed long, false);
+
+ TEST (std::is_base_of, enum_A, char, false);
+ TEST (std::is_base_of, enum_A, short, false);
+ TEST (std::is_base_of, enum_A, int, false);
+ TEST (std::is_base_of, enum_A, long, false);
+
+ TEST (std::is_base_of, enum_A, unsigned char, false);
+ TEST (std::is_base_of, enum_A, unsigned short, false);
+ TEST (std::is_base_of, enum_A, unsigned int, false);
+ TEST (std::is_base_of, enum_A, unsigned long, false);
+
+ TEST (std::is_base_of, int[], int*, false);
+ TEST (std::is_base_of, int*, int[], false);
+}
+
+static void test_is_convertible ()
+{
+ TEST (std::is_convertible, derived_<struct_A> , struct_A , true); // slice
+ TEST (std::is_convertible, derived_<struct_A>*, struct_A*, true);
+ TEST (std::is_convertible, derived_<struct_A>&, struct_A&, true);
+
+ // protected inheritance
+ TEST (std::is_convertible, derived_protected_<struct_A> , struct_A , false); // slice
+ TEST (std::is_convertible, derived_protected_<struct_A>*, struct_A*, false);
+ TEST (std::is_convertible, derived_protected_<struct_A>&, struct_A&, false);
+
+ // private inheritance
+ TEST (std::is_convertible, derived_private_<struct_A> , struct_A , false); // slice
+ TEST (std::is_convertible, derived_private_<struct_A>*, struct_A*, false);
+ TEST (std::is_convertible, derived_private_<struct_A>&, struct_A&, false);
+
+ TEST (std::is_convertible, derived_<class_B> , class_B , true); // slice
+ TEST (std::is_convertible, derived_<class_B>*, class_B*, true);
+ TEST (std::is_convertible, derived_<class_B>&, class_B&, true);
+
+ TEST (std::is_convertible, convertible_to_A, struct_A, true);
+ TEST (std::is_convertible, struct_A, convertible_to_A, false);
+ TEST (std::is_convertible, convertible_to_A*, struct_A*, false);
+ TEST (std::is_convertible, convertible_to_A&, struct_A&, false);
+
+ TEST (std::is_convertible, constructible_from_B, class_B, false);
+ TEST (std::is_convertible, class_B, constructible_from_B, true);
+ TEST (std::is_convertible, class_B*, constructible_from_B*, false);
+ TEST (std::is_convertible, class_B&, constructible_from_B&, false);
+
+ //
+ // pointer to pointer conversions
+ //
+
+ TEST (std::is_convertible, int*, int*, true);
+ TEST (std::is_convertible, const int*, const int*, true);
+ TEST (std::is_convertible, volatile int*, volatile int*, true);
+ TEST (std::is_convertible, const volatile int*, const volatile int*, true);
+
+ // add cv-qualifiers
+ TEST (std::is_convertible, int*, const int*, true);
+ TEST (std::is_convertible, int*, volatile int*, true);
+ TEST (std::is_convertible, int*, const volatile int*, true);
+
+ // strip cv-qualifiers
+ TEST (std::is_convertible, const int*, int*, false);
+ TEST (std::is_convertible, volatile int*, int*, false);
+ TEST (std::is_convertible, const volatile int*, int*, false);
+
+ //
+ // special case void conversions
+ //
+
+ TEST (std::is_convertible, void, void, true);
+ TEST (std::is_convertible, void, long, false);
+ TEST (std::is_convertible, long, void, false);
+
+ //
+ // array to pointer conversions
+ //
+
+ TEST (std::is_convertible, int[], int*, true);
+ TEST (std::is_convertible, const int[], const int*, true);
+ TEST (std::is_convertible, volatile int[], volatile int*, true);
+ TEST (std::is_convertible, const volatile int[], const volatile int*, true);
+
+ // add cv-qualifiers
+ TEST (std::is_convertible, int[], const int*, true);
+ TEST (std::is_convertible, int[], volatile int*, true);
+ TEST (std::is_convertible, int[], const volatile int*, true);
+
+ // strip cv-qualifiers
+ TEST (std::is_convertible, const int[], int*, false);
+ TEST (std::is_convertible, volatile int[], int*, false);
+ TEST (std::is_convertible, const volatile int[], int*, false);
+
+ //
+ // pointer to array conversions should all fail
+ //
+
+ TEST (std::is_convertible, int*, int[], false);
+ TEST (std::is_convertible, const int*, const int[], false);
+ TEST (std::is_convertible, volatile int*, volatile int[], false);
+ TEST (std::is_convertible, const volatile int*, const volatile int[], false);
+
+ // add cv-qualifiers
+ TEST (std::is_convertible, int*, const int[], false);
+ TEST (std::is_convertible, int*, volatile int[], false);
+ TEST (std::is_convertible, int*, const volatile int[], false);
+
+ // strip cv-qualifiers
+ TEST (std::is_convertible, const int*, int[], false);
+ TEST (std::is_convertible, volatile int*, int[], false);
+ TEST (std::is_convertible, const volatile int*, int[], false);
+
+ //// from an abstract type is allowed
+ //TEST (std::is_convertible, abstract_, int, false);
+ //TEST (std::is_convertible, derived_<abstract_>, abstract_, false);
+
+ TEST (std::is_convertible, long*, void*, true);
+ TEST (std::is_convertible, void*, long*, false);
+
+ // function to function conversions fail
+ TEST (std::is_convertible, int (), int (), false);
+ TEST (std::is_convertible, int (), int (char, long), false);
+
+ // function to function pointer
+ TEST (std::is_convertible, int (), int (*)(), true);
+ TEST (std::is_convertible, int (char, long), int (*)(char, long), true);
+ TEST (std::is_convertible, int (), int (*)(char), false);
+
+ // function to function reference
+ TEST (std::is_convertible, int (), int (&)(), true);
+ TEST (std::is_convertible, int (char, long), int (&)(char, long), true);
+ TEST (std::is_convertible, int (), int (&)(char), false);
+
+ TEST (std::is_convertible, int*, void*, true);
+ TEST (std::is_convertible, int (*)(), void*, true);
+
+ //TEST (std::is_convertible, int (*)(derived_<struct_A>::*), int (*)(struct_A::*), true);
+
+ TEST (std::is_convertible, int, double, true);
+ TEST (std::is_convertible, const int, double, true);
+}
+
+/**************************************************************************/
+
+static int run_test (int, char*[])
+{
+ test_is_same ();
+ test_is_base_of ();
+ test_is_convertible ();
+
+ return 0;
+}
+
+/**************************************************************************/
+
+#else // _RWSTD_NO_EXT_CXX_0X
+
+/**************************************************************************/
+
+static int run_test (int, char*[])
+{
+ rw_warn (0, 0, __LINE__,
+ "test disabled because _RWSTD_NO_EXT_CXX_0X is defined");
+ return 0;
+}
+
+#endif // !_RWSTD_NO_EXT_CXX_0X
+
+/**************************************************************************/
+
+int main (int argc, char *argv[])
+{
+ return rw_test (argc, argv, __FILE__,
+ "meta.rel",
+ 0 /* no comment */,
+ run_test,
+ 0);
+}
Propchange: stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: stdcxx/branches/4.3.x/tests/utilities/20.meta.rel.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Added: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.arr.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.arr.cpp?rev=667365&view=auto
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.arr.cpp (added)
+++ stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.arr.cpp Thu Jun 12 22:53:51 2008
@@ -0,0 +1,124 @@
+// -*- C++ -*-
+/***************************************************************************
+ *
+ * 20.meta.trans.arr.cpp - test exercising meta.trans.arr
+ *
+ * $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 1999-2008 Rogue Wave Software, Inc.
+ *
+ **************************************************************************/
+
+#include <rw_driver.h>
+
+// compile out all test code if extensions disabled
+#ifndef _RWSTD_NO_EXT_CXX_0X
+
+#include <type_traits>
+
+/**************************************************************************/
+
+void test_trait (int line, const char* trait,
+ const char* typeT, const char* typeU,
+ bool success)
+{
+ rw_assert (success, 0, line,
+ "%s<%s>::type is %{?}exactly%{:}not%{;} %s",
+ trait, typeT, success, typeU);
+}
+
+#define TEST(Trait,TypeT,TypeU) \
+ test_trait(__LINE__, #Trait, #TypeT, #TypeU, \
+ std::is_same<Trait<TypeT>::type, TypeU>::value)
+
+/**************************************************************************/
+
+static void test_remove_extent ()
+{
+ TEST (std::remove_extent, int, int);
+ TEST (std::remove_extent, int[], int);
+ TEST (std::remove_extent, int[5], int);
+ TEST (std::remove_extent, int[][5], int[5]);
+ TEST (std::remove_extent, int[5][5], int[5]);
+
+ TEST (std::remove_extent, void, void);
+ TEST (std::remove_extent, void*, void*);
+
+ TEST (std::remove_extent, long (*)[1], long (*)[1]);
+
+ TEST (std::remove_extent, long (), long ());
+ TEST (std::remove_extent, long (*)(), long (*)());
+ TEST (std::remove_extent, long (&)(), long (&)());
+}
+
+static void test_remove_all_extents ()
+{
+ TEST (std::remove_all_extents, int, int);
+ TEST (std::remove_all_extents, int[], int);
+ TEST (std::remove_all_extents, int[5], int);
+ TEST (std::remove_all_extents, int[][5], int);
+ TEST (std::remove_all_extents, int[5][5], int);
+
+ TEST (std::remove_all_extents, void, void);
+ TEST (std::remove_all_extents, void*, void*);
+
+ TEST (std::remove_all_extents, long (*)[1], long (*)[1]);
+
+ TEST (std::remove_all_extents, long (), long ());
+ TEST (std::remove_all_extents, long (*)(), long (*)());
+ TEST (std::remove_all_extents, long (&)(), long (&)());
+}
+
+/**************************************************************************/
+
+static int run_test (int, char*[])
+{
+ test_remove_extent ();
+ test_remove_all_extents ();
+
+ return 0;
+}
+
+/**************************************************************************/
+
+#else // _RWSTD_NO_EXT_CXX_0X
+
+/**************************************************************************/
+
+static int run_test (int, char*[])
+{
+ rw_warn (0, 0, __LINE__,
+ "test disabled because _RWSTD_NO_EXT_CXX_0X is defined");
+ return 0;
+}
+
+#endif // !_RWSTD_NO_EXT_CXX_0X
+
+/**************************************************************************/
+
+int main (int argc, char *argv[])
+{
+ return rw_test (argc, argv, __FILE__,
+ "meta.trans.arr",
+ 0 /* no comment */,
+ run_test,
+ 0);
+}
Propchange: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.arr.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.arr.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Added: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.cv.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.cv.cpp?rev=667365&view=auto
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.cv.cpp (added)
+++ stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.cv.cpp Thu Jun 12 22:53:51 2008
@@ -0,0 +1,330 @@
+// -*- C++ -*-
+/***************************************************************************
+ *
+ * 20.meta.trans.cv.cpp - test exercising meta.trans.cv
+ *
+ * $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 1999-2008 Rogue Wave Software, Inc.
+ *
+ **************************************************************************/
+
+#include <rw_driver.h>
+
+// compile out all test code if extensions disabled
+#ifndef _RWSTD_NO_EXT_CXX_0X
+
+#include <type_traits>
+
+/**************************************************************************/
+
+template <class T, class U>
+struct test_is_same
+{
+ enum { value = 0 };
+};
+
+template <class T>
+struct test_is_same<T,T>
+{
+ enum { value = 1 };
+};
+
+/**************************************************************************/
+
+void test_trait (int line, bool same,
+ const char* trait,
+ const char* typeT,
+ const char* typeU)
+{
+ rw_assert (same, 0, line,
+ "%s<%s>::type is %{?}exactly%{:}not%{;} %s",
+ trait, typeT, same, typeU);
+}
+
+#define TEST(Trait,TypeT,TypeU) \
+ test_trait(__LINE__, \
+ std::is_same<Trait<TypeT>::type, TypeU>::value, \
+ #Trait, #TypeT, #TypeU)
+
+/**************************************************************************/
+
+#define C const
+#define V volatile
+#define CV const volatile
+
+/**************************************************************************/
+
+static void test_remove_const ()
+{
+ TEST (std::remove_const, int, int);
+ TEST (std::remove_const, C int, int);
+ TEST (std::remove_const, V int, V int);
+ TEST (std::remove_const, CV int, V int);
+
+ TEST (std::remove_const, int*, int*);
+ TEST (std::remove_const, C int*, C int*);
+ TEST (std::remove_const, V int*, V int*);
+ TEST (std::remove_const, CV int*, CV int*);
+
+ TEST (std::remove_const, int* C , int* );
+ TEST (std::remove_const, int* V, int* V);
+ TEST (std::remove_const, int* CV, int* V);
+
+ TEST (std::remove_const, C int* C , C int* );
+ TEST (std::remove_const, C int* V, C int* V);
+ TEST (std::remove_const, C int* CV, C int* V);
+
+ TEST (std::remove_const, V int* C , V int* );
+ TEST (std::remove_const, V int* V, V int* V);
+ TEST (std::remove_const, V int* CV, V int* V);
+
+ TEST (std::remove_const, CV int* C , CV int* );
+ TEST (std::remove_const, CV int* V, CV int* V);
+ TEST (std::remove_const, CV int* CV, CV int* V);
+}
+
+static void test_remove_volatile ()
+{
+ TEST (std::remove_volatile, int, int);
+ TEST (std::remove_volatile, C int, C int);
+ TEST (std::remove_volatile, V int, int);
+ TEST (std::remove_volatile, CV int, C int);
+
+ TEST (std::remove_volatile, int*, int*);
+ TEST (std::remove_volatile, C int*, C int*);
+ TEST (std::remove_volatile, V int*, V int*);
+ TEST (std::remove_volatile, CV int*, CV int*);
+
+ TEST (std::remove_volatile, int* C , int* C);
+ TEST (std::remove_volatile, int* V, int* );
+ TEST (std::remove_volatile, int* CV, int* C);
+
+ TEST (std::remove_volatile, C int* C , C int* C);
+ TEST (std::remove_volatile, C int* V, C int* );
+ TEST (std::remove_volatile, C int* CV, C int* C);
+
+ TEST (std::remove_volatile, V int* C , V int* C);
+ TEST (std::remove_volatile, V int* V, V int* );
+ TEST (std::remove_volatile, V int* CV, V int* C);
+
+ TEST (std::remove_volatile, CV int* C , CV int* C);
+ TEST (std::remove_volatile, CV int* V, CV int* );
+ TEST (std::remove_volatile, CV int* CV, CV int* C);
+}
+
+static void test_remove_cv ()
+{
+ TEST (std::remove_cv, int, int);
+ TEST (std::remove_cv, C int, int);
+ TEST (std::remove_cv, V int, int);
+ TEST (std::remove_cv, CV int, int);
+
+ TEST (std::remove_cv, int*, int*);
+ TEST (std::remove_cv, C int*, C int*);
+ TEST (std::remove_cv, V int*, V int*);
+ TEST (std::remove_cv, CV int*, CV int*);
+
+ TEST (std::remove_cv, int* C , int*);
+ TEST (std::remove_cv, int* V, int*);
+ TEST (std::remove_cv, int* CV, int*);
+
+ TEST (std::remove_cv, C int* C , C int*);
+ TEST (std::remove_cv, C int* V, C int*);
+ TEST (std::remove_cv, C int* CV, C int*);
+
+ TEST (std::remove_cv, V int* C , V int*);
+ TEST (std::remove_cv, V int* V, V int*);
+ TEST (std::remove_cv, V int* CV, V int*);
+
+ TEST (std::remove_cv, CV int* C , CV int*);
+ TEST (std::remove_cv, CV int* V, CV int*);
+ TEST (std::remove_cv, CV int* CV, CV int*);
+}
+
+/**************************************************************************/
+
+static void test_add_const ()
+{
+ TEST (std::add_const, int, C int);
+ TEST (std::add_const, C int, C int);
+ TEST (std::add_const, V int, CV int);
+ TEST (std::add_const, CV int, CV int);
+
+ TEST (std::add_const, int*, int* C);
+ TEST (std::add_const, C int*, C int* C);
+ TEST (std::add_const, V int*, V int* C);
+ TEST (std::add_const, CV int*, CV int* C);
+
+ TEST (std::add_const, int* C , int* C);
+ TEST (std::add_const, int* V, int* CV);
+ TEST (std::add_const, int* CV, int* CV);
+
+ TEST (std::add_const, C int* C , C int* C );
+ TEST (std::add_const, C int* V, C int* CV);
+ TEST (std::add_const, C int* CV, C int* CV);
+
+ TEST (std::add_const, V int* C , V int* C );
+ TEST (std::add_const, V int* V, V int* CV);
+ TEST (std::add_const, V int* CV, V int* CV);
+
+ TEST (std::add_const, CV int* C , CV int* C );
+ TEST (std::add_const, CV int* V, CV int* CV);
+ TEST (std::add_const, CV int* CV, CV int* CV);
+
+ TEST (std::add_const, void (*)(), void (*C)());
+
+ // if T is a reference, then type shall be the same as T
+ TEST (std::add_const, int&, int&);
+ TEST (std::add_const, C int&, C int&);
+ TEST (std::add_const, V int&, V int&);
+ TEST (std::add_const, CV int&, CV int&);
+
+ TEST (std::add_const, void (&)(), void (&)());
+
+ // if T is a function, then type shall be the same as T
+ TEST (std::add_const, void (), void ());
+}
+
+static void test_add_volatile ()
+{
+ TEST (std::add_volatile, int, V int);
+ TEST (std::add_volatile, C int, CV int);
+ TEST (std::add_volatile, V int, V int);
+ TEST (std::add_volatile, CV int, CV int);
+
+ TEST (std::add_volatile, int*, int* V);
+ TEST (std::add_volatile, C int*, C int* V);
+ TEST (std::add_volatile, V int*, V int* V);
+ TEST (std::add_volatile, CV int*, CV int* V);
+
+ TEST (std::add_volatile, int* C , int* CV);
+ TEST (std::add_volatile, int* V, int* V);
+ TEST (std::add_volatile, int* CV, int* CV);
+
+ TEST (std::add_volatile, C int* C , C int* CV);
+ TEST (std::add_volatile, C int* V, C int* V);
+ TEST (std::add_volatile, C int* CV, C int* CV);
+
+ TEST (std::add_volatile, V int* C , V int* CV);
+ TEST (std::add_volatile, V int* V, V int* V);
+ TEST (std::add_volatile, V int* CV, V int* CV);
+
+ TEST (std::add_volatile, CV int* C , CV int* CV);
+ TEST (std::add_volatile, CV int* V, CV int* V);
+ TEST (std::add_volatile, CV int* CV, CV int* CV);
+
+ TEST (std::add_volatile, void (*)(), void (*V)());
+
+ // if T is a reference, then type shall be the same as T
+ TEST (std::add_volatile, int&, int&);
+ TEST (std::add_volatile, C int&, C int&);
+ TEST (std::add_volatile, V int&, V int&);
+ TEST (std::add_volatile, CV int&, CV int&);
+
+ TEST (std::add_volatile, void (&)(), void (&)());
+
+ // if T is a function, then type shall be the same as T
+ TEST (std::add_volatile, void (), void ());
+}
+
+static void test_add_cv ()
+{
+ TEST (std::add_cv, int, CV int);
+ TEST (std::add_cv, C int, CV int);
+ TEST (std::add_cv, V int, CV int);
+ TEST (std::add_cv, CV int, CV int);
+
+ TEST (std::add_cv, int*, int* CV);
+ TEST (std::add_cv, C int*, C int* CV);
+ TEST (std::add_cv, V int*, V int* CV);
+ TEST (std::add_cv, CV int*, CV int* CV);
+
+ TEST (std::add_cv, int* C , int* CV);
+ TEST (std::add_cv, int* V, int* CV);
+ TEST (std::add_cv, int* CV, int* CV);
+
+ TEST (std::add_cv, C int* C , C int* CV);
+ TEST (std::add_cv, C int* V, C int* CV);
+ TEST (std::add_cv, C int* CV, C int* CV);
+
+ TEST (std::add_cv, V int* C , V int* CV);
+ TEST (std::add_cv, V int* V, V int* CV);
+ TEST (std::add_cv, V int* CV, V int* CV);
+
+ TEST (std::add_cv, CV int* C , CV int* CV);
+ TEST (std::add_cv, CV int* V, CV int* CV);
+ TEST (std::add_cv, CV int* CV, CV int* CV);
+
+ TEST (std::add_cv, void (*)(), void (*CV)());
+
+ // if T is a reference, then type shall be the same as T
+ TEST (std::add_cv, int&, int&);
+ TEST (std::add_cv, C int&, C int&);
+ TEST (std::add_cv, V int&, V int&);
+ TEST (std::add_cv, CV int&, CV int&);
+
+ TEST (std::add_cv, void (&)(), void (&)());
+
+ // if T is a function, then type shall be the same as T
+ TEST (std::add_cv, void (), void ());
+}
+
+/**************************************************************************/
+
+static int run_test (int, char*[])
+{
+ test_remove_const();
+ test_remove_volatile();
+ test_remove_cv();
+
+ test_add_const();
+ test_add_volatile();
+ test_add_cv();
+
+ return 0;
+}
+
+/**************************************************************************/
+
+#else // _RWSTD_NO_EXT_CXX_0X
+
+/**************************************************************************/
+
+static int run_test (int, char*[])
+{
+ rw_warn (0, 0, __LINE__,
+ "test disabled because _RWSTD_NO_EXT_CXX_0X is defined");
+ return 0;
+}
+
+#endif // !_RWSTD_NO_EXT_CXX_0X
+
+/**************************************************************************/
+
+int main (int argc, char *argv[])
+{
+ return rw_test (argc, argv, __FILE__,
+ "meta.trans.cv",
+ 0 /* no comment */,
+ run_test,
+ 0);
+}
Propchange: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.cv.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.cv.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Added: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.other.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.other.cpp?rev=667365&view=auto
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.other.cpp (added)
+++ stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.other.cpp Thu Jun 12 22:53:51 2008
@@ -0,0 +1,255 @@
+// -*- C++ -*-
+/***************************************************************************
+ *
+ * 20.meta.trans.other.cpp - test exercising meta.trans.other
+ *
+ * $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 1999-2008 Rogue Wave Software, Inc.
+ *
+ **************************************************************************/
+
+#include <rw_driver.h>
+
+// compile out all test code if extensions disabled
+#ifndef _RWSTD_NO_EXT_CXX_0X
+
+#include <type_traits>
+
+/**************************************************************************/
+
+template <class T>
+struct is_char
+{
+ enum { val = 0 };
+};
+
+_RWSTD_SPECIALIZED_CLASS
+struct is_char<char>
+{
+ enum { val = 1 };
+};
+
+// this function should available _only_ if T is char
+template <class T>
+int
+enabled_if_char (_TYPENAME std::enable_if<is_char<T>::val>::type* = 0)
+{
+ return 1;
+}
+
+// this function should be available if T is _not_ char
+template <class T>
+int
+enabled_if_char (_TYPENAME std::enable_if<!is_char<T>::val>::type* = 0)
+{
+ return 0;
+}
+
+static int _cond_if_char (void* = 0)
+{
+ return 0;
+}
+
+static int _cond_if_char (long* = 0)
+{
+ return 1;
+}
+
+template <class T>
+int cond_if_char ()
+{
+ typedef std::conditional<is_char<T>::val, long, void>::type selector;
+ return _cond_if_char ((selector*)0);
+}
+
+
+/**************************************************************************/
+
+void test_trait (int line,
+ bool select,
+ const char* trait,
+ const char* typeT,
+ const char* typeU,
+ bool success)
+{
+ rw_assert (success, 0, line,
+ "%s<%b, %s, %s>::type is%{?}n't%{;} %s as expected",
+ trait, select, typeT, typeU, !success, select ? typeT : typeU);
+}
+
+void test_trait (int line, const char* trait,
+ const char* typeT, const char* typeU,
+ bool success)
+{
+ rw_assert (success, 0, line,
+ "%s<%s>::type is%{?}n't{;} %s as expected",
+ trait, typeT, success, typeU);
+}
+
+void test_enable_if (int line, const char* typeT, int got, int exp)
+{
+ const bool success = got == exp;
+
+ rw_assert (success, 0, line, "%s is%{?}n't%{;} %b as expected",
+ typeT, !success, exp);
+}
+
+#define TEST(Trait,TypeT,TypeU) \
+ test_trait(__LINE__, #Trait, #TypeT, #TypeU, \
+ std::is_same<Trait<TypeT>::type, TypeU>::value)
+
+/**************************************************************************/
+
+static void test_aligned_storage ()
+{
+}
+
+/**************************************************************************/
+
+static void test_aligned_union ()
+{
+}
+
+/**************************************************************************/
+
+static void test_decay ()
+{
+ // equal to remove_extent<remove_reference<T>::type>::type* for arrays
+ TEST (std::decay, int[ ], int*);
+ TEST (std::decay, int[2], int*);
+ TEST (std::decay, int[2][2], int (*)[2]);
+
+ // equal to add_pointer<remove_reference<U>::type>::type for functions
+ TEST (std::decay, int(), int (*)());
+ TEST (std::decay, int(char, long), int (*)(char, long));
+
+ TEST (std::decay, int(&)(), int (*)());
+ TEST (std::decay, int(&)(char, long), int (*)(char, long));
+
+ // otherwise equal to remove_cv<remove_reference<U>::type>::type
+ TEST (std::decay, int, int);
+ TEST (std::decay, const int, int);
+ TEST (std::decay, volatile int, int);
+ TEST (std::decay, const volatile int, int);
+
+ TEST (std::decay, int&, int);
+ TEST (std::decay, const int&, int);
+ TEST (std::decay, volatile int&, int);
+ TEST (std::decay, const volatile int&, int);
+}
+
+/**************************************************************************/
+
+enum enum_t { E_a = 1 };
+
+static void test_enable_if ()
+{
+ typedef std::enable_if<true, int>::type int_type;
+
+#undef TEST
+#define TEST(Cond,Expect) \
+ test_enable_if(__LINE__, #Cond, Cond, Expect)
+
+ TEST (enabled_if_char< char>(), 1);
+ TEST (enabled_if_char< signed char>(), 0);
+ TEST (enabled_if_char<unsigned char>(), 0);
+
+ TEST (enabled_if_char< short>(), 0);
+ TEST (enabled_if_char< signed short>(), 0);
+ TEST (enabled_if_char<unsigned short>(), 0);
+
+ TEST (enabled_if_char< int>(), 0);
+ TEST (enabled_if_char< signed int>(), 0);
+ TEST (enabled_if_char<unsigned int>(), 0);
+
+ TEST (enabled_if_char< long>(), 0);
+ TEST (enabled_if_char< signed long>(), 0);
+ TEST (enabled_if_char<unsigned long>(), 0);
+
+ // miscellaneous other stuff to try and expose problems
+ TEST (enabled_if_char<char ()>(), 0);
+ TEST (enabled_if_char<char (*)()>(), 0);
+ TEST (enabled_if_char<char (&)()>(), 0);
+
+ TEST (enabled_if_char<char [1]>(), 0);
+ TEST (enabled_if_char<char (*)[1]>(), 0);
+ TEST (enabled_if_char<char (&)[1]>(), 0);
+
+ TEST (enabled_if_char<enum_t>(), 0);
+}
+
+/**************************************************************************/
+
+static void test_conditional ()
+{
+ TEST (cond_if_char<void>(), 0);
+ TEST (cond_if_char<char>(), 1);
+
+#undef TEST
+#define TEST(Trait,Select,TypeT,TypeU,TypeV) \
+ test_trait(__LINE__, Select, #Trait, #TypeT, #TypeU, \
+ std::is_same<Trait<Select,TypeT,TypeU>::type, TypeV>::value)
+
+ TEST (std::conditional, true, char, long, char);
+ TEST (std::conditional, false, char, long, long);
+}
+
+/**************************************************************************/
+
+static int run_test (int, char*[])
+{
+ test_aligned_storage ();
+ test_aligned_union ();
+ test_decay ();
+ test_enable_if ();
+ test_conditional ();
+
+ return 0;
+}
+
+/**************************************************************************/
+
+#else // _RWSTD_NO_EXT_CXX_0X
+
+/**************************************************************************/
+
+static int run_test (int, char*[])
+{
+ rw_warn (0, 0, __LINE__,
+ "test disabled because _RWSTD_NO_EXT_CXX_0X is defined");
+ return 0;
+}
+
+#endif // !_RWSTD_NO_EXT_CXX_0X
+
+/**************************************************************************/
+
+int main (int argc, char *argv[])
+{
+ return rw_test (argc, argv, __FILE__,
+ "meta.trans.other",
+ 0 /* no comment */,
+ run_test,
+ 0);
+}
+
+
Propchange: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.other.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.other.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Added: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.ptr.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.ptr.cpp?rev=667365&view=auto
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.ptr.cpp (added)
+++ stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.ptr.cpp Thu Jun 12 22:53:51 2008
@@ -0,0 +1,135 @@
+// -*- C++ -*-
+/***************************************************************************
+ *
+ * 20.meta.trans.ptr.cpp - test exercising meta.trans.ptr
+ *
+ * $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 1999-2008 Rogue Wave Software, Inc.
+ *
+ **************************************************************************/
+
+#include <rw_driver.h>
+
+// compile out all test code if extensions disabled
+#ifndef _RWSTD_NO_EXT_CXX_0X
+
+#include <type_traits>
+
+/**************************************************************************/
+
+class class_t;
+
+/**************************************************************************/
+
+void test_trait (int line, const char* trait,
+ const char* typeT, const char* typeU,
+ bool success)
+{
+ rw_assert (success, 0, line,
+ "%s<%s>::type is %{?}exactly%{:}not%{;} %s",
+ trait, typeT, success, typeU);
+}
+
+#define TEST(Trait,TypeT,TypeU) \
+ test_trait(__LINE__, #Trait, #TypeT, #TypeU, \
+ std::is_same<Trait<TypeT>::type, TypeU>::value)
+
+/**************************************************************************/
+
+static void test_add_pointer ()
+{
+ TEST (std::add_pointer, int, int*);
+ TEST (std::add_pointer, int&, int*);
+
+ TEST (std::add_pointer, int*, int**);
+ TEST (std::add_pointer, int const [], int const (*)[]);
+
+ TEST (std::add_pointer, int const * volatile,
+ int const * volatile *);
+
+ TEST (std::add_pointer, int const * volatile &,
+ int const * volatile *);
+
+ TEST (std::add_pointer, int (), int (*)());
+ TEST (std::add_pointer, int (&)(), int (*)());
+ TEST (std::add_pointer, int (*)(), int (**)());
+
+ TEST (std::add_pointer, int (class_t::*), int (class_t::**));
+ TEST (std::add_pointer, int (class_t::*)(), int (class_t::**)());
+
+}
+
+static void test_remove_pointer ()
+{
+ TEST (std::remove_pointer, int*, int);
+ TEST (std::remove_pointer, int**, int*);
+ TEST (std::remove_pointer, int const (*)[], int const []);
+
+ TEST (std::remove_pointer, int const * volatile *,
+ int const * volatile);
+
+ TEST (std::remove_pointer, int const * volatile,
+ int const * volatile);
+
+ TEST (std::remove_pointer, int (), int ());
+ TEST (std::remove_pointer, int (*)(), int ());
+ TEST (std::remove_pointer, int (**)(), int (*)());
+
+ TEST (std::remove_pointer, int (class_t::*), int (class_t::*));
+ TEST (std::remove_pointer, int (class_t::*)(), int (class_t::*)());
+}
+
+/**************************************************************************/
+
+static int run_test (int, char*[])
+{
+ test_add_pointer ();
+ test_remove_pointer ();
+
+ return 0;
+}
+
+/**************************************************************************/
+
+#else // _RWSTD_NO_EXT_CXX_0X
+
+/**************************************************************************/
+
+static int run_test (int, char*[])
+{
+ rw_warn (0, 0, __LINE__,
+ "test disabled because _RWSTD_NO_EXT_CXX_0X is defined");
+ return 0;
+}
+
+#endif // !_RWSTD_NO_EXT_CXX_0X
+
+/**************************************************************************/
+
+int main (int argc, char *argv[])
+{
+ return rw_test (argc, argv, __FILE__,
+ "meta.trans.ptr",
+ 0 /* no comment */,
+ run_test,
+ 0);
+}
Propchange: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.ptr.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.ptr.cpp
------------------------------------------------------------------------------
svn:keywords = Id