From: Jonathan Wakely Date: Sat, 4 Jun 2011 17:17:57 +0000 (+0000) Subject: testsuite_allocator.h (tracker_allocator::construct): Update to C++0x definition... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6c6424b3d7fc813396ee33d3d1ebb65d210aecc5;p=gcc.git testsuite_allocator.h (tracker_allocator::construct): Update to C++0x definition using type to construct as template parameter. 2011-06-04 Jonathan Wakely * 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 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0aac5ae28ed..c90eb5c3b28 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2011-06-04 Jonathan Wakely + + * 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 * include/bits/hashtable.h (_Hashtable<>::_Hashtable(_Hashtable&&)): diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h index 73622f1a7a1..e472835c84e 100644 --- a/libstdc++-v3/testsuite/util/testsuite_allocator.h +++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h @@ -138,6 +138,23 @@ namespace __gnu_test allocate(size_type n, const void* = 0) { return static_cast(counter_type::allocate(n * sizeof(T))); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template + void + construct(U* p, Args&&... args) + { + ::new((void *)p) U(std::forward(args)...); + counter_type::construct(); + } + + template + void + destroy(U* p) + { + p->~U(); + counter_type::destroy(); + } +#else void construct(pointer p, const T& value) { @@ -145,22 +162,13 @@ namespace __gnu_test counter_type::construct(); } -#ifdef __GXX_EXPERIMENTAL_CXX0X__ - template - void - construct(pointer p, Args&&... args) - { - ::new((void *)p) T(std::forward(args)...); - counter_type::construct(); - } -#endif - void destroy(pointer p) { p->~T(); counter_type::destroy(); } +#endif void deallocate(pointer p, size_type num) @@ -313,34 +321,35 @@ namespace __gnu_test max_size() const throw() { return size_type(-1) / sizeof(Tp); } - void - construct(pointer p, const Tp& val) - { ::new((void *)p) Tp(val); } - #ifdef __GXX_EXPERIMENTAL_CXX0X__ - template + template void - construct(pointer p, Args&&... args) - { ::new((void *)p) Tp(std::forward(args)...); } -#endif + construct(U* p, Args&&... args) + { ::new((void *)p) U(std::forward(args)...); } - void - destroy(pointer p) { p->~Tp(); } + template + void + destroy(U* p) { p->~U(); } -#ifdef __GXX_EXPERIMENTAL_CXX0X__ // Not copy assignable... uneq_allocator& operator=(const uneq_allocator&) = delete; -#endif +#else + void + construct(pointer p, const Tp& val) + { ::new((void *)p) Tp(val); } - private: + void + destroy(pointer p) { p->~Tp(); } -#ifndef __GXX_EXPERIMENTAL_CXX0X__ + private: // Not assignable... uneq_allocator& operator=(const uneq_allocator&); #endif + private: + // ... yet swappable! friend inline void swap(uneq_allocator& a, uneq_allocator& b)