Boost logo

Boost-Commit :

From: daniel_james_at_[hidden]
Date: 2008-01-18 14:35:55


Author: danieljames
Date: 2008-01-18 14:35:55 EST (Fri, 18 Jan 2008)
New Revision: 42856
URL: http://svn.boost.org/trac/boost/changeset/42856

Log:
Merge in some changes to the unordered tests.

Properties modified:
   trunk/ (props changed)
Text files modified:
   trunk/libs/unordered/test/helpers/allocator.hpp | 6 +++---
   trunk/libs/unordered/test/objects/exception.hpp | 8 +-------
   trunk/libs/unordered/test/objects/memory.hpp | 28 ++++++++++++++++++++++------
   trunk/libs/unordered/test/objects/test.hpp | 2 +-
   4 files changed, 27 insertions(+), 17 deletions(-)

Modified: trunk/libs/unordered/test/helpers/allocator.hpp
==============================================================================
--- trunk/libs/unordered/test/helpers/allocator.hpp (original)
+++ trunk/libs/unordered/test/helpers/allocator.hpp 2008-01-18 14:35:55 EST (Fri, 18 Jan 2008)
@@ -44,9 +44,9 @@
 
         pointer allocate(size_type n, const_pointer u) { return allocate(n); }
 
-#if defined(__IBMCPP__)
- // Workaround for IBM Visual Age which seems to use a void pointer
- // for the second argument.
+#if defined(__IBMCPP__) || BOOST_WORKAROUND(BOOST_RWSTD_VER, < 0x04020000)
+ // Workaround for IBM Visual Age and Rogue Wave (or maybe just Apache stdcxx?)
+ // which seem to use a void pointer for the second argument.
         pointer allocate(size_type n, void const* u) { return allocate(n); }
 #endif
 

Modified: trunk/libs/unordered/test/objects/exception.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/exception.hpp (original)
+++ trunk/libs/unordered/test/objects/exception.hpp 2008-01-18 14:35:55 EST (Fri, 18 Jan 2008)
@@ -21,15 +21,9 @@
 {
     namespace detail
     {
- struct malloc_allocator_holder {
- template <class T> struct apply {
- typedef test::malloc_allocator<T> type;
- };
- };
-
         namespace
         {
- test::detail::memory_tracker<malloc_allocator_holder> tracker;
+ test::detail::memory_tracker<test::malloc_allocator<int> > tracker;
         }
     }
 

Modified: trunk/libs/unordered/test/objects/memory.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/memory.hpp (original)
+++ trunk/libs/unordered/test/objects/memory.hpp 2008-01-18 14:35:55 EST (Fri, 18 Jan 2008)
@@ -10,6 +10,8 @@
 #include <map>
 #include <boost/mpl/apply.hpp>
 #include <boost/assert.hpp>
+#include <boost/unordered/detail/allocator.hpp>
+#include <boost/mpl/aux_/config/eti.hpp>
 #include "../helpers/test.hpp"
 
 namespace test
@@ -56,14 +58,28 @@
             }
         };
 
- struct default_allocator_holder { template <class T> struct apply {
- typedef std::allocator<T> type; }; };
+ template <class Alloc>
+ struct allocator_memory_type_gen {
+ typedef std::map<memory_area, memory_track, memory_area_compare,
+ Alloc> type;
+ };
 
- template <class AllocatorHolder = default_allocator_holder>
+#if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)
+ template <>
+ struct allocator_memory_type_gen<int> {
+ typedef std::map<memory_area, memory_track, memory_area_compare> type;
+ };
+#endif
+
+ template <class Alloc = std::allocator<int> >
         struct memory_tracker {
- typedef std::map<memory_area, memory_track, memory_area_compare,
- BOOST_DEDUCED_TYPENAME boost::mpl::apply1<AllocatorHolder, std::pair<memory_area const, memory_track> >::type
- > allocated_memory_type;
+ typedef BOOST_DEDUCED_TYPENAME
+ boost::unordered_detail::rebind_wrap<Alloc,
+ std::pair<memory_area const, memory_track> >::type
+ allocator_type;
+
+ typedef BOOST_DEDUCED_TYPENAME allocator_memory_type_gen<allocator_type>::type
+ allocated_memory_type;
 
             allocated_memory_type allocated_memory;
             unsigned int count_allocators;

Modified: trunk/libs/unordered/test/objects/test.hpp
==============================================================================
--- trunk/libs/unordered/test/objects/test.hpp (original)
+++ trunk/libs/unordered/test/objects/test.hpp 2008-01-18 14:35:55 EST (Fri, 18 Jan 2008)
@@ -205,7 +205,7 @@
     namespace detail
     {
         namespace {
- test::detail::memory_tracker<test::detail::default_allocator_holder> tracker;
+ test::detail::memory_tracker<std::allocator<int> > tracker;
         }
     }
 


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