testsuite_allocator.h (tracker_allocator::construct): Update to C++0x definition using type to construct as template parameter.
2011-06-04 Jonathan Wakely <jwakely.gcc@gmail.com> * testsuite/util/testsuite_allocator.h (tracker_allocator::construct): Update to C++0x definition using type to construct as template parameter. (tracker_allocator::destroy): Likewise for type to destroy. (uneq_allocator::construct, uneq_allocator::destroy): Likewise. From-SVN: r174647
This commit is contained in:
parent
26740835ec
commit
6c6424b3d7
|
@ -1,3 +1,11 @@
|
||||||
|
2011-06-04 Jonathan Wakely <jwakely.gcc@gmail.com>
|
||||||
|
|
||||||
|
* testsuite/util/testsuite_allocator.h (tracker_allocator::construct):
|
||||||
|
Update to C++0x definition using type to construct as template
|
||||||
|
parameter.
|
||||||
|
(tracker_allocator::destroy): Likewise for type to destroy.
|
||||||
|
(uneq_allocator::construct, uneq_allocator::destroy): Likewise.
|
||||||
|
|
||||||
2011-06-01 Paolo Carlini <paolo.carlini@oracle.com>
|
2011-06-01 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
* include/bits/hashtable.h (_Hashtable<>::_Hashtable(_Hashtable&&)):
|
* include/bits/hashtable.h (_Hashtable<>::_Hashtable(_Hashtable&&)):
|
||||||
|
|
|
@ -138,6 +138,23 @@ namespace __gnu_test
|
||||||
allocate(size_type n, const void* = 0)
|
allocate(size_type n, const void* = 0)
|
||||||
{ return static_cast<pointer>(counter_type::allocate(n * sizeof(T))); }
|
{ return static_cast<pointer>(counter_type::allocate(n * sizeof(T))); }
|
||||||
|
|
||||||
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
template<typename U, typename... Args>
|
||||||
|
void
|
||||||
|
construct(U* p, Args&&... args)
|
||||||
|
{
|
||||||
|
::new((void *)p) U(std::forward<Args>(args)...);
|
||||||
|
counter_type::construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename U>
|
||||||
|
void
|
||||||
|
destroy(U* p)
|
||||||
|
{
|
||||||
|
p->~U();
|
||||||
|
counter_type::destroy();
|
||||||
|
}
|
||||||
|
#else
|
||||||
void
|
void
|
||||||
construct(pointer p, const T& value)
|
construct(pointer p, const T& value)
|
||||||
{
|
{
|
||||||
|
@ -145,22 +162,13 @@ namespace __gnu_test
|
||||||
counter_type::construct();
|
counter_type::construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
|
||||||
template<typename... Args>
|
|
||||||
void
|
|
||||||
construct(pointer p, Args&&... args)
|
|
||||||
{
|
|
||||||
::new((void *)p) T(std::forward<Args>(args)...);
|
|
||||||
counter_type::construct();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
destroy(pointer p)
|
destroy(pointer p)
|
||||||
{
|
{
|
||||||
p->~T();
|
p->~T();
|
||||||
counter_type::destroy();
|
counter_type::destroy();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
deallocate(pointer p, size_type num)
|
deallocate(pointer p, size_type num)
|
||||||
|
@ -313,34 +321,35 @@ namespace __gnu_test
|
||||||
max_size() const throw()
|
max_size() const throw()
|
||||||
{ return size_type(-1) / sizeof(Tp); }
|
{ return size_type(-1) / sizeof(Tp); }
|
||||||
|
|
||||||
|
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
template<typename U, typename... Args>
|
||||||
|
void
|
||||||
|
construct(U* p, Args&&... args)
|
||||||
|
{ ::new((void *)p) U(std::forward<Args>(args)...); }
|
||||||
|
|
||||||
|
template<typename U>
|
||||||
|
void
|
||||||
|
destroy(U* p) { p->~U(); }
|
||||||
|
|
||||||
|
// Not copy assignable...
|
||||||
|
uneq_allocator&
|
||||||
|
operator=(const uneq_allocator&) = delete;
|
||||||
|
#else
|
||||||
void
|
void
|
||||||
construct(pointer p, const Tp& val)
|
construct(pointer p, const Tp& val)
|
||||||
{ ::new((void *)p) Tp(val); }
|
{ ::new((void *)p) Tp(val); }
|
||||||
|
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
|
||||||
template<typename... Args>
|
|
||||||
void
|
|
||||||
construct(pointer p, Args&&... args)
|
|
||||||
{ ::new((void *)p) Tp(std::forward<Args>(args)...); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
destroy(pointer p) { p->~Tp(); }
|
destroy(pointer p) { p->~Tp(); }
|
||||||
|
|
||||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
|
||||||
// Not copy assignable...
|
|
||||||
uneq_allocator&
|
|
||||||
operator=(const uneq_allocator&) = delete;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#ifndef __GXX_EXPERIMENTAL_CXX0X__
|
|
||||||
// Not assignable...
|
// Not assignable...
|
||||||
uneq_allocator&
|
uneq_allocator&
|
||||||
operator=(const uneq_allocator&);
|
operator=(const uneq_allocator&);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
// ... yet swappable!
|
// ... yet swappable!
|
||||||
friend inline void
|
friend inline void
|
||||||
swap(uneq_allocator& a, uneq_allocator& b)
|
swap(uneq_allocator& a, uneq_allocator& b)
|
||||||
|
|
Loading…
Reference in New Issue