This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] tr1/type_traits: is_member_*_pointer


Hi,

the below is the clean implementation of is_member_function_pointer and
is_member_object_pointer: unfortunately, due to c++/19076, the former
doesn't really work at the moment (it does with Icc, indeed): still
hoping for a Christmas present from the c++ front-end hackers... ;)

Tested x86-linux, committed.

Paolo.

//////////////
2004-12-24  Paolo Carlini  <pcarlini@suse.de>

	* include/tr1/type_traits: Implement is_member_object_pointer,
	is_member_function_pointer. N.B. Due to c++/19076, the latter
	doesn't really work at the moment (a rather ugly work around
	will be provided in case the front-end bug doesn't get fixed
	soon); generalize and extend the _DEFINE_SPEC macros.
	* testsuite/tr1/4_metaprogramming/composite_type_traits/
	is_member_pointer/is_member_pointer.cc: New.
	* testsuite/tr1/4_metaprogramming/composite_type_traits/
	is_member_pointer/typedefs.cc: Likewise.
	* testsuite/tr1/4_metaprogramming/primary_type_categories/
	is_member_function_pointer/is_member_function_pointer.cc: Likewise.
	* testsuite/tr1/4_metaprogramming/primary_type_categories/
	is_member_function_pointer/typedefs.cc: Likewise.
	* testsuite/tr1/4_metaprogramming/primary_type_categories/
	is_member_object_pointer/is_member_object_pointer.cc: Likewise.
	* testsuite/tr1/4_metaprogramming/primary_type_categories/
	is_member_object_pointer/typedefs.cc: Likewise.
diff -prN libstdc++-v3-orig/include/tr1/type_traits libstdc++-v3/include/tr1/type_traits
*** libstdc++-v3-orig/include/tr1/type_traits	Wed Dec 22 19:40:50 2004
--- libstdc++-v3/include/tr1/type_traits	Fri Dec 24 18:33:09 2004
*************** namespace tr1
*** 40,55 ****
      typedef struct { char __arr[2]; } __two;
    };
  
! #define _DEFINE_SPEC_HELPER(_Header, _Spec)                      \
!   template _Header                                               \
!     struct _Spec                                                 \
      : public true_type { };
        
! #define _DEFINE_SPEC(_Header, _Trait, _Type)                     \
!   _DEFINE_SPEC_HELPER(_Header, _Trait<_Type>)                    \
!   _DEFINE_SPEC_HELPER(_Header, _Trait<_Type const>)              \
!   _DEFINE_SPEC_HELPER(_Header, _Trait<_Type volatile>)           \
!   _DEFINE_SPEC_HELPER(_Header, _Trait<_Type const volatile>)
  
    /// @brief  helper classes [4.3].
    template<typename _Tp, _Tp __v>
--- 40,65 ----
      typedef struct { char __arr[2]; } __two;
    };
  
! #define _DEFINE_SPEC_0_HELPER(_Spec)                            \
!   template<>                                                    \
!     struct _Spec                                                \
      : public true_type { };
+ 
+ #define _DEFINE_SPEC_1_HELPER(_Spec)                            \
+   template<typename _Tp>                                        \
+     struct _Spec                                                \
+     _DEFINE_SPEC_1_VAR
        
! #define _DEFINE_SPEC_2_HELPER(_Spec)                            \
!   template<typename _Tp, typename _Cp>                          \
!     struct _Spec                                                \
!     _DEFINE_SPEC_2_VAR
! 
! #define _DEFINE_SPEC(_Order, _Trait, _Type)                     \
!   _DEFINE_SPEC_##_Order##_HELPER(_Trait<_Type>)                 \
!   _DEFINE_SPEC_##_Order##_HELPER(_Trait<_Type const>)           \
!   _DEFINE_SPEC_##_Order##_HELPER(_Trait<_Type volatile>)        \
!   _DEFINE_SPEC_##_Order##_HELPER(_Trait<_Type const volatile>)
  
    /// @brief  helper classes [4.3].
    template<typename _Tp, _Tp __v>
*************** namespace tr1
*** 66,98 ****
    template<typename>
      struct is_void
      : public false_type { };
!   _DEFINE_SPEC(<>, is_void, void)
  
    template<typename>
      struct is_integral
      : public false_type { };
!   _DEFINE_SPEC(<>, is_integral, bool)
!   _DEFINE_SPEC(<>, is_integral, char)
!   _DEFINE_SPEC(<>, is_integral, signed char)
!   _DEFINE_SPEC(<>, is_integral, unsigned char)
  #ifdef _GLIBCXX_USE_WCHAR_T
!   _DEFINE_SPEC(<>, is_integral, wchar_t)
  #endif
!   _DEFINE_SPEC(<>, is_integral, short)
!   _DEFINE_SPEC(<>, is_integral, unsigned short)
!   _DEFINE_SPEC(<>, is_integral, int)
!   _DEFINE_SPEC(<>, is_integral, unsigned int)
!   _DEFINE_SPEC(<>, is_integral, long)
!   _DEFINE_SPEC(<>, is_integral, unsigned long)
!   _DEFINE_SPEC(<>, is_integral, long long)
!   _DEFINE_SPEC(<>, is_integral, unsigned long long)
  
    template<typename>
      struct is_floating_point
      : public false_type { };
!   _DEFINE_SPEC(<>, is_floating_point, float)
!   _DEFINE_SPEC(<>, is_floating_point, double)
!   _DEFINE_SPEC(<>, is_floating_point, long double)
  
    template<typename>
      struct is_array
--- 76,108 ----
    template<typename>
      struct is_void
      : public false_type { };
!   _DEFINE_SPEC(0, is_void, void)
  
    template<typename>
      struct is_integral
      : public false_type { };
!   _DEFINE_SPEC(0, is_integral, bool)
!   _DEFINE_SPEC(0, is_integral, char)
!   _DEFINE_SPEC(0, is_integral, signed char)
!   _DEFINE_SPEC(0, is_integral, unsigned char)
  #ifdef _GLIBCXX_USE_WCHAR_T
!   _DEFINE_SPEC(0, is_integral, wchar_t)
  #endif
!   _DEFINE_SPEC(0, is_integral, short)
!   _DEFINE_SPEC(0, is_integral, unsigned short)
!   _DEFINE_SPEC(0, is_integral, int)
!   _DEFINE_SPEC(0, is_integral, unsigned int)
!   _DEFINE_SPEC(0, is_integral, long)
!   _DEFINE_SPEC(0, is_integral, unsigned long)
!   _DEFINE_SPEC(0, is_integral, long long)
!   _DEFINE_SPEC(0, is_integral, unsigned long long)
  
    template<typename>
      struct is_floating_point
      : public false_type { };
!   _DEFINE_SPEC(0, is_floating_point, float)
!   _DEFINE_SPEC(0, is_floating_point, double)
!   _DEFINE_SPEC(0, is_floating_point, long double)
  
    template<typename>
      struct is_array
*************** namespace tr1
*** 105,115 ****
    template<typename _Tp>
      struct is_array<_Tp[]>
      : public true_type { };
    
    template<typename>
      struct is_pointer
      : public false_type { };
!   _DEFINE_SPEC(<typename _Tp>, is_pointer, _Tp*)
   
    template<typename>
      struct is_reference
--- 115,128 ----
    template<typename _Tp>
      struct is_array<_Tp[]>
      : public true_type { };
+ 
+ #define _DEFINE_SPEC_1_VAR        \
+     : public true_type { };
    
    template<typename>
      struct is_pointer
      : public false_type { };
!   _DEFINE_SPEC(1, is_pointer, _Tp*)
   
    template<typename>
      struct is_reference
*************** namespace tr1
*** 118,124 ****
    template<typename _Tp>
      struct is_reference<_Tp&>
      : public true_type { };
!   
    template<typename _Tp>
      struct __is_function_helper
      : public __sfinae_types
--- 131,154 ----
    template<typename _Tp>
      struct is_reference<_Tp&>
      : public true_type { };
! 
! #define _DEFINE_SPEC_2_VAR        \
!     : public integral_constant<bool, !is_function<_Tp>::value> { };
! 
!   template<typename>
!     struct is_member_object_pointer
!     : public false_type { };
!   _DEFINE_SPEC(2, is_member_object_pointer, _Tp _Cp::*)
! 
! #undef _DEFINE_SPEC_2_VAR
! #define _DEFINE_SPEC_2_VAR        \
!     : public integral_constant<bool, is_function<_Tp>::value> { };
! 
!   template<typename>
!     struct is_member_function_pointer
!     : public false_type { };
!   _DEFINE_SPEC(2, is_member_function_pointer, _Tp _Cp::*)
! 
    template<typename _Tp>
      struct __is_function_helper
      : public __sfinae_types
*************** namespace tr1
*** 322,337 ****
      { typedef typename remove_all_extents<_Tp>::type     type; };
  
    /// @brief  pointer modifications [4.7.4].
! #undef _DEFINE_SPEC_HELPER
! #define _DEFINE_SPEC_HELPER(_Header, _Spec)                      \
!   template _Header                                               \
!     struct _Spec                                                 \
      { typedef _Tp     type; };
  
    template<typename _Tp>
      struct remove_pointer
      { typedef _Tp     type; };
!   _DEFINE_SPEC(<typename _Tp>, remove_pointer, _Tp*)
    
    template<typename _Tp>
      struct add_pointer
--- 352,365 ----
      { typedef typename remove_all_extents<_Tp>::type     type; };
  
    /// @brief  pointer modifications [4.7.4].
! #undef _DEFINE_SPEC_1_VAR
! #define _DEFINE_SPEC_1_VAR        \
      { typedef _Tp     type; };
  
    template<typename _Tp>
      struct remove_pointer
      { typedef _Tp     type; };
!   _DEFINE_SPEC(1, remove_pointer, _Tp*)
    
    template<typename _Tp>
      struct add_pointer
*************** namespace tr1
*** 339,346 ****
  
    /// @brief  other transformations [4.8].
  
! #undef _DEFINE_SPEC_HELPER
! #undef _DEFINE_SPEC
  
  }
  }
--- 367,377 ----
  
    /// @brief  other transformations [4.8].
  
! #undef _DEFINE_SPEC_0_HELPER
! #undef _DEFINE_SPEC_1_HELPER
! #undef _DEFINE_SPEC_2_HELPER
! #undef _DEFINE_SPEC_1_VAR
! #undef _DEFINE_SPEC_2_VAR
  
  }
  }
diff -prN libstdc++-v3-orig/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/is_member_pointer.cc libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/is_member_pointer.cc
*** libstdc++-v3-orig/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/is_member_pointer.cc	Thu Jan  1 01:00:00 1970
--- libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/is_member_pointer.cc	Fri Dec 24 21:03:15 2004
***************
*** 0 ****
--- 1,56 ----
+ // 2004-12-24  Paolo Carlini  <pcarlini@suse.de>
+ //
+ // Copyright (C) 2004 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library.  This library is free
+ // software; you can redistribute it and/or modify it under the
+ // terms of the GNU General Public License as published by the
+ // Free Software Foundation; either version 2, or (at your option)
+ // any later version.
+ //
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ // GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ // USA.
+ 
+ // 4.5.2 Composite type traits
+ 
+ #include <tr1/type_traits>
+ #include <testsuite_hooks.h>
+ #include <testsuite_tr1.h>
+ 
+ void test01()
+ {
+   bool test __attribute__((unused)) = true;
+   using std::tr1::is_member_pointer;
+   using namespace __gnu_test;
+ 
+   VERIFY( (test_category<is_member_pointer, int (ClassType::*)>(true)) );
+   VERIFY( (test_category<is_member_pointer, const int (ClassType::*)>(true)) );
+   VERIFY( (test_category<is_member_pointer, ClassType (ClassType::*)>(true)) );
+ 
+   // Temporarily disabled because of c++/19076 :-(
+ 
+   //VERIFY( (test_category<is_member_pointer,
+   //   int (ClassType::*) (int)>(true)) );
+   //VERIFY( (test_category<is_member_pointer,
+   //   int (ClassType::*) (int) const>(true)) );
+   //VERIFY( (test_category<is_member_function_pointer,
+   //   ClassType (ClassType::*) (ClassType)>(true)) );
+   //VERIFY( (test_category<is_member_pointer,
+   //   float (ClassType::*) (int, float, int[], int&)>(true)) );
+   
+   // Sanity check.
+   VERIFY( (test_category<is_member_pointer, ClassType>(false)) );
+ }
+ 
+ int main()
+ {
+   test01();
+   return 0;
+ }
diff -prN libstdc++-v3-orig/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/typedefs.cc libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/typedefs.cc
*** libstdc++-v3-orig/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/typedefs.cc	Thu Jan  1 01:00:00 1970
--- libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_member_pointer/typedefs.cc	Fri Dec 24 20:38:49 2004
***************
*** 0 ****
--- 1,36 ----
+ // 2004-12-24  Paolo Carlini  <pcarlini@suse.de>
+ //
+ // Copyright (C) 2004 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library.  This library is free
+ // software; you can redistribute it and/or modify it under the
+ // terms of the GNU General Public License as published by the
+ // Free Software Foundation; either version 2, or (at your option)
+ // any later version.
+ //
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ // GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ // USA.
+ 
+ // 
+ // NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES.
+ 
+ #include <tr1/type_traits>
+ 
+ // { dg-do compile }
+ 
+ void test01()
+ {
+   // Check for required typedefs
+   typedef std::tr1::is_member_pointer<int>    test_type;
+   typedef test_type::value_type               value_type;
+   typedef test_type::type                     type;
+   typedef test_type::type::value_type         type_value_type;
+   typedef test_type::type::type               type_type;
+ }
diff -prN libstdc++-v3-orig/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/is_member_function_pointer.cc libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/is_member_function_pointer.cc
*** libstdc++-v3-orig/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/is_member_function_pointer.cc	Thu Jan  1 01:00:00 1970
--- libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/is_member_function_pointer.cc	Fri Dec 24 21:02:51 2004
***************
*** 0 ****
--- 1,62 ----
+ // 2004-12-24  Paolo Carlini  <pcarlini@suse.de>
+ //
+ // Copyright (C) 2004 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library.  This library is free
+ // software; you can redistribute it and/or modify it under the
+ // terms of the GNU General Public License as published by the
+ // Free Software Foundation; either version 2, or (at your option)
+ // any later version.
+ //
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ // GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ // USA.
+ 
+ // 4.5.1 Primary type categories
+ 
+ #include <tr1/type_traits>
+ #include <testsuite_hooks.h>
+ #include <testsuite_tr1.h>
+ 
+ void test01()
+ {
+   bool test __attribute__((unused)) = true;
+   using std::tr1::is_member_function_pointer;
+   using namespace __gnu_test;
+ 
+   // Positive tests.
+ 
+   // Temporarily disabled because of c++/19076 :-(
+ 
+   //VERIFY( (test_category<is_member_function_pointer,
+   //   int (ClassType::*) (int)>(true)) );
+   //VERIFY( (test_category<is_member_function_pointer,
+   //   int (ClassType::*) (int) const>(true)) );
+   //VERIFY( (test_category<is_member_function_pointer,
+   //   ClassType (ClassType::*) (ClassType)>(true)) );
+   //VERIFY( (test_category<is_member_function_pointer,
+   //   float (ClassType::*) (int, float, int[], int&)>(true)) );
+ 
+   // Negative tests.
+   VERIFY( (test_category<is_member_function_pointer,
+ 	   int (ClassType::*)>(false)) );
+   VERIFY( (test_category<is_member_function_pointer,
+ 	   const int (ClassType::*)>(false)) );
+   VERIFY( (test_category<is_member_function_pointer,
+ 	   ClassType (ClassType::*)>(false)) );
+   
+   // Sanity check.
+   VERIFY( (test_category<is_member_function_pointer, ClassType>(false)) );
+ }
+ 
+ int main()
+ {
+   test01();
+   return 0;
+ }
diff -prN libstdc++-v3-orig/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/typedefs.cc libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/typedefs.cc
*** libstdc++-v3-orig/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/typedefs.cc	Thu Jan  1 01:00:00 1970
--- libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_function_pointer/typedefs.cc	Fri Dec 24 19:15:08 2004
***************
*** 0 ****
--- 1,36 ----
+ // 2004-12-24  Paolo Carlini  <pcarlini@suse.de>
+ //
+ // Copyright (C) 2004 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library.  This library is free
+ // software; you can redistribute it and/or modify it under the
+ // terms of the GNU General Public License as published by the
+ // Free Software Foundation; either version 2, or (at your option)
+ // any later version.
+ //
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ // GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ // USA.
+ 
+ // 
+ // NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES.
+ 
+ #include <tr1/type_traits>
+ 
+ // { dg-do compile }
+ 
+ void test01()
+ {
+   // Check for required typedefs
+   typedef std::tr1::is_member_function_pointer<int> test_type;
+   typedef test_type::value_type               value_type;
+   typedef test_type::type                     type;
+   typedef test_type::type::value_type         type_value_type;
+   typedef test_type::type::type               type_type;
+ }
diff -prN libstdc++-v3-orig/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/is_member_object_pointer.cc libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/is_member_object_pointer.cc
*** libstdc++-v3-orig/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/is_member_object_pointer.cc	Thu Jan  1 01:00:00 1970
--- libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/is_member_object_pointer.cc	Fri Dec 24 21:02:27 2004
***************
*** 0 ****
--- 1,59 ----
+ // 2004-12-24  Paolo Carlini  <pcarlini@suse.de>
+ //
+ // Copyright (C) 2004 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library.  This library is free
+ // software; you can redistribute it and/or modify it under the
+ // terms of the GNU General Public License as published by the
+ // Free Software Foundation; either version 2, or (at your option)
+ // any later version.
+ //
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ // GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ // USA.
+ 
+ // 4.5.1 Primary type categories
+ 
+ #include <tr1/type_traits>
+ #include <testsuite_hooks.h>
+ #include <testsuite_tr1.h>
+ 
+ void test01()
+ {
+   bool test __attribute__((unused)) = true;
+   using std::tr1::is_member_object_pointer;
+   using namespace __gnu_test;
+ 
+   // Positive tests.
+   VERIFY( (test_category<is_member_object_pointer,
+ 	   int (ClassType::*)>(true)) );
+   VERIFY( (test_category<is_member_object_pointer,
+ 	   const int (ClassType::*)>(true)) );
+   VERIFY( (test_category<is_member_object_pointer,
+ 	   ClassType (ClassType::*)>(true)) );
+ 
+   // Negative tests.
+   VERIFY( (test_category<is_member_object_pointer,
+ 	   int (ClassType::*) (int)>(false)) );
+   VERIFY( (test_category<is_member_object_pointer,
+ 	   int (ClassType::*) (int) const>(false)) );
+   VERIFY( (test_category<is_member_object_pointer,
+ 	   ClassType (ClassType::*) (ClassType)>(false)) );
+   VERIFY( (test_category<is_member_object_pointer,
+ 	   float (ClassType::*) (int, float, int[], int&)>(false)) );
+ 
+   // Sanity check.
+   VERIFY( (test_category<is_member_object_pointer, ClassType>(false)) );
+ }
+ 
+ int main()
+ {
+   test01();
+   return 0;
+ }
diff -prN libstdc++-v3-orig/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/typedefs.cc libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/typedefs.cc
*** libstdc++-v3-orig/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/typedefs.cc	Thu Jan  1 01:00:00 1970
--- libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_member_object_pointer/typedefs.cc	Fri Dec 24 19:34:46 2004
***************
*** 0 ****
--- 1,36 ----
+ // 2004-12-24  Paolo Carlini  <pcarlini@suse.de>
+ //
+ // Copyright (C) 2004 Free Software Foundation, Inc.
+ //
+ // This file is part of the GNU ISO C++ Library.  This library is free
+ // software; you can redistribute it and/or modify it under the
+ // terms of the GNU General Public License as published by the
+ // Free Software Foundation; either version 2, or (at your option)
+ // any later version.
+ //
+ // This library is distributed in the hope that it will be useful,
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ // GNU General Public License for more details.
+ //
+ // You should have received a copy of the GNU General Public License along
+ // with this library; see the file COPYING.  If not, write to the Free
+ // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ // USA.
+ 
+ // 
+ // NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES.
+ 
+ #include <tr1/type_traits>
+ 
+ // { dg-do compile }
+ 
+ void test01()
+ {
+   // Check for required typedefs
+   typedef std::tr1::is_member_object_pointer<int>   test_type;
+   typedef test_type::value_type               value_type;
+   typedef test_type::type                     type;
+   typedef test_type::type::value_type         type_value_type;
+   typedef test_type::type::type               type_type;
+ }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]