summaryrefslogtreecommitdiffstats
path: root/contrib/libstdc++/include/bits/allocator.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libstdc++/include/bits/allocator.h')
-rw-r--r--contrib/libstdc++/include/bits/allocator.h45
1 files changed, 34 insertions, 11 deletions
diff --git a/contrib/libstdc++/include/bits/allocator.h b/contrib/libstdc++/include/bits/allocator.h
index c9200ec..43939c1 100644
--- a/contrib/libstdc++/include/bits/allocator.h
+++ b/contrib/libstdc++/include/bits/allocator.h
@@ -1,6 +1,7 @@
// Allocators -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+// 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
@@ -15,7 +16,7 @@
// 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,
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// As a special exception, you may use this file as part of a free software
@@ -51,11 +52,14 @@
// Define the base class to std::allocator.
#include <bits/c++allocator.h>
-namespace std
-{
+#include <bits/cpp_type_traits.h> // for __is_empty
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
template<typename _Tp>
class allocator;
+ /// allocator<void> specialization.
template<>
class allocator<void>
{
@@ -72,12 +76,13 @@ namespace std
};
/**
- * @brief The "standard" allocator, as per [20.4].
+ * @brief The "standard" allocator, as per [20.4].
*
- * (See @link Allocators allocators info @endlink for more.)
+ * Further details:
+ * http://gcc.gnu.org/onlinedocs/libstdc++/20_util/allocator.html
*/
template<typename _Tp>
- class allocator: public ___glibcxx_base_allocator<_Tp>
+ class allocator: public __glibcxx_base_allocator<_Tp>
{
public:
typedef size_t size_type;
@@ -94,8 +99,8 @@ namespace std
allocator() throw() { }
- allocator(const allocator& a) throw()
- : ___glibcxx_base_allocator<_Tp>(a) { }
+ allocator(const allocator& __a) throw()
+ : __glibcxx_base_allocator<_Tp>(__a) { }
template<typename _Tp1>
allocator(const allocator<_Tp1>&) throw() { }
@@ -124,7 +129,25 @@ namespace std
#endif
// Undefine.
-#undef ___glibcxx_base_allocator
-} // namespace std
+#undef __glibcxx_base_allocator
+
+ // To implement Option 3 of DR 431.
+ template<typename _Alloc, bool = std::__is_empty<_Alloc>::__value>
+ struct __alloc_swap
+ { static void _S_do_it(_Alloc&, _Alloc&) { } };
+
+ template<typename _Alloc>
+ struct __alloc_swap<_Alloc, false>
+ {
+ static void
+ _S_do_it(_Alloc& __one, _Alloc& __two)
+ {
+ // Precondition: swappable allocators.
+ if (__one != __two)
+ swap(__one, __two);
+ }
+ };
+
+_GLIBCXX_END_NAMESPACE
#endif
OpenPOWER on IntegriCloud