]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cpp_type_traits.h: Add types to the structs thus making type_traits.h redundant...
authorPaolo Carlini <pcarlini@suse.de>
Mon, 31 Jan 2005 16:22:01 +0000 (16:22 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 31 Jan 2005 16:22:01 +0000 (16:22 +0000)
2005-01-31  Paolo Carlini  <pcarlini@suse.de>
    Gabriel Dos Reis  <gdr@integrable-solutions.net>

* include/bits/cpp_type_traits.h: Add types to the structs thus
making type_traits.h redundant; exploit new __truth_type and
__traitor helpers.
* include/bits/type_traits.h: Remove.
* include/Makefile.am: Update.
* include/Makefile.in: Regenerate.
* include/backward/tempbuf.h: Include cpp_type_traits.h instead.
* include/bits/basic_string.h (replace(iterator, iterator,
_InputIterator, _InputIterator), _S_construct(_InIterator,
_InIterator, const _Alloc&)): Use __is_integer instead.
* include/bits/stl_bvector.h (vector(_InputIterator,
_InputIterator, const allocator_type&), assign(_InputIterator,
_InputIterator), insert(iterator, _InputIterator, _InputIterator)):
Likewise.
* include/bits/stl_construct.h (_Destroy(_ForwardIterator,
_ForwardIterator)): Use __is_scalar.
* include/bits/stl_deque.h (deque(_InputIterator, _InputIterator,
const allocator_type&), assign(_InputIterator, _InputIterator),
insert(iterator, _InputIterator, _InputIterator)): Use __is_integer.
* include/bits/stl_list.h (assign(_InputIterator, _InputIterator),
insert(iterator, _InputIterator, _InputIterator)): Likewise.
* include/bits/stl_tempbuf.h (_Temporary_buffer(_ForwardIterator,
_ForwardIterator)): Use __is_scalar.
* include/bits/stl_uninitialized.h (uninitialized_copy(_InputIterator,
_InputIterator, _ForwardIterator), uninitialized_fill(_ForwardIterator,
_ForwardIterator, const _Tp&), uninitialized_fill_n(_ForwardIterator,
_Size, const _Tp&)): Likewise.
* include/bits/stl_vector.h (vector(_InputIterator, _InputIterator,
const allocator_type&), assign(_InputIterator, _InputIterator),
insert(iterator, _InputIterator, _InputIterator)): Use __is_integer.
* include/debug/debug.h (__valid_range(const _InputIterator&,
const _InputIterator&)): Use __is_integer.
* include/ext/slist (assign(_InputIterator, _InputIterator)): Likewise.
* include/std/std_string.h: Include cpp_type_traits.h instead.

Co-Authored-By: Gabriel Dos Reis <gdr@integrable-solutions.net>
From-SVN: r94484

17 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/backward/tempbuf.h
libstdc++-v3/include/bits/basic_string.h
libstdc++-v3/include/bits/cpp_type_traits.h
libstdc++-v3/include/bits/stl_bvector.h
libstdc++-v3/include/bits/stl_construct.h
libstdc++-v3/include/bits/stl_deque.h
libstdc++-v3/include/bits/stl_list.h
libstdc++-v3/include/bits/stl_tempbuf.h
libstdc++-v3/include/bits/stl_uninitialized.h
libstdc++-v3/include/bits/stl_vector.h
libstdc++-v3/include/bits/type_traits.h [deleted file]
libstdc++-v3/include/debug/debug.h
libstdc++-v3/include/ext/slist
libstdc++-v3/include/std/std_string.h

index 63349ec958705de1d0f8b9a6c432cfb9ccbd0a81..c3c526d0dc5cdb74f0b9c0ffa98ea2031a0531f2 100644 (file)
@@ -1,3 +1,41 @@
+2005-01-31  Paolo Carlini  <pcarlini@suse.de>
+           Gabriel Dos Reis  <gdr@integrable-solutions.net>
+
+       * include/bits/cpp_type_traits.h: Add types to the structs thus
+       making type_traits.h redundant; exploit new __truth_type and
+       __traitor helpers.
+       * include/bits/type_traits.h: Remove.
+       * include/Makefile.am: Update.
+       * include/Makefile.in: Regenerate.
+       * include/backward/tempbuf.h: Include cpp_type_traits.h instead.
+       * include/bits/basic_string.h (replace(iterator, iterator,
+       _InputIterator, _InputIterator), _S_construct(_InIterator,
+       _InIterator, const _Alloc&)): Use __is_integer instead.
+       * include/bits/stl_bvector.h (vector(_InputIterator,
+       _InputIterator, const allocator_type&), assign(_InputIterator,
+       _InputIterator), insert(iterator, _InputIterator, _InputIterator)):
+       Likewise.
+       * include/bits/stl_construct.h (_Destroy(_ForwardIterator,
+       _ForwardIterator)): Use __is_scalar.
+       * include/bits/stl_deque.h (deque(_InputIterator, _InputIterator,
+       const allocator_type&), assign(_InputIterator, _InputIterator),
+       insert(iterator, _InputIterator, _InputIterator)): Use __is_integer.
+       * include/bits/stl_list.h (assign(_InputIterator, _InputIterator),
+       insert(iterator, _InputIterator, _InputIterator)): Likewise.
+       * include/bits/stl_tempbuf.h (_Temporary_buffer(_ForwardIterator,
+       _ForwardIterator)): Use __is_scalar.
+       * include/bits/stl_uninitialized.h (uninitialized_copy(_InputIterator,
+       _InputIterator, _ForwardIterator), uninitialized_fill(_ForwardIterator,
+       _ForwardIterator, const _Tp&), uninitialized_fill_n(_ForwardIterator,
+       _Size, const _Tp&)): Likewise.
+       * include/bits/stl_vector.h (vector(_InputIterator, _InputIterator,
+       const allocator_type&), assign(_InputIterator, _InputIterator),
+       insert(iterator, _InputIterator, _InputIterator)): Use __is_integer.
+       * include/debug/debug.h (__valid_range(const _InputIterator&,
+       const _InputIterator&)): Use __is_integer.
+       * include/ext/slist (assign(_InputIterator, _InputIterator)): Likewise.
+       * include/std/std_string.h: Include cpp_type_traits.h instead.
+
 2005-01-30  Paolo Carlini  <pcarlini@suse.de>
 
        PR libstdc++/19642
index be8320a999080930f172e664043df1bab6c5cf26..3fa1dd65e77c2a53328590264e5d96db29df77b2 100644 (file)
@@ -1,6 +1,6 @@
 ## Makefile for the include subdirectory of the GNU C++ Standard library.
 ##
-## Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 ##
 ## This file is part of the libstdc++ version 3 distribution.
 ## Process this file with automake to produce Makefile.in.
@@ -150,7 +150,6 @@ bits_headers = \
        ${bits_srcdir}/stl_vector.h \
        ${bits_srcdir}/streambuf.tcc \
        ${bits_srcdir}/stringfwd.h \
-       ${bits_srcdir}/type_traits.h \
        ${bits_srcdir}/valarray_array.h \
        ${bits_srcdir}/valarray_array.tcc \
        ${bits_srcdir}/valarray_before.h \
index 8a67dcb3104b84a35e96fe15840ebdd7534fe05b..d56d35aab7f1811b86190a64bba9347025f51897 100644 (file)
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.9.4 from Makefile.am.
+# Makefile.in generated by automake 1.9.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -366,7 +366,6 @@ bits_headers = \
        ${bits_srcdir}/stl_vector.h \
        ${bits_srcdir}/streambuf.tcc \
        ${bits_srcdir}/stringfwd.h \
-       ${bits_srcdir}/type_traits.h \
        ${bits_srcdir}/valarray_array.h \
        ${bits_srcdir}/valarray_array.tcc \
        ${bits_srcdir}/valarray_before.h \
index 06de2bd39d478a23f783f8811892a78d80b5b4df..151c4c1fb30d859ac1f82009e930380f0bb6ccd1 100644 (file)
@@ -1,6 +1,6 @@
 // Backward-compat support -*- C++ -*-
 
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2005 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
@@ -62,7 +62,7 @@
 #include <limits.h>
 #include <stddef.h>
 #include <stdlib.h>
-#include <bits/type_traits.h>
+#include <bits/cpp_type_traits.h>
 #include <bits/stl_construct.h>
 #include <bits/stl_uninitialized.h>
 #include <ext/memory>
index f0949b4e5fcb386e3c613a7ab81604732efe7279..2b26fc54d51071d55386f51cb6eecff02803f379 100644 (file)
@@ -1,6 +1,6 @@
 // Components for manipulating sequences of characters -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -1361,7 +1361,7 @@ namespace std
          _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
                                   && __i2 <= _M_iend());
          __glibcxx_requires_valid_range(__k1, __k2);
-         typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+         typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
        }
 
@@ -1451,7 +1451,7 @@ namespace std
         static _CharT*
         _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a)
        {
-         typedef typename _Is_integer<_InIterator>::_Integral _Integral;
+         typedef typename std::__is_integer<_InIterator>::__type _Integral;
          return _S_construct_aux(__beg, __end, __a, _Integral());
         }
 
index 81a1dce7b5bee03805cea8951de0a880a40cf525..547ce08d9a6cfd292eb5164c6be625d83570a05f 100644 (file)
@@ -1,6 +1,7 @@
 // The  -*- C++ -*- type traits classes for internal use in libstdc++
 
-// Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
+// 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
@@ -39,6 +40,8 @@
 
 #pragma GCC system_header
 
+#include <bits/c++config.h>
+
 //
 // This file provides some compile-time information about various types.
 // These representations were designed, on purpose, to be constant-expressions
@@ -63,6 +66,9 @@
 //
 // -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06.
 //
+// Update 2005: types are also provided and <bits/type_traits.h> has been
+// removed.
+//
 
 // NB: g++ can not compile these if declared within the class
 // __is_pod itself.
@@ -84,8 +90,26 @@ namespace __gnu_cxx
     class __normal_iterator;
 } // namespace __gnu_cxx
 
+struct __true_type { };
+struct __false_type { };
+
 namespace std
 {
+  template<bool>
+    struct __truth_type
+    { typedef __false_type __type; };
+
+  template<>
+    struct __truth_type<true>
+    { typedef __true_type __type; };
+
+  template<class _Sp, class _Tp>
+    struct __traitor
+    {
+      enum { _M_type = _Sp::_M_type || _Tp::_M_type };
+      typedef typename __truth_type<_M_type>::__type __type;
+    };
+
   // Compare for equality of types.
   template<typename, typename>
     struct __are_same
@@ -108,7 +132,7 @@ namespace std
   // Define a nested type if some predicate holds.
   template<typename, bool>
     struct __enable_if
-    {
+    { 
     };
 
   template<typename _Tp>
@@ -121,19 +145,15 @@ namespace std
   template<typename _Tp>
     struct __is_void
     {
-      enum
-       {
-         _M_type = 0
-       };
+      enum { _M_type = 0 };
+      typedef __false_type __type;
     };
 
   template<>
     struct __is_void<void>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   //
@@ -142,10 +162,8 @@ namespace std
   template<typename _Tp>
     struct __is_integer
     {
-      enum
-       {
-         _M_type = 0
-       };
+      enum { _M_type = 0 };
+      typedef __false_type __type;
     };
 
   // Thirteen specializations (yes there are eleven standard integer
@@ -154,120 +172,94 @@ namespace std
   template<>
     struct __is_integer<bool>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   template<>
     struct __is_integer<char>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   template<>
     struct __is_integer<signed char>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   template<>
     struct __is_integer<unsigned char>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
 # ifdef _GLIBCXX_USE_WCHAR_T
   template<>
     struct __is_integer<wchar_t>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 # endif
 
   template<>
     struct __is_integer<short>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   template<>
     struct __is_integer<unsigned short>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   template<>
     struct __is_integer<int>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   template<>
     struct __is_integer<unsigned int>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   template<>
     struct __is_integer<long>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   template<>
     struct __is_integer<unsigned long>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   template<>
     struct __is_integer<long long>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   template<>
     struct __is_integer<unsigned long long>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   //
@@ -276,38 +268,30 @@ namespace std
   template<typename _Tp>
     struct __is_floating
     {
-      enum
-       {
-         _M_type = 0
-       };
+      enum { _M_type = 0 };
+      typedef __false_type __type;
     };
 
   // three specializations (float, double and 'long double')
   template<>
     struct __is_floating<float>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   template<>
     struct __is_floating<double>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   template<>
     struct __is_floating<long double>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   //
@@ -316,19 +300,15 @@ namespace std
   template<typename _Tp>
     struct __is_pointer
     {
-      enum
-       {
-         _M_type = 0
-       };
+      enum { _M_type = 0 };
+      typedef __false_type __type;
     };
 
   template<typename _Tp>
     struct __is_pointer<_Tp*>
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   //
@@ -337,20 +317,16 @@ namespace std
   template<typename _Tp>
     struct __is_normal_iterator
     {
-      enum
-       {
-         _M_type = 0
-       };
+      enum { _M_type = 0 };
+      typedef __false_type __type;
     };
 
   template<typename _Iterator, typename _Container>
     struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator,
                                                              _Container> >
     {
-      enum
-       {
-         _M_type = 1
-       };
+      enum { _M_type = 1 };
+      typedef __true_type __type;
     };
 
   //
@@ -358,36 +334,24 @@ namespace std
   //
   template<typename _Tp>
     struct __is_arithmetic
-    {
-      enum
-       {
-         _M_type = __is_integer<_Tp>::_M_type || __is_floating<_Tp>::_M_type
-       };
-    };
-  
+    : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
+    { };
+
   //
   // A fundamental type is `void' or and arithmetic type
   //
   template<typename _Tp>
     struct __is_fundamental
-    {
-      enum
-       {
-         _M_type = __is_void<_Tp>::_M_type || __is_arithmetic<_Tp>::_M_type
-       };
-    };
+    : public __traitor<__is_void<_Tp>, __is_arithmetic<_Tp> >
+    { };
 
   //
   // A scalar type is an arithmetic type or a pointer type
   // 
   template<typename _Tp>
     struct __is_scalar
-    {
-      enum
-       {
-         _M_type = __is_arithmetic<_Tp>::_M_type || __is_pointer<_Tp>::_M_type
-       };
-    };
+    : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
+    { };
 
   //
   // For the immediate use, the following is a good approximation
index a8f1b696a55efb4b6de738a108e0db9496401df5..74985071baa9804d510555cf699b3f9a6bba31f3 100644 (file)
@@ -1,6 +1,6 @@
 // vector<bool> specialization -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005 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
@@ -673,7 +673,7 @@ template<typename _Alloc>
             const allocator_type& __a = allocator_type())
       : _Bvector_base<_Alloc>(__a)
       {
-       typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+       typedef typename std::__is_integer<_InputIterator>::__type _Integral;
        _M_initialize_dispatch(__first, __last, _Integral());
       }
 
@@ -724,7 +724,7 @@ template<typename _Alloc>
       void
       assign(_InputIterator __first, _InputIterator __last)
       {
-       typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+       typedef typename std::__is_integer<_InputIterator>::__type _Integral;
        _M_assign_dispatch(__first, __last, _Integral());
       }
 
@@ -863,7 +863,7 @@ template<typename _Alloc>
       insert(iterator __position,
             _InputIterator __first, _InputIterator __last)
       {
-       typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+       typedef typename std::__is_integer<_InputIterator>::__type _Integral;
        _M_insert_dispatch(__position, __first, __last, _Integral());
       }
 
index 112276e27384a82501c67bf4ced2faefd6dc6974..71acb253a8a5afbd2c52bbc1856f148c25a9dc16 100644 (file)
@@ -1,6 +1,6 @@
 // nonstandard construct and destroy functions -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005 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
@@ -61,7 +61,7 @@
 #ifndef _STL_CONSTRUCT_H
 #define _STL_CONSTRUCT_H 1
 
-#include <bits/type_traits.h>
+#include <bits/cpp_type_traits.h>
 #include <new>
 
 namespace std
@@ -149,8 +149,8 @@ namespace std
     {
       typedef typename iterator_traits<_ForwardIterator>::value_type
                        _Value_type;
-      typedef typename __type_traits<_Value_type>::has_trivial_destructor
-                       _Has_trivial_destructor;
+      typedef typename std::__is_scalar<_Value_type>::__type
+                      _Has_trivial_destructor;
 
       std::__destroy_aux(__first, __last, _Has_trivial_destructor());
     }
index b31143898571664ed5ff580fb616d300b4e69bb3..27d0304ba041ca31e0545f00000921ccc6d8b3c1 100644 (file)
@@ -1,6 +1,6 @@
 // Deque implementation -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005 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
@@ -702,7 +702,7 @@ namespace _GLIBCXX_STD
        : _Base(__a)
         {
          // Check whether it's an integral type.  If so, it's not an iterator.
-         typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+         typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_initialize_dispatch(__first, __last, _Integral());
        }
 
@@ -755,7 +755,7 @@ namespace _GLIBCXX_STD
         void
         assign(_InputIterator __first, _InputIterator __last)
         {
-         typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+         typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_assign_dispatch(__first, __last, _Integral());
        }
 
@@ -1131,7 +1131,7 @@ namespace _GLIBCXX_STD
               _InputIterator __last)
         {
          // Check whether it's an integral type.  If so, it's not an iterator.
-         typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+         typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_insert_dispatch(__position, __first, __last, _Integral());
        }
 
index bada997b0bbbb1e4a4e7d0c49c687906ec103d43..b928e00515baaf9028dfc31800720deec79cb5ec 100644 (file)
@@ -561,7 +561,7 @@ namespace _GLIBCXX_STD
         assign(_InputIterator __first, _InputIterator __last)
         {
          // Check whether it's an integral type.  If so, it's not an iterator.
-         typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+         typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_assign_dispatch(__first, __last, _Integral());
        }
 
@@ -838,7 +838,7 @@ namespace _GLIBCXX_STD
               _InputIterator __last)
         {
          // Check whether it's an integral type.  If so, it's not an iterator.
-         typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+         typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_insert_dispatch(__position, __first, __last, _Integral());
        }
 
index 399cffb3311c38b8da6b5b767b9e5de7afc1a3c8..66ce24052b3a9db5b9520eae9a71d4d966add57f 100644 (file)
@@ -1,6 +1,6 @@
 // Temporary buffer implementation -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2004, 2005 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
@@ -145,8 +145,7 @@ namespace std
       _M_len(0), _M_buffer(0)
     {
       // Workaround for a __type_traits bug in the pre-7.3 compiler.
-      typedef typename __type_traits<_Tp>::has_trivial_default_constructor
-             _Trivial;
+      typedef typename std::__is_scalar<_Tp>::__type _Trivial;
 
       try
        {
index 5c65a26bac10b4944e081364906f796392cdc191..242ae1519cb85915e1c325c3cb8bd61dd7ba2357 100644 (file)
@@ -1,6 +1,6 @@
 // Raw memory manipulators -*- C++ -*-
 
-// Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2004, 2005 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
@@ -108,7 +108,7 @@ namespace std
                       _ForwardIterator __result)
     {
       typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
-      typedef typename __type_traits<_ValueType>::is_POD_type _Is_POD;
+      typedef typename std::__is_scalar<_ValueType>::__type _Is_POD;
       return std::__uninitialized_copy_aux(__first, __last, __result,
                                           _Is_POD());
     }
@@ -170,7 +170,7 @@ namespace std
                       const _Tp& __x)
     {
       typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
-      typedef typename __type_traits<_ValueType>::is_POD_type _Is_POD;
+      typedef typename std::__is_scalar<_ValueType>::__type _Is_POD;
       std::__uninitialized_fill_aux(__first, __last, __x, _Is_POD());
     }
 
@@ -214,7 +214,7 @@ namespace std
     uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)
     {
       typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;
-      typedef typename __type_traits<_ValueType>::is_POD_type _Is_POD;
+      typedef typename std::__is_scalar<_ValueType>::__type _Is_POD;
       std::__uninitialized_fill_n_aux(__first, __n, __x, _Is_POD());
     }
 
index 10433f9ad13ba6d6a970141e89b188d8af5f45f2..3495d9312ae8059884b57186f32ef23b08930fee 100644 (file)
@@ -1,6 +1,6 @@
 // Vector implementation -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005 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
@@ -259,7 +259,7 @@ namespace _GLIBCXX_STD
        : _Base(__a)
         {
          // Check whether it's an integral type.  If so, it's not an iterator.
-         typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+         typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_initialize_dispatch(__first, __last, _Integral());
        }
 
@@ -316,7 +316,7 @@ namespace _GLIBCXX_STD
         assign(_InputIterator __first, _InputIterator __last)
         {
          // Check whether it's an integral type.  If so, it's not an iterator.
-         typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+         typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_assign_dispatch(__first, __last, _Integral());
        }
 
@@ -677,7 +677,7 @@ namespace _GLIBCXX_STD
               _InputIterator __last)
         {
          // Check whether it's an integral type.  If so, it's not an iterator.
-         typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+         typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_insert_dispatch(__position, __first, __last, _Integral());
        }
 
diff --git a/libstdc++-v3/include/bits/type_traits.h b/libstdc++-v3/include/bits/type_traits.h
deleted file mode 100644 (file)
index 0a263e5..0000000
+++ /dev/null
@@ -1,385 +0,0 @@
-// Type traits implementation -*- C++ -*-
-
-// Copyright (C) 2001, 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.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction.  Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License.  This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-/*
- *
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- */
-
-/** @file type_traits.h
- *  This is an internal header file, included by other library headers.
- *  You should not attempt to use it directly.
- */
-
-#ifndef _TYPE_TRAITS_H
-#define _TYPE_TRAITS_H 1
-
-#pragma GCC system_header
-
-#include <bits/c++config.h>
-
-/*
-This header file provides a framework for allowing compile time dispatch
-based on type attributes. This is useful when writing template code.
-For example, when making a copy of an array of an unknown type, it helps
-to know if the type has a trivial copy constructor or not, to help decide
-if a memcpy can be used.
-
-The class template __type_traits provides a series of typedefs each of
-which is either __true_type or __false_type. The argument to
-__type_traits can be any type. The typedefs within this template will
-attain their correct values by one of these means:
-    1. The general instantiation contain conservative values which work
-       for all types.
-    2. Specializations may be declared to make distinctions between types.
-    3. Some compilers (such as the Silicon Graphics N32 and N64 compilers)
-       will automatically provide the appropriate specializations for all
-       types.
-
-EXAMPLE:
-
-//Copy an array of elements which have non-trivial copy constructors
-template <class _Tp> void
-  copy(_Tp* __source,_Tp* __destination,int __n,__false_type);
-//Copy an array of elements which have trivial copy constructors. Use memcpy.
-template <class _Tp> void
-  copy(_Tp* __source,_Tp* __destination,int __n,__true_type);
-
-//Copy an array of any type by using the most efficient copy mechanism
-template <class _Tp> inline void copy(_Tp* __source,_Tp* __destination,int __n) {
-   copy(__source,__destination,__n,
-        typename __type_traits<_Tp>::has_trivial_copy_constructor());
-}
-*/
-
-struct __true_type {};
-struct __false_type {};
-
-template <class _Tp>
-  struct __type_traits
-  {
-    typedef __true_type     this_dummy_member_must_be_first;
-    /* Do not remove this member. It informs a compiler which
-       automatically specializes __type_traits that this
-       __type_traits template is special. It just makes sure that
-       things work if an implementation is using a template
-       called __type_traits for something unrelated. */
-
-   /* The following restrictions should be observed for the sake of
-      compilers which automatically produce type specific specializations
-      of this class:
-          - You may reorder the members below if you wish
-          - You may remove any of the members below if you wish
-          - You must not rename members without making the corresponding
-            name change in the compiler
-          - Members you add will be treated like regular members unless
-            you add the appropriate support in the compiler. */
-
-
-    typedef __false_type    has_trivial_default_constructor;
-    typedef __false_type    has_trivial_copy_constructor;
-    typedef __false_type    has_trivial_assignment_operator;
-    typedef __false_type    has_trivial_destructor;
-    typedef __false_type    is_POD_type;
-  };
-
-
-// Provide some specializations.
-
-template<>
-  struct __type_traits<bool>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<char>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<signed char>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<unsigned char>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<wchar_t>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<short>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<unsigned short>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<int>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<unsigned int>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<long>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<unsigned long>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<long long>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<unsigned long long>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<float>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<double>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template<>
-  struct __type_traits<long double>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-template <class _Tp>
-  struct __type_traits<_Tp*>
-  {
-    typedef __true_type    has_trivial_default_constructor;
-    typedef __true_type    has_trivial_copy_constructor;
-    typedef __true_type    has_trivial_assignment_operator;
-    typedef __true_type    has_trivial_destructor;
-    typedef __true_type    is_POD_type;
-  };
-
-// The following could be written in terms of numeric_limits.
-// We're doing it separately to reduce the number of dependencies.
-
-template <class _Tp>
-  struct _Is_integer
-  {
-    typedef __false_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<bool>
-  {
-    typedef __true_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<char>
-  {
-    typedef __true_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<signed char>
-  {
-    typedef __true_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<unsigned char>
-  {
-    typedef __true_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<wchar_t>
-  {
-    typedef __true_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<short>
-  {
-    typedef __true_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<unsigned short>
-  {
-    typedef __true_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<int>
-  {
-    typedef __true_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<unsigned int>
-  {
-    typedef __true_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<long>
-  {
-    typedef __true_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<unsigned long>
-  {
-    typedef __true_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<long long>
-  {
-    typedef __true_type _Integral;
-  };
-
-template<>
-  struct _Is_integer<unsigned long long>
-  {
-    typedef __true_type _Integral;
-  };
-
-#endif /* _TYPE_TRAITS_H */
-
-// Local Variables:
-// mode:C++
-// End:
index 87bbcfa4db68cb66a62a77e35166542b15e12b8c..94c89e95facf6f2fe9e961fef22e9b2c9730d67b 100644 (file)
@@ -1,6 +1,6 @@
 // Debugging support implementation -*- C++ -*-
 
-// Copyright (C) 2003
+// Copyright (C) 2003, 2005
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -273,7 +273,7 @@ _GLIBCXX_DEBUG_VERIFY(::std::__is_heap(_First, _Last, _Pred),               \
 
 #include <stddef.h>                       // for ptrdiff_t
 #include <bits/stl_iterator_base_types.h> // for iterator_traits, categories
-#include <bits/type_traits.h>             // for _Is_integer
+#include <bits/cpp_type_traits.h>         // for __is_integer
 
 namespace __gnu_debug
 {
@@ -373,7 +373,7 @@ namespace __gnu_debug
     inline bool
     __valid_range(const _InputIterator& __first, const _InputIterator& __last)
     {
-      typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+      typedef typename std::__is_integer<_InputIterator>::__type _Integral;
       return __gnu_debug::__valid_range_aux(__first, __last, _Integral());
     }
 
index fb886d8a7b9b87bdf09b556be03dc8d1f7b1eb5e..9e099e15c729bee0e11f68bf4a6b3823f2e5dc64 100644 (file)
@@ -1,6 +1,6 @@
 // Singly-linked list implementation -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2004, 2005 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
@@ -403,7 +403,7 @@ namespace __gnu_cxx
         void
         assign(_InputIterator __first, _InputIterator __last)
         {
-         typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
+         typedef typename std::__is_integer<_InputIterator>::__type _Integral;
          _M_assign_dispatch(__first, __last, _Integral());
        }
 
@@ -526,7 +526,7 @@ namespace __gnu_cxx
         _M_insert_after_range(_Node_base* __pos,
                              _InIterator __first, _InIterator __last)
         {
-         typedef typename _Is_integer<_InIterator>::_Integral _Integral;
+         typedef typename std::__is_integer<_InIterator>::__type _Integral;
          _M_insert_after_range(__pos, __first, __last, _Integral());
        }
 
index 02fe46e16d3c59f7d4fe6819ebc82337f7044e3d..d2959f34b2789cc291634bbdc813b5c610840373 100644 (file)
@@ -1,6 +1,6 @@
 // Components for manipulating sequences of characters -*- C++ -*-
 
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -45,7 +45,7 @@
 #include <bits/stringfwd.h>
 #include <bits/char_traits.h>
 #include <memory>      // For allocator.
-#include <bits/type_traits.h>
+#include <bits/cpp_type_traits.h>
 #include <iosfwd>      // For operators >>, <<, and getline decls.
 #include <bits/stl_iterator.h>
 #include <bits/stl_function.h>  // For less