mirror of
https://github.com/boostorg/unordered.git
synced 2025-11-03 01:01:42 +01:00
Unordred: Implement propagate_on_container_swap.
[SVN r73680]
This commit is contained in:
@@ -34,6 +34,16 @@ namespace exception
|
||||
template <class T> class allocator;
|
||||
object generate(object const*);
|
||||
|
||||
struct true_type
|
||||
{
|
||||
enum { value = true };
|
||||
};
|
||||
|
||||
struct false_type
|
||||
{
|
||||
enum { value = false };
|
||||
};
|
||||
|
||||
class object
|
||||
{
|
||||
public:
|
||||
@@ -340,7 +350,7 @@ namespace exception
|
||||
}
|
||||
|
||||
void construct(pointer p, T const& t) {
|
||||
UNORDERED_SCOPE(allocator::construct(pointer, T)) {
|
||||
UNORDERED_SCOPE(allocator::construct(T*, T)) {
|
||||
UNORDERED_EPOINT("Mock allocator construct function.");
|
||||
new(p) T(t);
|
||||
}
|
||||
@@ -348,7 +358,7 @@ namespace exception
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template<class... Args> void construct(pointer p, Args&&... args) {
|
||||
template<class... Args> void construct(T* p, Args&&... args) {
|
||||
UNORDERED_SCOPE(allocator::construct(pointer, Args&&...)) {
|
||||
UNORDERED_EPOINT("Mock allocator construct function.");
|
||||
new(p) T(std::forward<Args>(args)...);
|
||||
@@ -357,7 +367,7 @@ namespace exception
|
||||
}
|
||||
#endif
|
||||
|
||||
void destroy(pointer p) {
|
||||
void destroy(T* p) {
|
||||
detail::tracker.track_destroy((void*) p, sizeof(T), tag_);
|
||||
p->~T();
|
||||
}
|
||||
@@ -368,6 +378,10 @@ namespace exception
|
||||
}
|
||||
return (std::numeric_limits<std::size_t>::max)();
|
||||
}
|
||||
|
||||
typedef true_type propagate_on_container_copy_assignment;
|
||||
typedef true_type propagate_on_container_move_assignment;
|
||||
typedef true_type propagate_on_container_swap;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
|
||||
@@ -279,15 +279,15 @@ namespace minimal
|
||||
::operator delete((void*) p.ptr_);
|
||||
}
|
||||
|
||||
void construct(pointer p, T const& t) { new((void*)p.ptr_) T(t); }
|
||||
void construct(T* p, T const& t) { new((void*)p) T(t); }
|
||||
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template<class... Args> void construct(pointer p, Args&&... args) {
|
||||
new((void*)p.ptr_) T(std::forward<Args>(args)...);
|
||||
template<class... Args> void construct(T* p, Args&&... args) {
|
||||
new((void*)p) T(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
void destroy(pointer p) { ((T*)p.ptr_)->~T(); }
|
||||
void destroy(T* p) { p->~T(); }
|
||||
|
||||
size_type max_size() const { return 1000; }
|
||||
|
||||
|
||||
@@ -27,6 +27,16 @@ namespace test
|
||||
template <class T> class allocator;
|
||||
object generate(object const*);
|
||||
implicitly_convertible generate(implicitly_convertible const*);
|
||||
|
||||
struct true_type
|
||||
{
|
||||
enum { value = true };
|
||||
};
|
||||
|
||||
struct false_type
|
||||
{
|
||||
enum { value = false };
|
||||
};
|
||||
|
||||
class object : globally_counted_object
|
||||
{
|
||||
@@ -268,19 +278,19 @@ namespace test
|
||||
::operator delete((void*) p);
|
||||
}
|
||||
|
||||
void construct(pointer p, T const& t) {
|
||||
void construct(T* p, T const& t) {
|
||||
detail::tracker.track_construct((void*) p, sizeof(T), tag_);
|
||||
new(p) T(t);
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template<class... Args> void construct(pointer p, Args&&... args) {
|
||||
template<class... Args> void construct(T* p, Args&&... args) {
|
||||
detail::tracker.track_construct((void*) p, sizeof(T), tag_);
|
||||
new(p) T(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
void destroy(pointer p) {
|
||||
void destroy(T* p) {
|
||||
detail::tracker.track_destroy((void*) p, sizeof(T), tag_);
|
||||
p->~T();
|
||||
}
|
||||
@@ -298,6 +308,10 @@ namespace test
|
||||
{
|
||||
return tag_ != x.tag_;
|
||||
}
|
||||
|
||||
typedef true_type propagate_on_container_copy_assignment;
|
||||
typedef true_type propagate_on_container_move_assignment;
|
||||
typedef true_type propagate_on_container_swap;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
|
||||
Reference in New Issue
Block a user