mirror of
https://github.com/boostorg/unordered.git
synced 2025-10-10 06:31:06 +02:00
Unordered: Remove malloc_allocator.
It was originally introduced because of some issues with Boost.Test and older compilers, neither of which I'm using now. Simplifies a few things. [SVN r79352]
This commit is contained in:
@@ -13,21 +13,12 @@
|
||||
#include <boost/limits.hpp>
|
||||
#include <new>
|
||||
#include "../helpers/fwd.hpp"
|
||||
#include "../helpers/allocator.hpp"
|
||||
#include "../helpers/memory.hpp"
|
||||
|
||||
namespace test
|
||||
{
|
||||
namespace exception
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace
|
||||
{
|
||||
test::detail::memory_tracker<test::malloc_allocator<int> > tracker;
|
||||
}
|
||||
}
|
||||
|
||||
class object;
|
||||
class hash;
|
||||
class equal_to;
|
||||
@@ -259,7 +250,7 @@ namespace exception
|
||||
UNORDERED_SCOPE(allocator::allocator()) {
|
||||
UNORDERED_EPOINT("Mock allocator default constructor.");
|
||||
}
|
||||
detail::tracker.allocator_ref();
|
||||
test::detail::tracker.allocator_ref();
|
||||
}
|
||||
|
||||
template <class Y> allocator(allocator<Y> const& x) : tag_(x.tag_)
|
||||
@@ -267,7 +258,7 @@ namespace exception
|
||||
UNORDERED_SCOPE(allocator::allocator()) {
|
||||
UNORDERED_EPOINT("Mock allocator template copy constructor.");
|
||||
}
|
||||
detail::tracker.allocator_ref();
|
||||
test::detail::tracker.allocator_ref();
|
||||
}
|
||||
|
||||
allocator(allocator const& x) : tag_(x.tag_)
|
||||
@@ -275,11 +266,11 @@ namespace exception
|
||||
UNORDERED_SCOPE(allocator::allocator()) {
|
||||
UNORDERED_EPOINT("Mock allocator copy constructor.");
|
||||
}
|
||||
detail::tracker.allocator_ref();
|
||||
test::detail::tracker.allocator_ref();
|
||||
}
|
||||
|
||||
~allocator() {
|
||||
detail::tracker.allocator_unref();
|
||||
test::detail::tracker.allocator_unref();
|
||||
}
|
||||
|
||||
allocator& operator=(allocator const& x) {
|
||||
@@ -317,7 +308,7 @@ namespace exception
|
||||
ptr = (T*) malloc(n * sizeof(T));
|
||||
if(!ptr) throw std::bad_alloc();
|
||||
}
|
||||
detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_);
|
||||
test::detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_);
|
||||
return pointer(ptr);
|
||||
|
||||
//return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
|
||||
@@ -333,7 +324,7 @@ namespace exception
|
||||
ptr = (T*) malloc(n * sizeof(T));
|
||||
if(!ptr) throw std::bad_alloc();
|
||||
}
|
||||
detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_);
|
||||
test::detail::tracker.track_allocate((void*) ptr, n, sizeof(T), tag_);
|
||||
return pointer(ptr);
|
||||
|
||||
//return pointer(static_cast<T*>(::operator new(n * sizeof(T))));
|
||||
@@ -343,7 +334,7 @@ namespace exception
|
||||
{
|
||||
//::operator delete((void*) p);
|
||||
if(p) {
|
||||
detail::tracker.track_deallocate((void*) p, n, sizeof(T), tag_);
|
||||
test::detail::tracker.track_deallocate((void*) p, n, sizeof(T), tag_);
|
||||
using namespace std;
|
||||
free(p);
|
||||
}
|
||||
@@ -354,7 +345,7 @@ namespace exception
|
||||
UNORDERED_EPOINT("Mock allocator construct function.");
|
||||
new(p) T(t);
|
||||
}
|
||||
detail::tracker.track_construct((void*) p, sizeof(T), tag_);
|
||||
test::detail::tracker.track_construct((void*) p, sizeof(T), tag_);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
@@ -363,12 +354,12 @@ namespace exception
|
||||
UNORDERED_EPOINT("Mock allocator construct function.");
|
||||
new(p) T(boost::forward<Args>(args)...);
|
||||
}
|
||||
detail::tracker.track_construct((void*) p, sizeof(T), tag_);
|
||||
test::detail::tracker.track_construct((void*) p, sizeof(T), tag_);
|
||||
}
|
||||
#endif
|
||||
|
||||
void destroy(T* p) {
|
||||
detail::tracker.track_destroy((void*) p, sizeof(T), tag_);
|
||||
test::detail::tracker.track_destroy((void*) p, sizeof(T), tag_);
|
||||
p->~T();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user