Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2008-04-16 13:35:57


Author: danieljames
Date: 2008-04-16 13:35:56 EDT (Wed, 16 Apr 2008)
New Revision: 44467
URL: http://svn.boost.org/trac/boost/changeset/44467

Log:
Add C++-0x support to the test allocators.

Text files modified:
   branches/unordered/trunk/libs/unordered/test/objects/exception.hpp | 10 ++++++++++
   branches/unordered/trunk/libs/unordered/test/objects/minimal.hpp | 8 ++++++++
   branches/unordered/trunk/libs/unordered/test/objects/test.hpp | 7 +++++++
   3 files changed, 25 insertions(+), 0 deletions(-)

Modified: branches/unordered/trunk/libs/unordered/test/objects/exception.hpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/objects/exception.hpp (original)
+++ branches/unordered/trunk/libs/unordered/test/objects/exception.hpp 2008-04-16 13:35:56 EDT (Wed, 16 Apr 2008)
@@ -347,6 +347,16 @@
             detail::tracker.track_construct((void*) p, sizeof(T), tag_);
         }
 
+#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)
+ template<class... Args> void construct(pointer p, Args&&... args) {
+ UNORDERED_SCOPE(allocator::construct(pointer, Args&&...)) {
+ UNORDERED_EPOINT("Mock allocator construct function.");
+ new(p) T(std::forward<Args>(args)...);
+ }
+ detail::tracker.track_construct((void*) p, sizeof(T), tag_);
+ }
+#endif
+
         void destroy(pointer p) {
             detail::tracker.track_destroy((void*) p, sizeof(T), tag_);
             p->~T();

Modified: branches/unordered/trunk/libs/unordered/test/objects/minimal.hpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/objects/minimal.hpp (original)
+++ branches/unordered/trunk/libs/unordered/test/objects/minimal.hpp 2008-04-16 13:35:56 EDT (Wed, 16 Apr 2008)
@@ -24,6 +24,7 @@
     class copy_constructible;
     class default_copy_constructible;
     class assignable;
+
     template <class T> class hash;
     template <class T> class equal_to;
     template <class T> class ptr;
@@ -207,6 +208,13 @@
         }
 
         void construct(pointer p, T const& t) { new((void*)p.ptr_) T(t); }
+
+#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)
+ template<class... Args> void construct(pointer p, Args&&... args) {
+ new((void*)p.ptr_) T(std::forward<Args>(args)...);
+ }
+#endif
+
         void destroy(pointer p) { ((T*)p.ptr_)->~T(); }
 
         size_type max_size() const { return 1000; }

Modified: branches/unordered/trunk/libs/unordered/test/objects/test.hpp
==============================================================================
--- branches/unordered/trunk/libs/unordered/test/objects/test.hpp (original)
+++ branches/unordered/trunk/libs/unordered/test/objects/test.hpp 2008-04-16 13:35:56 EDT (Wed, 16 Apr 2008)
@@ -212,6 +212,13 @@
             new(p) T(t);
         }
 
+#if defined(BOOST_HAS_RVALUE_REFS) && defined(BOOST_HAS_VARIADIC_TMPL)
+ template<class... Args> void construct(pointer p, Args&&... args) {
+ detail::tracker.track_construct((void*) p, sizeof(T), tag_);
+ new(p) T(std::forward<Args>(args)...);
+ }
+#endif
+
         void destroy(pointer p) {
             detail::tracker.track_destroy((void*) p, sizeof(T), tag_);
             p->~T();


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk