]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/include/ext/bitmap_allocator.h
Update copyright years in libstdc++-v3/
[thirdparty/gcc.git] / libstdc++-v3 / include / ext / bitmap_allocator.h
index d91d9aa5cc699c781729fb2c78a47f1027a7ce87..2bfbbf5a6d6460c323d6afb499d447413b82e77c 100644 (file)
@@ -1,7 +1,6 @@
 // Bitmap Allocator. -*- C++ -*-
 
-// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
-// Free Software Foundation, Inc.
+// Copyright (C) 2004-2014 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
@@ -30,9 +29,8 @@
 #ifndef _BITMAP_ALLOCATOR_H
 #define _BITMAP_ALLOCATOR_H 1
 
-#include <cstddef> // For std::size_t, and ptrdiff_t.
-#include <bits/functexcept.h> // For __throw_bad_alloc().
 #include <utility> // For std::pair.
+#include <bits/functexcept.h> // For __throw_bad_alloc().
 #include <functional> // For greater_equal, and less_equal.
 #include <new> // For operator new.
 #include <debug/debug.h> // _GLIBCXX_DEBUG_ASSERT
  */
 #define _BALLOC_ALIGN_BYTES 8
 
-_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
-
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
   using std::size_t;
   using std::ptrdiff_t;
 
   namespace __detail
   {
+  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     /** @class  __mini_vector bitmap_allocator.h bitmap_allocator.h
      *
      *  @brief  __mini_vector<> is a stripped down version of the
@@ -59,7 +58,6 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
      *  It is to be used only for built-in types or PODs. Notable
      *  differences are:
      * 
-     *  @detail
      *  1. Not all accessor functions are present.
      *  2. Used ONLY for PODs.
      *  3. No Allocator template argument. Uses ::operator new() to get
@@ -238,8 +236,6 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
       __lower_bound(_ForwardIterator __first, _ForwardIterator __last,
                    const _Tp& __val, _Compare __comp)
       {
-       typedef typename __mv_iter_traits<_ForwardIterator>::value_type
-         _ValueType;
        typedef typename __mv_iter_traits<_ForwardIterator>::difference_type
          _DistanceType;
 
@@ -505,8 +501,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
       size_t __mask = 1 << __pos;
       *__pbmap |= __mask;
     }
+
+  _GLIBCXX_END_NAMESPACE_VERSION
   } // namespace __detail
 
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
   /** @brief  Generic Version of the bsf instruction.
    */
   inline size_t 
@@ -556,7 +556,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
      *  @param  __addr The pointer to the memory block to be
      *  validated.
      *
-     *  @detail  Validates the memory block passed to this function and
+     *  Validates the memory block passed to this function and
      *  appropriately performs the action of managing the free list of
      *  blocks by adding this block to the free list or deleting this
      *  or larger blocks from the free list.
@@ -702,6 +702,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
          typedef bitmap_allocator<_Tp1> other;
        };
 
+#if __cplusplus >= 201103L
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 2103. propagate_on_container_move_assignment
+      typedef std::true_type propagate_on_container_move_assignment;
+#endif
+
     private:
       template<size_t _BSize, size_t _AlignSize>
         struct aligned_size
@@ -753,7 +759,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
        *
        *  @throw  std::bad_alloc. If memory can not be allocated.
        *
-       *  @detail  Complexity: O(1), but internally depends upon the
+       *  Complexity: O(1), but internally depends upon the
        *  complexity of the function free_list::_M_get. The part where
        *  the bitmap headers are written has complexity: O(X),where X
        *  is the number of blocks of size sizeof(value_type) within
@@ -809,7 +815,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
        *
        *  @throw  std::bad_alloc. If memory can not be allocated.
        *
-       *  @detail  Complexity: Worst case complexity is O(N), but that
+       *  Complexity: Worst case complexity is O(N), but that
        *  is hardly ever hit. If and when this particular case is
        *  encountered, the next few cases are guaranteed to have a
        *  worst case complexity of O(1)!  That's why this function
@@ -902,7 +908,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
       /** @brief  Deallocates memory that belongs to a single object of
        *  size sizeof(_Tp).
        *
-       *  @detail  Complexity: O(lg(N)), but the worst case is not hit
+       *  Complexity: O(lg(N)), but the worst case is not hit
        *  often!  This is because containers usually deallocate memory
        *  close to each other and this case is handled in O(1) time by
        *  the deallocate function.
@@ -993,17 +999,17 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
       }
 
     public:
-      bitmap_allocator() throw()
+      bitmap_allocator() _GLIBCXX_USE_NOEXCEPT
       { }
 
-      bitmap_allocator(const bitmap_allocator&)
+      bitmap_allocator(const bitmap_allocator&) _GLIBCXX_USE_NOEXCEPT
       { }
 
       template<typename _Tp1>
-        bitmap_allocator(const bitmap_allocator<_Tp1>&) throw()
+        bitmap_allocator(const bitmap_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT
         { }
 
-      ~bitmap_allocator() throw()
+      ~bitmap_allocator() _GLIBCXX_USE_NOEXCEPT
       { }
 
       pointer 
@@ -1038,31 +1044,36 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
       }
 
       pointer 
-      address(reference __r) const
-      { return &__r; }
+      address(reference __r) const _GLIBCXX_NOEXCEPT
+      { return std::__addressof(__r); }
 
       const_pointer 
-      address(const_reference __r) const
-      { return &__r; }
+      address(const_reference __r) const _GLIBCXX_NOEXCEPT
+      { return std::__addressof(__r); }
 
       size_type 
-      max_size() const throw()
+      max_size() const _GLIBCXX_USE_NOEXCEPT
       { return size_type(-1) / sizeof(value_type); }
 
+#if __cplusplus >= 201103L
+      template<typename _Up, typename... _Args>
+        void
+        construct(_Up* __p, _Args&&... __args)
+       { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
+
+      template<typename _Up>
+        void 
+        destroy(_Up* __p)
+        { __p->~_Up(); }
+#else
       void 
       construct(pointer __p, const_reference __data)
       { ::new((void *)__p) value_type(__data); }
 
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-      template<typename... _Args>
-        void
-        construct(pointer __p, _Args&&... __args)
-       { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }
-#endif
-
       void 
       destroy(pointer __p)
       { __p->~value_type(); }
+#endif
     };
 
   template<typename _Tp1, typename _Tp2>
@@ -1101,7 +1112,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
     bitmap_allocator<_Tp>::_S_mut;
 #endif
 
-_GLIBCXX_END_NAMESPACE
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace __gnu_cxx
 
 #endif