diff options
Diffstat (limited to 'libstdc++-v3/include/tr1_impl/type_traits')
-rw-r--r-- | libstdc++-v3/include/tr1_impl/type_traits | 100 |
1 files changed, 20 insertions, 80 deletions
diff --git a/libstdc++-v3/include/tr1_impl/type_traits b/libstdc++-v3/include/tr1_impl/type_traits index 9035fafece3..2a6227b7c97 100644 --- a/libstdc++-v3/include/tr1_impl/type_traits +++ b/libstdc++-v3/include/tr1_impl/type_traits @@ -32,8 +32,6 @@ * You should not attempt to use it directly. */ -#include <tr1_impl/type_traitsfwd.h> - namespace std { _GLIBCXX_BEGIN_NAMESPACE_TR1 @@ -131,7 +129,13 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 struct is_pointer : public false_type { }; _DEFINE_SPEC(1, is_pointer, _Tp*, true) - + + template<typename _Tp> + struct is_reference; + + template<typename _Tp> + struct is_function; + template<typename> struct is_member_object_pointer : public false_type { }; @@ -172,6 +176,9 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 : public true_type { }; template<typename _Tp> + struct remove_cv; + + template<typename _Tp> struct is_function : public integral_constant<bool, (__is_function_helper<typename remove_cv<_Tp>::type>::value)> @@ -198,6 +205,9 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 { }; template<typename _Tp> + struct is_member_pointer; + + template<typename _Tp> struct is_scalar : public integral_constant<bool, (is_arithmetic<_Tp>::value || is_enum<_Tp>::value @@ -268,8 +278,8 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 template<typename _Tp> struct rank<_Tp[]> : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; - - template<typename, unsigned> + + template<typename, unsigned _Uint = 0> struct extent : public integral_constant<std::size_t, 0> { }; @@ -286,7 +296,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 _Uint == 0 ? 0 : extent<_Tp, _Uint - 1>::value> { }; - + /// @brief relationships between types [4.6]. template<typename, typename> struct is_same @@ -369,84 +379,14 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 struct remove_pointer { typedef _Tp type; }; _DEFINE_SPEC(1, remove_pointer, _Tp*, false) - + + template<typename _Tp> + struct remove_reference; + template<typename _Tp> struct add_pointer { typedef typename remove_reference<_Tp>::type* type; }; - /// @brief other transformations [4.8]. - - // Due to c++/19163 and c++/17743, for the time being we cannot use - // the correct, neat implementation :-( - // - // template<std::size_t _Len, std::size_t _Align> - // struct aligned_storage - // { typedef char type[_Len] __attribute__((__aligned__(_Align))); } - // - // Temporary workaround, useful for Align up to 32: - template<std::size_t, std::size_t> - struct aligned_storage { }; - - template<std::size_t _Len> - struct aligned_storage<_Len, 1> - { - union type - { - unsigned char __data[_Len]; - char __align __attribute__((__aligned__(1))); - }; - }; - - template<std::size_t _Len> - struct aligned_storage<_Len, 2> - { - union type - { - unsigned char __data[_Len]; - char __align __attribute__((__aligned__(2))); - }; - }; - - template<std::size_t _Len> - struct aligned_storage<_Len, 4> - { - union type - { - unsigned char __data[_Len]; - char __align __attribute__((__aligned__(4))); - }; - }; - - template<std::size_t _Len> - struct aligned_storage<_Len, 8> - { - union type - { - unsigned char __data[_Len]; - char __align __attribute__((__aligned__(8))); - }; - }; - - template<std::size_t _Len> - struct aligned_storage<_Len, 16> - { - union type - { - unsigned char __data[_Len]; - char __align __attribute__((__aligned__(16))); - }; - }; - - template<std::size_t _Len> - struct aligned_storage<_Len, 32> - { - union type - { - unsigned char __data[_Len]; - char __align __attribute__((__aligned__(32))); - }; - }; - #undef _DEFINE_SPEC_0_HELPER #undef _DEFINE_SPEC_1_HELPER #undef _DEFINE_SPEC_2_HELPER |