// 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
#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
* 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
__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;
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
* @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.
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
*
* @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
*
* @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
/** @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.
}
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
}
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>
bitmap_allocator<_Tp>::_S_mut;
#endif
-_GLIBCXX_END_NAMESPACE
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace __gnu_cxx
#endif