mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-31 20:04:29 +02:00
Merge in some changes to the unordered tests.
[SVN r42856]
This commit is contained in:
@@ -44,9 +44,9 @@ namespace test
|
|||||||
|
|
||||||
pointer allocate(size_type n, const_pointer u) { return allocate(n); }
|
pointer allocate(size_type n, const_pointer u) { return allocate(n); }
|
||||||
|
|
||||||
#if defined(__IBMCPP__)
|
#if defined(__IBMCPP__) || BOOST_WORKAROUND(BOOST_RWSTD_VER, < 0x04020000)
|
||||||
// Workaround for IBM Visual Age which seems to use a void pointer
|
// Workaround for IBM Visual Age and Rogue Wave (or maybe just Apache stdcxx?)
|
||||||
// for the second argument.
|
// which seem to use a void pointer for the second argument.
|
||||||
pointer allocate(size_type n, void const* u) { return allocate(n); }
|
pointer allocate(size_type n, void const* u) { return allocate(n); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -21,15 +21,9 @@ namespace exception
|
|||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
struct malloc_allocator_holder {
|
|
||||||
template <class T> struct apply {
|
|
||||||
typedef test::malloc_allocator<T> type;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
test::detail::memory_tracker<malloc_allocator_holder> tracker;
|
test::detail::memory_tracker<test::malloc_allocator<int> > tracker;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <boost/mpl/apply.hpp>
|
#include <boost/mpl/apply.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
#include <boost/unordered/detail/allocator.hpp>
|
||||||
|
#include <boost/mpl/aux_/config/eti.hpp>
|
||||||
#include "../helpers/test.hpp"
|
#include "../helpers/test.hpp"
|
||||||
|
|
||||||
namespace test
|
namespace test
|
||||||
@@ -56,14 +58,28 @@ namespace test
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct default_allocator_holder { template <class T> struct apply {
|
template <class Alloc>
|
||||||
typedef std::allocator<T> type; }; };
|
struct allocator_memory_type_gen {
|
||||||
|
|
||||||
template <class AllocatorHolder = default_allocator_holder>
|
|
||||||
struct memory_tracker {
|
|
||||||
typedef std::map<memory_area, memory_track, memory_area_compare,
|
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
|
Alloc> type;
|
||||||
> allocated_memory_type;
|
};
|
||||||
|
|
||||||
|
#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 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;
|
allocated_memory_type allocated_memory;
|
||||||
unsigned int count_allocators;
|
unsigned int count_allocators;
|
||||||
|
@@ -205,7 +205,7 @@ namespace test
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
namespace {
|
namespace {
|
||||||
test::detail::memory_tracker<test::detail::default_allocator_holder> tracker;
|
test::detail::memory_tracker<std::allocator<int> > tracker;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user