Author: vitek
Date: Fri Jun 13 00:34:29 2008
New Revision: 667396
URL: http://svn.apache.org/viewvc?rev=667396&view=rev
Log:
2008-06-13 Travis Vitek <[EMAIL PROTECTED]>
=====|=========|=========|=========|=========|=========|=========|
* include/type_traits: integral_constant no longer inherits from
__rw_integral_constant.
* include/rw/_config-gcc.h: Disable __is_convertible on gcc as it
doesn't seem to exist.
* include/rw/_meta_cat.h: Expose helper macros.
* include/rw/_meta_rel.h: Ditto. Enable is_convertible fallback.
* include/_rw/_meta_prop.h: Use explicit specialization to identify
signed and unsigned types to avoid warnings on gnu. Use fallback
for __rw_is_standard_layout. Use _RWSTD_SIZE_T instead of size_t.
* tests/utilities/20.meta.unary.prop.cpp: Use _RWSTD_SIZE_T instead
of size_t. Add a few tests, fix several others.
(test_make_unsigned): Fix search-n-replace error.
Modified:
stdcxx/branches/4.3.x/include/rw/_config-gcc.h
stdcxx/branches/4.3.x/include/rw/_meta_arr.h
stdcxx/branches/4.3.x/include/rw/_meta_cat.h
stdcxx/branches/4.3.x/include/rw/_meta_prop.h
stdcxx/branches/4.3.x/include/rw/_meta_ref.h
stdcxx/branches/4.3.x/include/rw/_meta_rel.h
stdcxx/branches/4.3.x/include/type_traits
stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.sign.cpp
stdcxx/branches/4.3.x/tests/utilities/20.meta.unary.prop.cpp
Modified: stdcxx/branches/4.3.x/include/rw/_config-gcc.h
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_config-gcc.h?rev=667396&r1=667395&r2=667396&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_config-gcc.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_config-gcc.h Fri Jun 13 00:34:29 2008
@@ -185,7 +185,7 @@
# define _RWSTD_TT_IS_POLYMORPHIC(T) __is_polymorphic(T)
# define _RWSTD_TT_IS_ABSTRACT(T) __is_abstract(T)
# define _RWSTD_TT_IS_BASE_OF(T,U) __is_base_of(T,U)
-# define _RWSTD_TT_IS_CONVERTIBLE(T,U) __is_convertible(T,U)
+//# define _RWSTD_TT_IS_CONVERTIBLE(T,U) __is_convertible(T,U)
# define _RWSTD_TT_HAS_TRIVIAL_CTOR(T) __has_trivial_constructor(T)
# define _RWSTD_TT_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T)
@@ -201,4 +201,4 @@
# define _RWSTD_TT_ALIGN_OF(T) __alignof__(T)
# define _RWSTD_TT_ALIGNED_POD(N) struct { char __fill
__attribute__ ((aligned (N))); }
# define _RWSTD_TT_MAX_ALIGNMENT 16
-#endif // __GNUC__ >= 4.3
\ No newline at end of file
+#endif // __GNUC__ >= 4.3
Modified: stdcxx/branches/4.3.x/include/rw/_meta_arr.h
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_arr.h?rev=667396&r1=667395&r2=667396&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_meta_arr.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_meta_arr.h Fri Jun 13 00:34:29 2008
@@ -49,7 +49,7 @@
* other types as-is. This specialization is for array types of bounded
* size.
*/
-template <class _TypeT, size_t _Size>
+template <class _TypeT, _RWSTD_SIZE_T _Size>
struct __rw_remove_extent<_TypeT [_Size]>
{
typedef _TypeT type;
@@ -84,7 +84,7 @@
* other types as-is. This specialization is for array types of bounded
* size.
*/
-template <class _TypeT, size_t _Size>
+template <class _TypeT, _RWSTD_SIZE_T _Size>
struct __rw_remove_all_extents<_TypeT [_Size]>
{
typedef typename __rw_remove_all_extents<_TypeT>::type type;
Modified: stdcxx/branches/4.3.x/include/rw/_meta_cat.h
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_cat.h?rev=667396&r1=667395&r2=667396&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_meta_cat.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_meta_cat.h Fri Jun 13 00:34:29 2008
@@ -76,8 +76,8 @@
_RWSTD_TRAIT_SPEC_0_CV(__rw_is_void, void, true);
-//#define _RWSTD_IS_VOID(T) \
-// _RW::__rw_is_void<T>::value
+#define _RWSTD_IS_VOID(T) \
+ _RW::__rw_is_void<T>::value
/**
@@ -116,8 +116,8 @@
_RWSTD_TRAIT_SPEC_0_CV(__rw_is_integral, unsigned long long, true);
#endif // _RWSTD_NO_LONG_LONG
-//#define _RWSTD_IS_INTEGRAL(T) \
-// _RW::__rw_is_integral<T>::value
+#define _RWSTD_IS_INTEGRAL(T) \
+ _RW::__rw_is_integral<T>::value
/**
* UnaryTypeTrait to determine if _TypeT is a (potentially cv-qualified)
@@ -129,8 +129,6 @@
{
};
-//#define _RWSTD_IS_FLOATING_POINT(T) _RW::__rw_is_floating_point<T>::value
-
_RWSTD_TRAIT_SPEC_0_CV(__rw_is_floating_point, float, true);
_RWSTD_TRAIT_SPEC_0_CV(__rw_is_floating_point, double, true);
@@ -138,8 +136,8 @@
_RWSTD_TRAIT_SPEC_0_CV(__rw_is_floating_point, long double, true);
#endif // _RWSTD_NO_LONG_DOUBLE
-//#define _RWSTD_IS_FLOATING_POINT(T) \
-// _RW::__rw_is_floating_point<T>::value
+#define _RWSTD_IS_FLOATING_POINT(T) \
+ _RW::__rw_is_floating_point<T>::value
/**
@@ -160,8 +158,8 @@
{
};
-//#define _RWSTD_IS_ARRAY(T) \
-// _RW::__rw_is_array<T>::value
+#define _RWSTD_IS_ARRAY(T) \
+ _RW::__rw_is_array<T>::value
/**
* UnaryTypeTrait to determine if _TypeT is a (potentially cv-qualified)
@@ -174,8 +172,8 @@
_RWSTD_TRAIT_SPEC_1_CV(__rw_is_pointer, _TypeT*, true);
-//#define _RWSTD_IS_POINTER(T) \
-// _RW::__rw_is_pointer<T>::value
+#define _RWSTD_IS_POINTER(T) \
+ _RW::__rw_is_pointer<T>::value
/**
@@ -191,8 +189,8 @@
{
};
-//#define _RWSTD_IS_LVAL_REF(T) \
-// _RW::__rw_is_lval_ref<T>::value
+#define _RWSTD_IS_LVAL_REF(T) \
+ _RW::__rw_is_lval_ref<T>::value
/**
* UnaryTypeTrait to determine if _TypeT is a rval reference type.
@@ -212,8 +210,8 @@
#endif // _RWSTD_NO_RVALUE_REFERENCES
-//#define _RWSTD_IS_RVAL_REF(T) \
-// _RW::__rw_is_rval_ref<T>::value
+#define _RWSTD_IS_RVAL_REF(T) \
+ _RW::__rw_is_rval_ref<T>::value
/**
* Class template can be used to determine if _TypeT is an enumeration.
@@ -224,8 +222,8 @@
{
};
-//#define _RWSTD_IS_ENUM(T) \
-// _RW::__rw_is_enum<T>::value
+#define _RWSTD_IS_ENUM(T) \
+ _RW::__rw_is_enum<T>::value
/**
* UnaryTypeTrait to determine if _TypeT is a union type.
@@ -236,8 +234,8 @@
{
};
-//#define _RWSTD_IS_UNION(T) \
-// _RW::__rw_is_union<T>::value
+#define _RWSTD_IS_UNION(T) \
+ _RW::__rw_is_union<T>::value
/**
@@ -249,8 +247,8 @@
{
};
-//#define _RWSTD_IS_CLASS(T) \
-// _RW::__rw_is_class<T>::value
+#define _RWSTD_IS_CLASS(T) \
+ _RW::__rw_is_class<T>::value
/**
@@ -308,8 +306,8 @@
{
};
-//#define _RWSTD_IS_FUNCTION(T) \
-// _RW::__rw_is_function<T>::value
+#define _RWSTD_IS_FUNCTION(T) \
+ _RW::__rw_is_function<T>::value
/**
* UnaryTypeTrait to determine if _TypeT is a pointer to member
@@ -324,8 +322,8 @@
_TypeT _ClassT::*,
!__rw_is_function<_TypeT>::value);
-//#define _RWSTD_IS_MEMOBJ_PTR(T) \
-// _RW::__rw_is_member_object_pointer<T>::value
+#define _RWSTD_IS_MEMOBJ_PTR(T) \
+ _RW::__rw_is_member_object_pointer<T>::value
/**
* UnaryTypeTrait to determine if _TypeT is a pointer to member
@@ -340,8 +338,8 @@
_TypeT _ClassT::*,
__rw_is_function<_TypeT>::value);
-//#define _RWSTD_IS_MEMFUN_PTR(T) \
-// _RW::__rw_is_member_function_pointer<T>::value
+#define _RWSTD_IS_MEMFUN_PTR(T) \
+ _RW::__rw_is_member_function_pointer<T>::value
#undef _RWSTD_TRAIT_SPEC_2_CV
#undef _RWSTD_TRAIT_SPEC_1_CV
Modified: stdcxx/branches/4.3.x/include/rw/_meta_prop.h
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_prop.h?rev=667396&r1=667395&r2=667396&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_meta_prop.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_meta_prop.h Fri Jun 13 00:34:29 2008
@@ -38,47 +38,11 @@
_RWSTD_NAMESPACE (__rw) {
-template <class _TypeT, bool = __rw_is_integral<_TypeT>::value,
- bool = __rw_is_floating_point<_TypeT>::value>
-struct __rw_is_unsigned_impl
-{
- enum { _C_value = 0 };
-};
-
-template <class _TypeT>
-struct __rw_is_unsigned_impl<_TypeT, false, true>
-{
- enum { _C_value = 0 };
-};
-
-template <class _TypeT>
-struct __rw_is_unsigned_impl<_TypeT, true, false>
-{
- typedef typename __rw_remove_cv<_TypeT>::type _TypeU;
- enum { _C_value = _TypeU (0) < _TypeU (-1) };
-};
-
-template <class _TypeT, bool = __rw_is_integral<_TypeT>::value,
- bool = __rw_is_floating_point<_TypeT>::value>
-struct __rw_is_signed_impl
-{
- enum { _C_value = 0 };
-};
-
-template <class _TypeT>
-struct __rw_is_signed_impl<_TypeT, false, true>
-{
- enum { _C_value = 1 };
-};
-
-template <class _TypeT>
-struct __rw_is_signed_impl<_TypeT, true, false>
-{
- typedef typename __rw_remove_cv<_TypeT>::type _TypeU;
- enum { _C_value = _TypeU (-1) < _TypeU (0) };
-};
-
-
+#define _RWSTD_TRAIT_SPEC_0_CV(Trait,Type) \
+ template <> struct Trait<Type> : __rw_true_type { }; \
+ template <> struct Trait<Type const > : __rw_true_type { }; \
+ template <> struct Trait<Type volatile> : __rw_true_type { }; \
+ template <> struct Trait<Type const volatile> : __rw_true_type { }
/**
* UnaryTypeTrait indicates that _TypeT is const-qualified.
@@ -107,10 +71,6 @@
};
-#ifdef _MSC_VER
-
-// msvc hacks
-
template <class _TypeT>
struct __rw_is_standard_layout_impl
{
@@ -143,15 +103,15 @@
#undef _RWSTD_TT_IS_STDANDARD_LAYOUT
#define _RWSTD_TT_IS_STDANDARD_LAYOUT(T)
__rw_is_standard_layout_impl<T>::_C_value
-#undef _RWSTD_TT_IS_POD
-#define _RWSTD_TT_IS_POD(T) __rw_is_pod_impl<T>::_C_value
-
-#undef _RWSTD_TT_IS_EMPTY
-#define _RWSTD_TT_IS_EMPTY(T) __rw_is_empty_impl<T>::_C_value
+#ifdef _MSC_VER
-#endif // _MSC_VER
+# undef _RWSTD_TT_IS_POD
+# define _RWSTD_TT_IS_POD(T) __rw_is_pod_impl<T>::_C_value
+# undef _RWSTD_TT_IS_EMPTY
+# define _RWSTD_TT_IS_EMPTY(T) __rw_is_empty_impl<T>::_C_value
+#endif // _MSC_VER
@@ -390,21 +350,49 @@
* UnaryTypeTrait that indicates that _TypeT is an unsigned type.
*/
template <class _TypeT>
-struct __rw_is_unsigned
- : __rw_integral_constant<bool, __rw_is_unsigned_impl<_TypeT>::_C_value>
+struct __rw_is_unsigned : __rw_false_type
{
};
-
/**
* UnaryTypeTrait that indicates that _TypeT is a signed type.
*/
template <class _TypeT>
-struct __rw_is_signed
- : __rw_integral_constant<bool, __rw_is_signed_impl<_TypeT>::_C_value>
+struct __rw_is_signed : __rw_false_type
{
};
+#if (_RWSTD_CHAR_MIN < 0)
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_signed, char);
+#else
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_unsigned, char);
+#endif
+
+#ifndef _RWSTD_NO_NATIVE_WCHAR_T
+# if (_RWSTD_WCHAR_MIN < 0)
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_signed, wchar_t);
+# else
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_unsigned, wchar_t);
+# endif
+#endif // _RWSTD_NO_NATIVE_WCHAR_T
+
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_signed, signed char);
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_unsigned, unsigned char);
+
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_signed, signed short);
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_unsigned, unsigned short);
+
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_signed, signed int);
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_unsigned, unsigned int);
+
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_signed, signed long);
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_unsigned, unsigned long);
+
+#ifndef _RWSTD_NO_LONG_LONG
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_signed, signed long long);
+_RWSTD_TRAIT_SPEC_0_CV(__rw_is_unsigned, unsigned long long);
+#endif // _RWSTD_NO_LONG_LONG
+
/**
* UnaryTypeTrait that gets the alignment of _TypeT.
*/
@@ -433,7 +421,7 @@
* _TypeT is an array, otherwise 0. The primary template is for bounded
* -array types.
*/
-template <class _TypeT, size_t _Size>
+template <class _TypeT, _RWSTD_SIZE_T _Size>
struct __rw_rank<_TypeT [_Size]>
: __rw_integral_constant<_RWSTD_SIZE_T, 1 + __rw_rank<_TypeT>::value>
{
Modified: stdcxx/branches/4.3.x/include/rw/_meta_ref.h
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_ref.h?rev=667396&r1=667395&r2=667396&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_meta_ref.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_meta_ref.h Fri Jun 13 00:34:29 2008
@@ -97,7 +97,7 @@
{
// for rval reference types, _C_type shall become the corresponding
// lvalue reference type
- typedef _TYPENAME __rw_remove_reference<_TypeT>& _C_type;
+ typedef _TYPENAME __rw_remove_reference<_TypeT>::type& _C_type;
};
/**
Modified: stdcxx/branches/4.3.x/include/rw/_meta_rel.h
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/rw/_meta_rel.h?rev=667396&r1=667395&r2=667396&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/rw/_meta_rel.h (original)
+++ stdcxx/branches/4.3.x/include/rw/_meta_rel.h Fri Jun 13 00:34:29 2008
@@ -32,10 +32,10 @@
#include <rw/_defs.h>
-//#include <rw/_meta_ptr.h>
-//#include <rw/_meta_ref.h>
-//#include <rw/_meta_cat.h>
-//#include <rw/_meta_cv.h>
+#include <rw/_meta_ptr.h>
+#include <rw/_meta_ref.h>
+#include <rw/_meta_cat.h>
+#include <rw/_meta_cv.h>
_RWSTD_NAMESPACE (__rw) {
@@ -63,8 +63,8 @@
{
};
-//#define _RWSTD_IS_SAME(T,U) \
-// __rw_is_same<T,U>::value
+#define _RWSTD_IS_SAME(T,U) \
+ __rw_is_same<T,U>::value
/**
* BinaryTypeTrait indicates that _TypeT is a base class of _TypeU
@@ -84,8 +84,8 @@
// ||
};
-//#define _RWSTD_IS_BASE_OF(T,U) \
-// __rw_is_base_of<T,U>::value
+#define _RWSTD_IS_BASE_OF(T,U) \
+ __rw_is_base_of<T,U>::value
/**
@@ -110,73 +110,73 @@
-//template <class _TypeT, class _TypeU, bool = __rw_is_array<_TypeT>::value,
-// bool = __rw_is_function<_TypeT>::value>
-//struct __rw_is_convertible_3
-//{
-// // _TypeT is neither an array nor a function type, so just do a
-// // straight conversion test
-// enum { _C_value = __rw_is_convertible_impl<_TypeT, _TypeU>::_C_value };
-//};
-//
-//template <class _TypeT, class _TypeU>
-//struct __rw_is_convertible_3<_TypeT,_TypeU,true,false>
-//{
-// // _TypeT is an array type, see if we can convert it to a _TypeU*
-// typedef _TYPENAME __rw_remove_extent<_TypeT>::type _TypeV;
-// typedef _TYPENAME __rw_add_pointer<_TypeV>::type _TypeT_Ptr;
-//
-// enum { _C_value = __rw_is_convertible_impl<_TypeT_Ptr, _TypeU>::_C_value
};
-//};
-//
-//template <class _TypeT, class _TypeU>
-//struct __rw_is_convertible_3<_TypeT,_TypeU,false,true>
-//{
-// // _TypeT is an function type, try to convert to reference or pointer
-// typedef _TYPENAME __rw_add_lvalue_reference<_TypeT>::type _TypeT_Ref;
-// typedef _TYPENAME __rw_add_pointer<_TypeT>::type _TypeT_Ptr;
-//
-// enum { _C_value = __rw_is_convertible_impl<_TypeT_Ref,
_TypeU>::_C_value
-// || __rw_is_convertible_impl<_TypeT_Ptr,
_TypeU>::_C_value };
-//};
-//
-//template <class _TypeT, class _TypeU, bool = __rw_is_array<_TypeU>::value
-//
||__rw_is_function<_TypeU>::value>
-//struct __rw_is_convertible_2
-//{
-// // _TypeU is neither an array nor a function type
-// enum { _C_value = __rw_is_convertible_3<_TypeT, _TypeU>::_C_value };
-//};
-//
-//template <class _TypeT, class _TypeU>
-//struct __rw_is_convertible_2<_TypeT, _TypeU, true>
-//{
-// // _TypeU is either an array or a function type, and we can't convert to
-// // either of those.
-// enum { _C_value = 0 };
-//};
-//
-//template <class _TypeT, class _TypeU, bool = __rw_is_void<_TypeT>::value,
-// bool = __rw_is_void<_TypeU>::value>
-//struct __rw_is_convertible_1
-//{
-// // void-to-non-void or non-void to void
-// enum { _C_value = 0 };
-//};
-//
-//template <class _TypeT, class _TypeU>
-//struct __rw_is_convertible_1<_TypeT, _TypeU, false, false>
-//{
-// // neither is _TypeT or _TypeU is (possibly cv-qualified) void
-// enum { _C_value = __rw_is_convertible_2<_TypeT,_TypeU>::_C_value };
-//};
-//
-//template <class _TypeT, class _TypeU>
-//struct __rw_is_convertible_1<_TypeT, _TypeU, true, true>
-//{
-// // both _TypeT and _TypeU are (possibly cv-qualified) void
-// enum { _C_value = 1 };
-//};
+template <class _TypeT, class _TypeU, bool = __rw_is_array<_TypeT>::value,
+ bool = __rw_is_function<_TypeT>::value>
+struct __rw_is_convertible_3
+{
+ // _TypeT is neither an array nor a function type, so just do a
+ // straight conversion test
+ enum { _C_value = __rw_is_convertible_impl<_TypeT, _TypeU>::_C_value };
+};
+
+template <class _TypeT, class _TypeU>
+struct __rw_is_convertible_3<_TypeT,_TypeU,true,false>
+{
+ // _TypeT is an array type, see if we can convert it to a _TypeU*
+ typedef _TYPENAME __rw_remove_extent<_TypeT>::type _TypeV;
+ typedef _TYPENAME __rw_add_pointer<_TypeV>::type _TypeT_Ptr;
+
+ enum { _C_value = __rw_is_convertible_impl<_TypeT_Ptr, _TypeU>::_C_value };
+};
+
+template <class _TypeT, class _TypeU>
+struct __rw_is_convertible_3<_TypeT,_TypeU,false,true>
+{
+ // _TypeT is an function type, try to convert to reference or pointer
+ typedef _TYPENAME __rw_add_lvalue_reference<_TypeT>::type _TypeT_Ref;
+ typedef _TYPENAME __rw_add_pointer<_TypeT>::type _TypeT_Ptr;
+
+ enum { _C_value = __rw_is_convertible_impl<_TypeT_Ref, _TypeU>::_C_value
+ || __rw_is_convertible_impl<_TypeT_Ptr,
_TypeU>::_C_value };
+};
+
+template <class _TypeT, class _TypeU, bool = __rw_is_array<_TypeU>::value
+ ||__rw_is_function<_TypeU>::value>
+struct __rw_is_convertible_2
+{
+ // _TypeU is neither an array nor a function type
+ enum { _C_value = __rw_is_convertible_3<_TypeT, _TypeU>::_C_value };
+};
+
+template <class _TypeT, class _TypeU>
+struct __rw_is_convertible_2<_TypeT, _TypeU, true>
+{
+ // _TypeU is either an array or a function type, and we can't convert to
+ // either of those.
+ enum { _C_value = 0 };
+};
+
+template <class _TypeT, class _TypeU, bool = __rw_is_void<_TypeT>::value,
+ bool = __rw_is_void<_TypeU>::value>
+struct __rw_is_convertible_1
+{
+ // void-to-non-void or non-void to void
+ enum { _C_value = 0 };
+};
+
+template <class _TypeT, class _TypeU>
+struct __rw_is_convertible_1<_TypeT, _TypeU, false, false>
+{
+ // neither is _TypeT or _TypeU is (possibly cv-qualified) void
+ enum { _C_value = __rw_is_convertible_2<_TypeT,_TypeU>::_C_value };
+};
+
+template <class _TypeT, class _TypeU>
+struct __rw_is_convertible_1<_TypeT, _TypeU, true, true>
+{
+ // both _TypeT and _TypeU are (possibly cv-qualified) void
+ enum { _C_value = 1 };
+};
/**
* BinaryTypeTrait indicates that _TypeT is convertible to _TypeU
@@ -187,15 +187,20 @@
*/
template <class _TypeT, class _TypeU>
struct __rw_is_convertible
+#ifdef _RWSTD_TT_IS_CONVERTIBLE
: __rw_integral_constant<bool, _RWSTD_TT_IS_CONVERTIBLE(_TypeT,_TypeU)>
+#else
+ : __rw_integral_constant<bool,
+ __rw_is_convertible_1<_TypeT, _TypeU>::_C_value>
+#endif
{
//_RWSTD_COMPILE_ASSERT ( _RWSTD_IS_COMPLETE (_TypeT)
// || _RWSTD_IS_ARRAY (_TypeT)
// || _RWSTD_IS_VOID (_TypeT));
};
-//#define _RWSTD_IS_CONVERTIBLE(T,U) \
-// __rw_is_convertible<T,U>::value
+#define _RWSTD_IS_CONVERTIBLE(T,U) \
+ __rw_is_convertible<T,U>::value
} // namespace __rw
Modified: stdcxx/branches/4.3.x/include/type_traits
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/include/type_traits?rev=667396&r1=667395&r2=667396&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/include/type_traits (original)
+++ stdcxx/branches/4.3.x/include/type_traits Fri Jun 13 00:34:29 2008
@@ -1,4 +1,4 @@
- // -*- C++ -*-
+// -*- C++ -*-
/***************************************************************************
*
* type_traits - definition of type_traits types
@@ -197,7 +197,7 @@
* interface for various type traits.
*/
template <class _TypeT, _TypeT _Value>
-struct integral_constant : _RW::__rw_integral_constant<_TypeT, _Value>
+struct integral_constant
{
/**
* Describes the type of this integral_constant.
@@ -209,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
Modified: stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.sign.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.sign.cpp?rev=667396&r1=667395&r2=667396&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.sign.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.meta.trans.sign.cpp Fri Jun 13
00:34:29 2008
@@ -81,7 +81,7 @@
const char* get_type_name (const volatile void*)
{
return "unknown";
-};
+}
#define _RETURN_TYPE_NAME(T) \
const char* get_type_name (T*) { return #T; }
@@ -143,7 +143,7 @@
void test_sign_and_cv (int line,
const char* trait_name,
const char* type_name,
- size_t got_size, size_t exp_size,
+ _RWSTD_SIZE_T got_size, _RWSTD_SIZE_T exp_size,
bool got_sign, bool exp_sign,
bool got_c, bool exp_c,
bool got_v, bool exp_v)
@@ -227,21 +227,21 @@
static void test_make_unsigned ()
{
- TEST (std::make_unsigned, unsigned char, unsigned char);
- TEST (std::make_unsigned, ununsigned char, unsigned char);
+ TEST (std::make_unsigned, signed char, unsigned char);
+ TEST (std::make_unsigned, unsigned char, unsigned char);
- TEST (std::make_unsigned, unsigned short, unsigned short);
- TEST (std::make_unsigned, ununsigned short, unsigned short);
+ TEST (std::make_unsigned, signed short, unsigned short);
+ TEST (std::make_unsigned, unsigned short, unsigned short);
- TEST (std::make_unsigned, unsigned int, unsigned int);
- TEST (std::make_unsigned, ununsigned int, unsigned int);
+ TEST (std::make_unsigned, signed int, unsigned int);
+ TEST (std::make_unsigned, unsigned int, unsigned int);
- TEST (std::make_unsigned, unsigned long, unsigned long);
- TEST (std::make_unsigned, ununsigned long, unsigned long);
+ TEST (std::make_unsigned, signed long, unsigned long);
+ TEST (std::make_unsigned, unsigned long, unsigned long);
#ifndef _RWSTD_NO_LONG_LONG
- TEST (std::make_unsigned, unsigned long long, unsigned long long);
- TEST (std::make_unsigned, ununsigned long long, unsigned long long);
+ TEST (std::make_unsigned, signed long long, unsigned long long);
+ TEST (std::make_unsigned, unsigned long long, unsigned long long);
#endif // _RWSTD_NO_LONG_LONG
TEST_MAKE_UNSIGNED (char);
Modified: stdcxx/branches/4.3.x/tests/utilities/20.meta.unary.prop.cpp
URL:
http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/utilities/20.meta.unary.prop.cpp?rev=667396&r1=667395&r2=667396&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/utilities/20.meta.unary.prop.cpp (original)
+++ stdcxx/branches/4.3.x/tests/utilities/20.meta.unary.prop.cpp Fri Jun 13
00:34:29 2008
@@ -208,14 +208,15 @@
void test_trait (int line,
const char* trait, const char* type,
- size_t value, size_t expect)
+ _RWSTD_SIZE_T value, _RWSTD_SIZE_T expect)
{
rw_assert (value == expect, 0, line,
"%s<%s>::value is %zu, expected %zu",
trait, type, value, expect);
}
-void test_trait (int line, size_t depth, size_t value, size_t expect,
+void test_trait (int line, _RWSTD_SIZE_T depth,
+ _RWSTD_SIZE_T value, _RWSTD_SIZE_T expect,
const char* trait, const char* type)
{
rw_assert (value == expect, 0, line,
@@ -280,9 +281,9 @@
// array types
TEST (std::is_const, int [2], false);
- TEST (std::is_const, C int [2], false);
+ TEST (std::is_const, C int [2], true);
TEST (std::is_const, V int [2], false);
- TEST (std::is_const, CV int [2], false);
+ TEST (std::is_const, CV int [2], true);
}
void test_is_volatile ()
@@ -327,18 +328,92 @@
// array types
TEST (std::is_volatile, int [2], false);
TEST (std::is_volatile, C int [2], false);
- TEST (std::is_volatile, V int [2], false);
- TEST (std::is_volatile, CV int [2], false);
+ TEST (std::is_volatile, V int [2], true);
+ TEST (std::is_volatile, CV int [2], true);
}
+static void test_has_trivial_assign ()
+{
+ TEST (std::has_trivial_assign, long, true);
+ TEST (std::has_trivial_assign, C long, false);
+ TEST (std::has_trivial_assign, V long, true);
+ TEST (std::has_trivial_assign, CV long, false);
+
+ TEST (std::has_trivial_assign, long&, false);
+ TEST (std::has_trivial_assign, C long&, false);
+ TEST (std::has_trivial_assign, V long&, false);
+ TEST (std::has_trivial_assign, CV long&, false);
+
+ TEST (std::has_trivial_assign, long[2], true);
+
+ TEST (std::has_trivial_assign, struct_t, true);
+
+ TEST (std::has_trivial_assign, no_trivial_assign_t, false);
+ TEST (std::has_trivial_assign, public_derived_t<no_trivial_assign_t>,
false);
+}
+
+static void test_has_nothrow_assign ()
+{
+ TEST (std::has_nothrow_assign, long, true);
+ TEST (std::has_nothrow_assign, C long, false);
+ TEST (std::has_nothrow_assign, V long, true);
+ TEST (std::has_nothrow_assign, CV long, false);
+
+ TEST (std::has_nothrow_assign, long&, false);
+ TEST (std::has_nothrow_assign, C long&, false);
+ TEST (std::has_nothrow_assign, V long&, false);
+ TEST (std::has_nothrow_assign, CV long&, false);
+
+ TEST (std::has_nothrow_assign, long[2], true);
+
+ TEST (std::has_nothrow_assign, struct_t, true);
+ TEST (std::has_nothrow_assign, no_trivial_assign_t, true);
+ TEST (std::has_nothrow_assign, throwing_assign_t, false);
+}
+
+static void test_is_trivial ()
+{
+ TEST (std::is_trivial, long, true);
+ TEST (std::is_trivial, C long, false);
+ TEST (std::is_trivial, V long, true);
+ TEST (std::is_trivial, CV long, false);
+
+ TEST (std::is_trivial, long&, false);
+ TEST (std::is_trivial, C long&, false);
+ TEST (std::is_trivial, V long&, false);
+ TEST (std::is_trivial, CV long&, false);
+
+ TEST (std::is_trivial, class_t, true);
+ TEST (std::is_trivial, struct_t, true);
+ TEST (std::is_trivial, union_t, true);
+
+ TEST (std::is_trivial, empty_t, true);
+ TEST (std::is_trivial, public_derived_t<empty_t>, true);
+
+ TEST (std::is_trivial, non_empty_t, true);
+ TEST (std::is_trivial, public_derived_t<non_empty_t>, true);
+
+ TEST (std::is_trivial, abstract_t, false);
+ TEST (std::is_trivial, public_derived_t<abstract_t>, false);
+
+ TEST (std::is_trivial, polymorphic_t, false);
+ TEST (std::is_trivial, public_derived_t<polymorphic_t>, false);
+
+ TEST (std::is_trivial, no_trivial_ctor_t, false);
+ TEST (std::is_trivial, no_trivial_copy_t, false);
+ TEST (std::is_trivial, no_trivial_assign_t, false);
+ TEST (std::is_trivial, no_trivial_dtor_t, false);
+}
+
+
// use traits to avoid warnings on gcc when adding qualifiers to some
// types
#undef TEST
#define TEST(Trait,Type,Expect) \
_TEST(Trait, Type, Expect); \
- _TEST(Trait, _TYPENAME std::add_const<Type>::type, Expect); \
- _TEST(Trait, _TYPENAME std::add_volatile<Type>::type, Expect); \
- _TEST(Trait, _TYPENAME std::add_cv<Type>::type, Expect)
+ _TEST(Trait, std::add_const<Type>::type, Expect); \
+ _TEST(Trait, std::add_volatile<Type>::type, Expect); \
+ _TEST(Trait, std::add_cv<Type>::type, Expect)
static void test_is_standard_layout ()
{
@@ -393,30 +468,6 @@
TEST (std::is_standard_layout, member_t<member_t<int> >, false);
}
-static void test_is_trivial ()
-{
- TEST (std::is_trivial, class_t, true);
- TEST (std::is_trivial, struct_t, true);
- TEST (std::is_trivial, union_t, true);
-
- TEST (std::is_trivial, empty_t, true);
- TEST (std::is_trivial, public_derived_t<empty_t>, true);
-
- TEST (std::is_trivial, non_empty_t, true);
- TEST (std::is_trivial, public_derived_t<non_empty_t>, true);
-
- TEST (std::is_trivial, abstract_t, false);
- TEST (std::is_trivial, public_derived_t<abstract_t>, false);
-
- TEST (std::is_trivial, polymorphic_t, false);
- TEST (std::is_trivial, public_derived_t<polymorphic_t>, false);
-
- TEST (std::is_trivial, no_trivial_ctor_t, false);
- TEST (std::is_trivial, no_trivial_copy_t, false);
- TEST (std::is_trivial, no_trivial_assign_t, false);
- TEST (std::is_trivial, no_trivial_dtor_t, false);
-}
-
static void test_is_pod ()
{
TEST (std::is_pod, long, true);
@@ -505,7 +556,9 @@
static void test_has_trivial_constructor ()
{
- TEST (std::has_trivial_default_constructor, long, false);
+ TEST (std::has_trivial_default_constructor, long, true);
+ TEST (std::has_trivial_default_constructor, long&, false);
+ TEST (std::has_trivial_default_constructor, long[2], true);
TEST (std::has_trivial_default_constructor, struct_t, true);
TEST (std::has_trivial_default_constructor, no_trivial_ctor_t, false);
@@ -514,25 +567,21 @@
static void test_has_trivial_copy ()
{
- TEST (std::has_trivial_copy_constructor, long, false);
+ TEST (std::has_trivial_copy_constructor, long, true);
+ TEST (std::has_trivial_copy_constructor, long&, true);
+ TEST (std::has_trivial_copy_constructor, long[2], true);
+
TEST (std::has_trivial_copy_constructor, struct_t, true);
TEST (std::has_trivial_copy_constructor, no_trivial_copy_t, false);
TEST (std::has_trivial_copy_constructor,
public_derived_t<no_trivial_copy_t>, false);
}
-static void test_has_trivial_assign ()
-{
- TEST (std::has_trivial_assign, long, false);
- TEST (std::has_trivial_assign, struct_t, true);
-
- TEST (std::has_trivial_assign, no_trivial_assign_t, false);
- TEST (std::has_trivial_assign, public_derived_t<no_trivial_assign_t>,
false);
-}
-
static void test_has_trivial_destructor ()
{
- TEST (std::has_trivial_destructor, long, false);
+ TEST (std::has_trivial_destructor, long, true);
+ TEST (std::has_trivial_destructor, long&, true);
+ TEST (std::has_trivial_destructor, long[2], true);
TEST (std::has_trivial_destructor, struct_t, true);
TEST (std::has_trivial_destructor, no_trivial_dtor_t, false);
@@ -541,24 +590,24 @@
static void test_has_nothrow_constructor ()
{
- TEST (std::has_nothrow_default_constructor, long, false);
+ TEST (std::has_nothrow_default_constructor, long, true);
+ TEST (std::has_nothrow_default_constructor, long&, false);
+ TEST (std::has_nothrow_default_constructor, long[2], true);
+
TEST (std::has_nothrow_default_constructor, struct_t, true);
TEST (std::has_nothrow_default_constructor, throwing_ctor_t, false);
}
static void test_has_nothrow_copy ()
{
- TEST (std::has_nothrow_copy_constructor, long, false);
+ TEST (std::has_nothrow_copy_constructor, long, true);
+ TEST (std::has_nothrow_copy_constructor, long&, true);
+ TEST (std::has_nothrow_copy_constructor, long[2], true);
+
TEST (std::has_nothrow_copy_constructor, struct_t, true);
TEST (std::has_nothrow_copy_constructor, throwing_copy_t, false);
}
-static void test_has_nothrow_assign ()
-{
- TEST (std::has_nothrow_assign, struct_t, true);
- TEST (std::has_nothrow_assign, throwing_assign_t, false);
-}
-
static void test_has_virtual_destructor ()
{
TEST (std::has_virtual_destructor, abstract_t, true);