throw_allocator.h: Use noexcept.
2011-06-10 Paolo Carlini <paolo.carlini@oracle.com> * include/ext/throw_allocator.h: Use noexcept. * include/ext/pool_allocator.h: Likewise. * include/ext/bitmap_allocator.h: Likewise. * include/ext/new_allocator.h: Likewise. * include/ext/malloc_allocator.h: Likewise. * include/ext/array_allocator.h: Likewise. * include/ext/mt_allocator.h: Likewise. * include/ext/extptr_allocator.h: Likewise. * testsuite/util/testsuite_allocator.h: Likewise; do not include <cassert> directly, include <testsuite_hooks.h> instead. From-SVN: r174918
This commit is contained in:
parent
30a96b3b0c
commit
7d9cb05400
@ -1,3 +1,16 @@
|
|||||||
|
2011-06-10 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
* include/ext/throw_allocator.h: Use noexcept.
|
||||||
|
* include/ext/pool_allocator.h: Likewise.
|
||||||
|
* include/ext/bitmap_allocator.h: Likewise.
|
||||||
|
* include/ext/new_allocator.h: Likewise.
|
||||||
|
* include/ext/malloc_allocator.h: Likewise.
|
||||||
|
* include/ext/array_allocator.h: Likewise.
|
||||||
|
* include/ext/mt_allocator.h: Likewise.
|
||||||
|
* include/ext/extptr_allocator.h: Likewise.
|
||||||
|
* testsuite/util/testsuite_allocator.h: Likewise; do not include
|
||||||
|
<cassert> directly, include <testsuite_hooks.h> instead.
|
||||||
|
|
||||||
2011-06-10 Benjamin Kosnik <bkoz@redhat.com>
|
2011-06-10 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
* include/ext/pb_ds/*: Doxygen markup redo.
|
* include/ext/pb_ds/*: Doxygen markup redo.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// array allocator -*- C++ -*-
|
// array allocator -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||||
// Free Software Foundation, Inc.
|
// Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
@ -57,10 +57,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
address(reference __x) const { return std::__addressof(__x); }
|
address(reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
const_pointer
|
const_pointer
|
||||||
address(const_reference __x) const { return std::__addressof(__x); }
|
address(const_reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
void
|
void
|
||||||
deallocate(pointer, size_type)
|
deallocate(pointer, size_type)
|
||||||
@ -69,7 +71,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_type
|
size_type
|
||||||
max_size() const throw()
|
max_size() const _GLIBCXX_USE_NOEXCEPT
|
||||||
{ return size_t(-1) / sizeof(_Tp); }
|
{ return size_t(-1) / sizeof(_Tp); }
|
||||||
|
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
@ -120,17 +122,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
struct rebind
|
struct rebind
|
||||||
{ typedef array_allocator<_Tp1, _Array1> other; };
|
{ typedef array_allocator<_Tp1, _Array1> other; };
|
||||||
|
|
||||||
array_allocator(array_type* __array = 0) throw()
|
array_allocator(array_type* __array = 0) _GLIBCXX_USE_NOEXCEPT
|
||||||
: _M_array(__array), _M_used(size_type()) { }
|
: _M_array(__array), _M_used(size_type()) { }
|
||||||
|
|
||||||
array_allocator(const array_allocator& __o) throw()
|
array_allocator(const array_allocator& __o) _GLIBCXX_USE_NOEXCEPT
|
||||||
: _M_array(__o._M_array), _M_used(__o._M_used) { }
|
: _M_array(__o._M_array), _M_used(__o._M_used) { }
|
||||||
|
|
||||||
template<typename _Tp1, typename _Array1>
|
template<typename _Tp1, typename _Array1>
|
||||||
array_allocator(const array_allocator<_Tp1, _Array1>&) throw()
|
array_allocator(const array_allocator<_Tp1, _Array1>&)
|
||||||
|
_GLIBCXX_USE_NOEXCEPT
|
||||||
: _M_array(0), _M_used(size_type()) { }
|
: _M_array(0), _M_used(size_type()) { }
|
||||||
|
|
||||||
~array_allocator() throw() { }
|
~array_allocator() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
allocate(size_type __n, const void* = 0)
|
allocate(size_type __n, const void* = 0)
|
||||||
|
@ -997,17 +997,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
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>
|
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
|
||||||
@ -1042,15 +1042,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
}
|
}
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
address(reference __r) const
|
address(reference __r) const _GLIBCXX_NOEXCEPT
|
||||||
{ return std::__addressof(__r); }
|
{ return std::__addressof(__r); }
|
||||||
|
|
||||||
const_pointer
|
const_pointer
|
||||||
address(const_reference __r) const
|
address(const_reference __r) const _GLIBCXX_NOEXCEPT
|
||||||
{ return std::__addressof(__r); }
|
{ return std::__addressof(__r); }
|
||||||
|
|
||||||
size_type
|
size_type
|
||||||
max_size() const throw()
|
max_size() const _GLIBCXX_USE_NOEXCEPT
|
||||||
{ return size_type(-1) / sizeof(value_type); }
|
{ return size_type(-1) / sizeof(value_type); }
|
||||||
|
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
@ -72,23 +72,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
struct rebind
|
struct rebind
|
||||||
{ typedef _ExtPtr_allocator<_Up> other; };
|
{ typedef _ExtPtr_allocator<_Up> other; };
|
||||||
|
|
||||||
_ExtPtr_allocator() throw()
|
_ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT
|
||||||
: _M_real_alloc() { }
|
: _M_real_alloc() { }
|
||||||
|
|
||||||
_ExtPtr_allocator(const _ExtPtr_allocator &__rarg) throw()
|
_ExtPtr_allocator(const _ExtPtr_allocator& __rarg) _GLIBCXX_USE_NOEXCEPT
|
||||||
: _M_real_alloc(__rarg._M_real_alloc) { }
|
: _M_real_alloc(__rarg._M_real_alloc) { }
|
||||||
|
|
||||||
template<typename _Up>
|
template<typename _Up>
|
||||||
_ExtPtr_allocator(const _ExtPtr_allocator<_Up>& __rarg) throw()
|
_ExtPtr_allocator(const _ExtPtr_allocator<_Up>& __rarg)
|
||||||
|
_GLIBCXX_USE_NOEXCEPT
|
||||||
: _M_real_alloc(__rarg._M_getUnderlyingImp()) { }
|
: _M_real_alloc(__rarg._M_getUnderlyingImp()) { }
|
||||||
|
|
||||||
~_ExtPtr_allocator() throw()
|
~_ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
pointer address(reference __x) const
|
pointer address(reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
{ return std::__addressof(__x); }
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
const_pointer address(const_reference __x) const
|
const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
{ return std::__addressof(__x); }
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
pointer allocate(size_type __n, void* __hint = 0)
|
pointer allocate(size_type __n, void* __hint = 0)
|
||||||
@ -97,7 +98,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
void deallocate(pointer __p, size_type __n)
|
void deallocate(pointer __p, size_type __n)
|
||||||
{ _M_real_alloc.deallocate(__p.get(), __n); }
|
{ _M_real_alloc.deallocate(__p.get(), __n); }
|
||||||
|
|
||||||
size_type max_size() const throw()
|
size_type max_size() const _GLIBCXX_USE_NOEXCEPT
|
||||||
{ return __numeric_traits<size_type>::__max / sizeof(_Tp); }
|
{ return __numeric_traits<size_type>::__max / sizeof(_Tp); }
|
||||||
|
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Allocator that wraps "C" malloc -*- C++ -*-
|
// Allocator that wraps "C" malloc -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||||
|
// 2010, 2011
|
||||||
// Free Software Foundation, Inc.
|
// Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
@ -66,20 +67,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
struct rebind
|
struct rebind
|
||||||
{ typedef malloc_allocator<_Tp1> other; };
|
{ typedef malloc_allocator<_Tp1> other; };
|
||||||
|
|
||||||
malloc_allocator() throw() { }
|
malloc_allocator() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
malloc_allocator(const malloc_allocator&) throw() { }
|
malloc_allocator(const malloc_allocator&) _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
template<typename _Tp1>
|
template<typename _Tp1>
|
||||||
malloc_allocator(const malloc_allocator<_Tp1>&) throw() { }
|
malloc_allocator(const malloc_allocator<_Tp1>&)
|
||||||
|
_GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
~malloc_allocator() throw() { }
|
~malloc_allocator() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
address(reference __x) const { return std::__addressof(__x); }
|
address(reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
const_pointer
|
const_pointer
|
||||||
address(const_reference __x) const { return std::__addressof(__x); }
|
address(const_reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
// NB: __n is permitted to be 0. The C++ standard says nothing
|
// NB: __n is permitted to be 0. The C++ standard says nothing
|
||||||
// about what the return value is when __n == 0.
|
// about what the return value is when __n == 0.
|
||||||
@ -101,7 +105,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
{ std::free(static_cast<void*>(__p)); }
|
{ std::free(static_cast<void*>(__p)); }
|
||||||
|
|
||||||
size_type
|
size_type
|
||||||
max_size() const throw()
|
max_size() const _GLIBCXX_USE_NOEXCEPT
|
||||||
{ return size_t(-1) / sizeof(_Tp); }
|
{ return size_t(-1) / sizeof(_Tp); }
|
||||||
|
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// MT-optimized allocator -*- C++ -*-
|
// MT-optimized allocator -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||||
// Free Software Foundation, Inc.
|
// Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
@ -577,15 +577,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
address(reference __x) const
|
address(reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
{ return std::__addressof(__x); }
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
const_pointer
|
const_pointer
|
||||||
address(const_reference __x) const
|
address(const_reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
{ return std::__addressof(__x); }
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
size_type
|
size_type
|
||||||
max_size() const throw()
|
max_size() const _GLIBCXX_USE_NOEXCEPT
|
||||||
{ return size_t(-1) / sizeof(_Tp); }
|
{ return size_t(-1) / sizeof(_Tp); }
|
||||||
|
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
@ -648,14 +648,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
typedef __mt_alloc<_Tp1, pol_type> other;
|
typedef __mt_alloc<_Tp1, pol_type> other;
|
||||||
};
|
};
|
||||||
|
|
||||||
__mt_alloc() throw() { }
|
__mt_alloc() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
__mt_alloc(const __mt_alloc&) throw() { }
|
__mt_alloc(const __mt_alloc&) _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
template<typename _Tp1, typename _Poolp1>
|
template<typename _Tp1, typename _Poolp1>
|
||||||
__mt_alloc(const __mt_alloc<_Tp1, _Poolp1>&) throw() { }
|
__mt_alloc(const __mt_alloc<_Tp1, _Poolp1>&) _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
~__mt_alloc() throw() { }
|
~__mt_alloc() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
allocate(size_type __n, const void* = 0);
|
allocate(size_type __n, const void* = 0);
|
||||||
|
@ -66,20 +66,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
struct rebind
|
struct rebind
|
||||||
{ typedef new_allocator<_Tp1> other; };
|
{ typedef new_allocator<_Tp1> other; };
|
||||||
|
|
||||||
new_allocator() throw() { }
|
new_allocator() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
new_allocator(const new_allocator&) throw() { }
|
new_allocator(const new_allocator&) _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
template<typename _Tp1>
|
template<typename _Tp1>
|
||||||
new_allocator(const new_allocator<_Tp1>&) throw() { }
|
new_allocator(const new_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
~new_allocator() throw() { }
|
~new_allocator() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
address(reference __x) const { return std::__addressof(__x); }
|
address(reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
const_pointer
|
const_pointer
|
||||||
address(const_reference __x) const { return std::__addressof(__x); }
|
address(const_reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
// NB: __n is permitted to be 0. The C++ standard says nothing
|
// NB: __n is permitted to be 0. The C++ standard says nothing
|
||||||
// about what the return value is when __n == 0.
|
// about what the return value is when __n == 0.
|
||||||
@ -98,7 +100,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
{ ::operator delete(__p); }
|
{ ::operator delete(__p); }
|
||||||
|
|
||||||
size_type
|
size_type
|
||||||
max_size() const throw()
|
max_size() const _GLIBCXX_USE_NOEXCEPT
|
||||||
{ return size_t(-1) / sizeof(_Tp); }
|
{ return size_t(-1) / sizeof(_Tp); }
|
||||||
|
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Allocators -*- C++ -*-
|
// Allocators -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||||
|
// 2010, 2011
|
||||||
// Free Software Foundation, Inc.
|
// Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
@ -139,23 +140,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
struct rebind
|
struct rebind
|
||||||
{ typedef __pool_alloc<_Tp1> other; };
|
{ typedef __pool_alloc<_Tp1> other; };
|
||||||
|
|
||||||
__pool_alloc() throw() { }
|
__pool_alloc() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
__pool_alloc(const __pool_alloc&) throw() { }
|
__pool_alloc(const __pool_alloc&) _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
template<typename _Tp1>
|
template<typename _Tp1>
|
||||||
__pool_alloc(const __pool_alloc<_Tp1>&) throw() { }
|
__pool_alloc(const __pool_alloc<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
~__pool_alloc() throw() { }
|
~__pool_alloc() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
address(reference __x) const { return std::__addressof(__x); }
|
address(reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
const_pointer
|
const_pointer
|
||||||
address(const_reference __x) const { return std::__addressof(__x); }
|
address(const_reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
size_type
|
size_type
|
||||||
max_size() const throw()
|
max_size() const _GLIBCXX_USE_NOEXCEPT
|
||||||
{ return size_t(-1) / sizeof(_Tp); }
|
{ return size_t(-1) / sizeof(_Tp); }
|
||||||
|
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
|
// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||||
// Free Software Foundation, Inc.
|
// Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
@ -618,14 +618,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
size_type
|
size_type
|
||||||
max_size() const throw()
|
max_size() const _GLIBCXX_USE_NOEXCEPT
|
||||||
{ return _M_allocator.max_size(); }
|
{ return _M_allocator.max_size(); }
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
address(reference __x) const { return std::__addressof(__x); }
|
address(reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
const_pointer
|
const_pointer
|
||||||
address(const_reference __x) const { return std::__addressof(__x); }
|
address(const_reference __x) const _GLIBCXX_NOEXCEPT
|
||||||
|
{ return std::__addressof(__x); }
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
allocate(size_type __n, std::allocator<void>::const_pointer hint = 0)
|
allocate(size_type __n, std::allocator<void>::const_pointer hint = 0)
|
||||||
@ -699,14 +701,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
struct rebind
|
struct rebind
|
||||||
{ typedef throw_allocator_limit<_Tp1> other; };
|
{ typedef throw_allocator_limit<_Tp1> other; };
|
||||||
|
|
||||||
throw_allocator_limit() throw() { }
|
throw_allocator_limit() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
throw_allocator_limit(const throw_allocator_limit&) throw() { }
|
throw_allocator_limit(const throw_allocator_limit&)
|
||||||
|
_GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
template<typename _Tp1>
|
template<typename _Tp1>
|
||||||
throw_allocator_limit(const throw_allocator_limit<_Tp1>&) throw() { }
|
throw_allocator_limit(const throw_allocator_limit<_Tp1>&)
|
||||||
|
_GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
~throw_allocator_limit() throw() { }
|
~throw_allocator_limit() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Allocator throwing via random condition.
|
/// Allocator throwing via random condition.
|
||||||
@ -718,14 +722,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||||||
struct rebind
|
struct rebind
|
||||||
{ typedef throw_allocator_random<_Tp1> other; };
|
{ typedef throw_allocator_random<_Tp1> other; };
|
||||||
|
|
||||||
throw_allocator_random() throw() { }
|
throw_allocator_random() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
throw_allocator_random(const throw_allocator_random&) throw() { }
|
throw_allocator_random(const throw_allocator_random&)
|
||||||
|
_GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
template<typename _Tp1>
|
template<typename _Tp1>
|
||||||
throw_allocator_random(const throw_allocator_random<_Tp1>&) throw() { }
|
throw_allocator_random(const throw_allocator_random<_Tp1>&)
|
||||||
|
_GLIBCXX_USE_NOEXCEPT { }
|
||||||
|
|
||||||
~throw_allocator_random() throw() { }
|
~throw_allocator_random() _GLIBCXX_USE_NOEXCEPT { }
|
||||||
};
|
};
|
||||||
|
|
||||||
_GLIBCXX_END_NAMESPACE_VERSION
|
_GLIBCXX_END_NAMESPACE_VERSION
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
// Testing allocator for the C++ library testsuite.
|
// Testing allocator for the C++ library testsuite.
|
||||||
//
|
//
|
||||||
// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||||
// Free Software Foundation, Inc.
|
// Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
@ -28,11 +28,8 @@
|
|||||||
#define _GLIBCXX_TESTSUITE_ALLOCATOR_H
|
#define _GLIBCXX_TESTSUITE_ALLOCATOR_H
|
||||||
|
|
||||||
#include <tr1/unordered_map>
|
#include <tr1/unordered_map>
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
|
||||||
#include <bits/move.h>
|
#include <bits/move.h>
|
||||||
#endif
|
#include <testsuite_hooks.h>
|
||||||
|
|
||||||
namespace __gnu_test
|
namespace __gnu_test
|
||||||
{
|
{
|
||||||
@ -110,28 +107,28 @@ namespace __gnu_test
|
|||||||
template<class U> struct rebind { typedef tracker_allocator<U> other; };
|
template<class U> struct rebind { typedef tracker_allocator<U> other; };
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
address(reference value) const
|
address(reference value) const _GLIBCXX_NOEXCEPT
|
||||||
{ return &value; }
|
{ return std::__addressof(value); }
|
||||||
|
|
||||||
const_pointer
|
const_pointer
|
||||||
address(const_reference value) const
|
address(const_reference value) const _GLIBCXX_NOEXCEPT
|
||||||
{ return &value; }
|
{ return std::__addressof(value); }
|
||||||
|
|
||||||
tracker_allocator() throw()
|
tracker_allocator() _GLIBCXX_USE_NOEXCEPT
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
tracker_allocator(const tracker_allocator&) throw()
|
tracker_allocator(const tracker_allocator&) _GLIBCXX_USE_NOEXCEPT
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
template<class U>
|
template<class U>
|
||||||
tracker_allocator(const tracker_allocator<U>&) throw()
|
tracker_allocator(const tracker_allocator<U>&) _GLIBCXX_USE_NOEXCEPT
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
~tracker_allocator() throw()
|
~tracker_allocator() _GLIBCXX_USE_NOEXCEPT
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
size_type
|
size_type
|
||||||
max_size() const throw()
|
max_size() const _GLIBCXX_USE_NOEXCEPT
|
||||||
{ return size_type(-1) / sizeof(T); }
|
{ return size_type(-1) / sizeof(T); }
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
@ -263,24 +260,29 @@ namespace __gnu_test
|
|||||||
struct rebind
|
struct rebind
|
||||||
{ typedef uneq_allocator<Tp1> other; };
|
{ typedef uneq_allocator<Tp1> other; };
|
||||||
|
|
||||||
uneq_allocator() throw()
|
uneq_allocator() _GLIBCXX_USE_NOEXCEPT
|
||||||
: personality(0) { }
|
: personality(0) { }
|
||||||
|
|
||||||
uneq_allocator(int person) throw()
|
uneq_allocator(int person) _GLIBCXX_USE_NOEXCEPT
|
||||||
: personality(person) { }
|
: personality(person) { }
|
||||||
|
|
||||||
template<typename Tp1>
|
template<typename Tp1>
|
||||||
uneq_allocator(const uneq_allocator<Tp1>& b) throw()
|
uneq_allocator(const uneq_allocator<Tp1>& b) _GLIBCXX_USE_NOEXCEPT
|
||||||
: personality(b.get_personality()) { }
|
: personality(b.get_personality()) { }
|
||||||
|
|
||||||
|
~uneq_allocator() _GLIBCXX_USE_NOEXCEPT
|
||||||
|
{ }
|
||||||
|
|
||||||
int get_personality() const { return personality; }
|
int get_personality() const { return personality; }
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
address(reference x) const { return &x; }
|
address(reference x) const _GLIBCXX_NOEXCEPT
|
||||||
|
{ return std::__addressof(x); }
|
||||||
|
|
||||||
const_pointer
|
const_pointer
|
||||||
address(const_reference x) const { return &x; }
|
address(const_reference x) const _GLIBCXX_NOEXCEPT
|
||||||
|
{ return std::__addressof(x); }
|
||||||
|
|
||||||
pointer
|
pointer
|
||||||
allocate(size_type n, const void* = 0)
|
allocate(size_type n, const void* = 0)
|
||||||
{
|
{
|
||||||
@ -300,27 +302,29 @@ namespace __gnu_test
|
|||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
deallocate(pointer p, size_type)
|
deallocate(pointer p, size_type)
|
||||||
{
|
{
|
||||||
assert( p );
|
bool test __attribute__((unused)) = true;
|
||||||
|
|
||||||
|
VERIFY( p );
|
||||||
|
|
||||||
map_type::iterator it = get_map().find(reinterpret_cast<void*>(p));
|
map_type::iterator it = get_map().find(reinterpret_cast<void*>(p));
|
||||||
assert( it != get_map().end() );
|
VERIFY( it != get_map().end() );
|
||||||
|
|
||||||
// Enforce requirements in Table 32 about deallocation vs
|
// Enforce requirements in Table 32 about deallocation vs
|
||||||
// allocator equality.
|
// allocator equality.
|
||||||
assert( it->second == personality );
|
VERIFY( it->second == personality );
|
||||||
|
|
||||||
get_map().erase(it);
|
get_map().erase(it);
|
||||||
::operator delete(p);
|
::operator delete(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_type
|
size_type
|
||||||
max_size() const throw()
|
max_size() const _GLIBCXX_USE_NOEXCEPT
|
||||||
{ return size_type(-1) / sizeof(Tp); }
|
{ return size_type(-1) / sizeof(Tp); }
|
||||||
|
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
template<typename U, typename... Args>
|
template<typename U, typename... Args>
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user