2006-05-17 17:19:16 +00:00
|
|
|
|
2009-03-09 20:56:23 +00:00
|
|
|
// Copyright 2006-2009 Daniel James.
|
2006-07-01 22:31:26 +00:00
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
2006-05-17 17:19:16 +00:00
|
|
|
|
|
|
|
#if !defined(BOOST_UNORDERED_TEST_OBJECTS_HEADER)
|
|
|
|
#define BOOST_UNORDERED_TEST_OBJECTS_HEADER
|
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
#include "../helpers/count.hpp"
|
|
|
|
#include "../helpers/fwd.hpp"
|
|
|
|
#include "../helpers/memory.hpp"
|
2006-06-11 19:42:55 +00:00
|
|
|
#include <boost/config.hpp>
|
|
|
|
#include <boost/limits.hpp>
|
2006-05-17 17:19:16 +00:00
|
|
|
#include <cstddef>
|
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
namespace test {
|
2017-06-11 20:55:59 +01:00
|
|
|
// Note that the default hash function will work for any equal_to (but not
|
|
|
|
// very well).
|
|
|
|
class object;
|
|
|
|
class movable;
|
|
|
|
class implicitly_convertible;
|
|
|
|
class hash;
|
|
|
|
class less;
|
|
|
|
class equal_to;
|
|
|
|
template <class T> class allocator1;
|
|
|
|
template <class T> class allocator2;
|
|
|
|
object generate(object const*, random_generator);
|
|
|
|
movable generate(movable const*, random_generator);
|
|
|
|
implicitly_convertible generate(
|
2017-02-19 13:05:17 +00:00
|
|
|
implicitly_convertible const*, random_generator);
|
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
inline void ignore_variable(void const*) {}
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
class object : private counted_object
|
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
friend class hash;
|
|
|
|
friend class equal_to;
|
|
|
|
friend class less;
|
|
|
|
int tag1_, tag2_;
|
2006-10-31 22:19:26 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
public:
|
|
|
|
explicit object(int t1 = 0, int t2 = 0) : tag1_(t1), tag2_(t2) {}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
~object()
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
tag1_ = -1;
|
|
|
|
tag2_ = -1;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend bool operator==(object const& x1, object const& x2)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return x1.tag1_ == x2.tag1_ && x1.tag2_ == x2.tag2_;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend bool operator!=(object const& x1, object const& x2)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return x1.tag1_ != x2.tag1_ || x1.tag2_ != x2.tag2_;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend bool operator<(object const& x1, object const& x2)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return x1.tag1_ < x2.tag1_ ||
|
|
|
|
(x1.tag1_ == x2.tag1_ && x1.tag2_ < x2.tag2_);
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend object generate(object const*, random_generator g)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
int* x = 0;
|
|
|
|
return object(generate(x, g), generate(x, g));
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend std::ostream& operator<<(std::ostream& out, object const& o)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return out << "(" << o.tag1_ << "," << o.tag2_ << ")";
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2017-06-11 20:55:59 +01:00
|
|
|
};
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
class movable : private counted_object
|
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
friend class hash;
|
|
|
|
friend class equal_to;
|
|
|
|
friend class less;
|
|
|
|
int tag1_, tag2_;
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
BOOST_COPYABLE_AND_MOVABLE(movable)
|
|
|
|
public:
|
|
|
|
explicit movable(int t1 = 0, int t2 = 0) : tag1_(t1), tag2_(t2) {}
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
movable(movable const& x)
|
|
|
|
: counted_object(x), tag1_(x.tag1_), tag2_(x.tag2_)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
BOOST_TEST(x.tag1_ != -1);
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
movable(BOOST_RV_REF(movable) x)
|
|
|
|
: counted_object(x), tag1_(x.tag1_), tag2_(x.tag2_)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
BOOST_TEST(x.tag1_ != -1);
|
|
|
|
x.tag1_ = -1;
|
|
|
|
x.tag2_ = -1;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
movable& operator=(BOOST_COPY_ASSIGN_REF(movable) x) // Copy assignment
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
BOOST_TEST(x.tag1_ != -1);
|
|
|
|
tag1_ = x.tag1_;
|
|
|
|
tag2_ = x.tag2_;
|
|
|
|
return *this;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
movable& operator=(BOOST_RV_REF(movable) x) // Move assignment
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
BOOST_TEST(x.tag1_ != -1);
|
|
|
|
tag1_ = x.tag1_;
|
|
|
|
tag2_ = x.tag2_;
|
|
|
|
x.tag1_ = -1;
|
|
|
|
x.tag2_ = -1;
|
|
|
|
return *this;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
~movable()
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
tag1_ = -1;
|
|
|
|
tag2_ = -1;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend bool operator==(movable const& x1, movable const& x2)
|
2011-03-16 21:34:08 +00:00
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
BOOST_TEST(x1.tag1_ != -1 && x2.tag1_ != -1);
|
|
|
|
return x1.tag1_ == x2.tag1_ && x1.tag2_ == x2.tag2_;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2011-03-16 21:34:08 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend bool operator!=(movable const& x1, movable const& x2)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
BOOST_TEST(x1.tag1_ != -1 && x2.tag1_ != -1);
|
|
|
|
return x1.tag1_ != x2.tag1_ || x1.tag2_ != x2.tag2_;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2011-03-16 21:34:08 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend bool operator<(movable const& x1, movable const& x2)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
BOOST_TEST(x1.tag1_ != -1 && x2.tag1_ != -1);
|
|
|
|
return x1.tag1_ < x2.tag1_ ||
|
|
|
|
(x1.tag1_ == x2.tag1_ && x1.tag2_ < x2.tag2_);
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2011-03-16 21:34:08 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend movable generate(movable const*, random_generator g)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
int* x = 0;
|
|
|
|
return movable(generate(x, g), generate(x, g));
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend std::ostream& operator<<(std::ostream& out, movable const& o)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return out << "(" << o.tag1_ << "," << o.tag2_ << ")";
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2017-06-11 20:55:59 +01:00
|
|
|
};
|
2011-03-16 21:34:08 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
class implicitly_convertible : private counted_object
|
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
int tag1_, tag2_;
|
2011-03-16 21:34:08 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
public:
|
|
|
|
explicit implicitly_convertible(int t1 = 0, int t2 = 0)
|
|
|
|
: tag1_(t1), tag2_(t2)
|
|
|
|
{
|
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
operator object() const { return object(tag1_, tag2_); }
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
operator movable() const { return movable(tag1_, tag2_); }
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend implicitly_convertible generate(
|
2017-06-11 20:55:59 +01:00
|
|
|
implicitly_convertible const*, random_generator g)
|
2017-02-19 13:05:17 +00:00
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
int* x = 0;
|
|
|
|
return implicitly_convertible(generate(x, g), generate(x, g));
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend std::ostream& operator<<(
|
2017-06-11 20:55:59 +01:00
|
|
|
std::ostream& out, implicitly_convertible const& o)
|
2017-02-19 13:05:17 +00:00
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return out << "(" << o.tag1_ << "," << o.tag2_ << ")";
|
2009-09-27 19:12:04 +00:00
|
|
|
}
|
2017-06-11 20:55:59 +01:00
|
|
|
};
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
// Note: This is a deliberately bad hash function.
|
|
|
|
class hash
|
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
int type_;
|
|
|
|
|
|
|
|
public:
|
2018-01-20 11:49:07 +00:00
|
|
|
hash() : type_(0) {}
|
|
|
|
|
|
|
|
explicit hash(int t) : type_(t) {}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
std::size_t operator()(object const& x) const
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
int result;
|
|
|
|
switch (type_) {
|
|
|
|
case 1:
|
|
|
|
result = x.tag1_;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
result = x.tag2_;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
result = x.tag1_ + x.tag2_;
|
|
|
|
}
|
|
|
|
return static_cast<std::size_t>(result);
|
2012-09-26 08:09:26 +00:00
|
|
|
}
|
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
std::size_t operator()(movable const& x) const
|
2006-05-17 17:19:16 +00:00
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
int result;
|
|
|
|
switch (type_) {
|
|
|
|
case 1:
|
|
|
|
result = x.tag1_;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
result = x.tag2_;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
result = x.tag1_ + x.tag2_;
|
|
|
|
}
|
|
|
|
return static_cast<std::size_t>(result);
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
std::size_t operator()(int x) const
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
int result;
|
|
|
|
switch (type_) {
|
|
|
|
case 1:
|
|
|
|
result = x;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
result = x * 7;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
result = x * 256;
|
|
|
|
}
|
|
|
|
return static_cast<std::size_t>(result);
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend bool operator==(hash const& x1, hash const& x2)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return x1.type_ == x2.type_;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend bool operator!=(hash const& x1, hash const& x2)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return x1.type_ != x2.type_;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2017-06-11 20:55:59 +01:00
|
|
|
};
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
std::size_t hash_value(test::object const& x) { return hash()(x); }
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
std::size_t hash_value(test::movable const& x) { return hash()(x); }
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
class less
|
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
int type_;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit less(int t = 0) : type_(t) {}
|
|
|
|
|
|
|
|
bool operator()(object const& x1, object const& x2) const
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
switch (type_) {
|
|
|
|
case 1:
|
|
|
|
return x1.tag1_ < x2.tag1_;
|
|
|
|
case 2:
|
|
|
|
return x1.tag2_ < x2.tag2_;
|
|
|
|
default:
|
|
|
|
return x1 < x2;
|
|
|
|
}
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
bool operator()(movable const& x1, movable const& x2) const
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
switch (type_) {
|
|
|
|
case 1:
|
|
|
|
return x1.tag1_ < x2.tag1_;
|
|
|
|
case 2:
|
|
|
|
return x1.tag2_ < x2.tag2_;
|
|
|
|
default:
|
|
|
|
return x1 < x2;
|
|
|
|
}
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
std::size_t operator()(int x1, int x2) const { return x1 < x2; }
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend bool operator==(less const& x1, less const& x2)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return x1.type_ == x2.type_;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2017-06-11 20:55:59 +01:00
|
|
|
};
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
class equal_to
|
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
int type_;
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
public:
|
2018-01-20 11:49:07 +00:00
|
|
|
equal_to() : type_(0) {}
|
|
|
|
|
|
|
|
explicit equal_to(int t) : type_(t) {}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
bool operator()(object const& x1, object const& x2) const
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
switch (type_) {
|
|
|
|
case 1:
|
|
|
|
return x1.tag1_ == x2.tag1_;
|
|
|
|
case 2:
|
|
|
|
return x1.tag2_ == x2.tag2_;
|
|
|
|
default:
|
|
|
|
return x1 == x2;
|
|
|
|
}
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
bool operator()(movable const& x1, movable const& x2) const
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
switch (type_) {
|
|
|
|
case 1:
|
|
|
|
return x1.tag1_ == x2.tag1_;
|
|
|
|
case 2:
|
|
|
|
return x1.tag2_ == x2.tag2_;
|
|
|
|
default:
|
|
|
|
return x1 == x2;
|
|
|
|
}
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
std::size_t operator()(int x1, int x2) const { return x1 == x2; }
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend bool operator==(equal_to const& x1, equal_to const& x2)
|
2012-07-08 11:55:35 +00:00
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return x1.type_ == x2.type_;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend bool operator!=(equal_to const& x1, equal_to const& x2)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return x1.type_ != x2.type_;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
friend less create_compare(equal_to x) { return less(x.type_); }
|
2017-06-11 20:55:59 +01:00
|
|
|
};
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
// allocator1 only has the old fashioned 'construct' method and has
|
|
|
|
// a few less typedefs. allocator2 uses a custom pointer class.
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class T> class allocator1
|
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
public:
|
|
|
|
int tag_;
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
typedef T value_type;
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
template <class U> struct rebind
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
typedef allocator1<U> other;
|
2017-02-19 13:05:17 +00:00
|
|
|
};
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2018-01-20 11:49:07 +00:00
|
|
|
allocator1() : tag_(0) { detail::tracker.allocator_ref(); }
|
2018-01-17 10:30:20 +00:00
|
|
|
|
2018-01-20 11:49:07 +00:00
|
|
|
explicit allocator1(int t) : tag_(t) { detail::tracker.allocator_ref(); }
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
template <class Y> allocator1(allocator1<Y> const& x) : tag_(x.tag_)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
detail::tracker.allocator_ref();
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
allocator1(allocator1 const& x) : tag_(x.tag_)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
detail::tracker.allocator_ref();
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
~allocator1() { detail::tracker.allocator_unref(); }
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
T* allocate(std::size_t n)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
T* ptr(static_cast<T*>(::operator new(n * sizeof(T))));
|
|
|
|
detail::tracker.track_allocate((void*)ptr, n, sizeof(T), tag_);
|
|
|
|
return ptr;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-07-22 07:14:42 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
T* allocate(std::size_t n, void const*)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
T* ptr(static_cast<T*>(::operator new(n * sizeof(T))));
|
|
|
|
detail::tracker.track_allocate((void*)ptr, n, sizeof(T), tag_);
|
|
|
|
return ptr;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
void deallocate(T* p, std::size_t n)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
detail::tracker.track_deallocate((void*)p, n, sizeof(T), tag_);
|
|
|
|
::operator delete((void*)p);
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-04-18 10:14:26 +01:00
|
|
|
#if BOOST_UNORDERED_CXX11_CONSTRUCTION
|
2017-04-18 10:14:26 +01:00
|
|
|
template <typename U, typename... Args> void construct(U* p, Args&&... args)
|
2017-04-18 10:14:26 +01:00
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
detail::tracker.track_construct((void*)p, sizeof(U), tag_);
|
|
|
|
new (p) U(boost::forward<Args>(args)...);
|
2017-04-18 10:14:26 +01:00
|
|
|
}
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-04-18 10:14:26 +01:00
|
|
|
template <typename U> void destroy(U* p)
|
2017-02-19 13:05:17 +00:00
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
detail::tracker.track_destroy((void*)p, sizeof(U), tag_);
|
|
|
|
p->~U();
|
2012-07-08 11:55:35 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
// Work around MSVC buggy unused parameter warning.
|
|
|
|
ignore_variable(&p);
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2017-04-18 10:14:26 +01:00
|
|
|
#else
|
|
|
|
private:
|
|
|
|
// I'm going to claim in the documentation that construct/destroy
|
|
|
|
// is never used when C++11 support isn't available, so might as
|
|
|
|
// well check that in the text.
|
|
|
|
// TODO: Or maybe just disallow them for values?
|
|
|
|
template <typename U> void construct(U* p);
|
|
|
|
template <typename U, typename A0> void construct(U* p, A0 const&);
|
|
|
|
template <typename U, typename A0, typename A1>
|
|
|
|
void construct(U* p, A0 const&, A1 const&);
|
|
|
|
template <typename U, typename A0, typename A1, typename A2>
|
|
|
|
void construct(U* p, A0 const&, A1 const&, A2 const&);
|
|
|
|
template <typename U> void destroy(U* p);
|
|
|
|
|
|
|
|
public:
|
|
|
|
#endif
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
bool operator==(allocator1 const& x) const { return tag_ == x.tag_; }
|
|
|
|
|
|
|
|
bool operator!=(allocator1 const& x) const { return tag_ != x.tag_; }
|
|
|
|
|
|
|
|
enum
|
2012-09-13 19:50:31 +00:00
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
is_select_on_copy = false,
|
|
|
|
is_propagate_on_swap = false,
|
|
|
|
is_propagate_on_assign = false,
|
|
|
|
is_propagate_on_move = false
|
2017-02-19 13:05:17 +00:00
|
|
|
};
|
2017-06-11 20:55:59 +01:00
|
|
|
};
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class T> class ptr;
|
|
|
|
template <class T> class const_ptr;
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
struct void_ptr
|
|
|
|
{
|
2012-09-13 19:50:31 +00:00
|
|
|
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
2017-02-19 13:05:17 +00:00
|
|
|
template <typename T> friend class ptr;
|
|
|
|
|
|
|
|
private:
|
2012-09-13 19:50:31 +00:00
|
|
|
#endif
|
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
void* ptr_;
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
public:
|
|
|
|
void_ptr() : ptr_(0) {}
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
template <typename T> explicit void_ptr(ptr<T> const& x) : ptr_(x.ptr_) {}
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
// I'm not using the safe bool idiom because the containers should be
|
|
|
|
// able to cope with bool conversions.
|
|
|
|
operator bool() const { return !!ptr_; }
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
bool operator==(void_ptr const& x) const { return ptr_ == x.ptr_; }
|
|
|
|
bool operator!=(void_ptr const& x) const { return ptr_ != x.ptr_; }
|
2017-06-11 20:55:59 +01:00
|
|
|
};
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
class void_const_ptr
|
|
|
|
{
|
2012-09-13 19:50:31 +00:00
|
|
|
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
2017-02-19 13:05:17 +00:00
|
|
|
template <typename T> friend class const_ptr;
|
|
|
|
|
|
|
|
private:
|
2012-09-13 19:50:31 +00:00
|
|
|
#endif
|
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
void* ptr_;
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
public:
|
|
|
|
void_const_ptr() : ptr_(0) {}
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
template <typename T>
|
|
|
|
explicit void_const_ptr(const_ptr<T> const& x) : ptr_(x.ptr_)
|
|
|
|
{
|
|
|
|
}
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
// I'm not using the safe bool idiom because the containers should be
|
|
|
|
// able to cope with bool conversions.
|
|
|
|
operator bool() const { return !!ptr_; }
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
bool operator==(void_const_ptr const& x) const { return ptr_ == x.ptr_; }
|
|
|
|
bool operator!=(void_const_ptr const& x) const { return ptr_ != x.ptr_; }
|
2017-06-11 20:55:59 +01:00
|
|
|
};
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class T> class ptr
|
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
friend class allocator2<T>;
|
|
|
|
friend class const_ptr<T>;
|
|
|
|
friend struct void_ptr;
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
T* ptr_;
|
2012-09-13 19:50:31 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
ptr(T* x) : ptr_(x) {}
|
2017-10-05 10:54:22 +01:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
public:
|
|
|
|
ptr() : ptr_(0) {}
|
|
|
|
explicit ptr(void_ptr const& x) : ptr_((T*)x.ptr_) {}
|
2010-01-04 22:49:39 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
T& operator*() const { return *ptr_; }
|
|
|
|
T* operator->() const { return ptr_; }
|
|
|
|
ptr& operator++()
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
++ptr_;
|
|
|
|
return *this;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
|
|
|
ptr operator++(int)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
ptr tmp(*this);
|
|
|
|
++ptr_;
|
|
|
|
return tmp;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
|
|
|
ptr operator+(std::ptrdiff_t s) const { return ptr<T>(ptr_ + s); }
|
|
|
|
friend ptr operator+(std::ptrdiff_t s, ptr p) { return ptr<T>(s + p.ptr_); }
|
|
|
|
T& operator[](std::ptrdiff_t s) const { return ptr_[s]; }
|
|
|
|
bool operator!() const { return !ptr_; }
|
|
|
|
|
|
|
|
// I'm not using the safe bool idiom because the containers should be
|
|
|
|
// able to cope with bool conversions.
|
|
|
|
operator bool() const { return !!ptr_; }
|
|
|
|
|
|
|
|
bool operator==(ptr const& x) const { return ptr_ == x.ptr_; }
|
|
|
|
bool operator!=(ptr const& x) const { return ptr_ != x.ptr_; }
|
|
|
|
bool operator<(ptr const& x) const { return ptr_ < x.ptr_; }
|
|
|
|
bool operator>(ptr const& x) const { return ptr_ > x.ptr_; }
|
|
|
|
bool operator<=(ptr const& x) const { return ptr_ <= x.ptr_; }
|
|
|
|
bool operator>=(ptr const& x) const { return ptr_ >= x.ptr_; }
|
2017-06-11 20:55:59 +01:00
|
|
|
};
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class T> class const_ptr
|
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
friend class allocator2<T>;
|
|
|
|
friend struct const_void_ptr;
|
2010-01-04 22:49:39 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
T const* ptr_;
|
2010-01-04 22:49:39 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
const_ptr(T const* ptr) : ptr_(ptr) {}
|
2017-10-05 10:54:22 +01:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
public:
|
|
|
|
const_ptr() : ptr_(0) {}
|
|
|
|
const_ptr(ptr<T> const& x) : ptr_(x.ptr_) {}
|
|
|
|
explicit const_ptr(void_const_ptr const& x) : ptr_((T const*)x.ptr_) {}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
T const& operator*() const { return *ptr_; }
|
|
|
|
T const* operator->() const { return ptr_; }
|
|
|
|
const_ptr& operator++()
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
++ptr_;
|
|
|
|
return *this;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
|
|
|
const_ptr operator++(int)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
const_ptr tmp(*this);
|
|
|
|
++ptr_;
|
|
|
|
return tmp;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
|
|
|
const_ptr operator+(std::ptrdiff_t s) const { return const_ptr(ptr_ + s); }
|
|
|
|
friend const_ptr operator+(std::ptrdiff_t s, const_ptr p)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return ptr<T>(s + p.ptr_);
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
|
|
|
T const& operator[](int s) const { return ptr_[s]; }
|
|
|
|
bool operator!() const { return !ptr_; }
|
|
|
|
operator bool() const { return !!ptr_; }
|
|
|
|
|
|
|
|
bool operator==(const_ptr const& x) const { return ptr_ == x.ptr_; }
|
|
|
|
bool operator!=(const_ptr const& x) const { return ptr_ != x.ptr_; }
|
|
|
|
bool operator<(const_ptr const& x) const { return ptr_ < x.ptr_; }
|
|
|
|
bool operator>(const_ptr const& x) const { return ptr_ > x.ptr_; }
|
|
|
|
bool operator<=(const_ptr const& x) const { return ptr_ <= x.ptr_; }
|
|
|
|
bool operator>=(const_ptr const& x) const { return ptr_ >= x.ptr_; }
|
2017-06-11 20:55:59 +01:00
|
|
|
};
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class T> class allocator2
|
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
|
|
|
public:
|
|
|
|
#else
|
|
|
|
template <class> friend class allocator2;
|
|
|
|
#endif
|
|
|
|
int tag_;
|
|
|
|
|
|
|
|
public:
|
|
|
|
typedef std::size_t size_type;
|
|
|
|
typedef std::ptrdiff_t difference_type;
|
|
|
|
typedef void_ptr void_pointer;
|
|
|
|
typedef void_const_ptr const_void_pointer;
|
|
|
|
typedef ptr<T> pointer;
|
|
|
|
typedef const_ptr<T> const_pointer;
|
|
|
|
typedef T& reference;
|
|
|
|
typedef T const& const_reference;
|
|
|
|
typedef T value_type;
|
|
|
|
|
|
|
|
template <class U> struct rebind
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
typedef allocator2<U> other;
|
2017-02-19 13:05:17 +00:00
|
|
|
};
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2018-01-20 11:49:07 +00:00
|
|
|
allocator2() : tag_(0) { detail::tracker.allocator_ref(); }
|
2018-01-17 10:30:20 +00:00
|
|
|
|
2018-01-20 11:49:07 +00:00
|
|
|
explicit allocator2(int t) : tag_(t) { detail::tracker.allocator_ref(); }
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
template <class Y> allocator2(allocator2<Y> const& x) : tag_(x.tag_)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
detail::tracker.allocator_ref();
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
allocator2(allocator2 const& x) : tag_(x.tag_)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
detail::tracker.allocator_ref();
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
~allocator2() { detail::tracker.allocator_unref(); }
|
2006-06-11 19:42:55 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
pointer address(reference r) { return pointer(&r); }
|
Merge support for emplace for compilers with rvalue references and variadic templates arguments, and better use of C++0x allocators.
Merged revisions 44058-44075,44078-44084,44086-44108,44110-44365,44367,44369-44414,44416-44419,44421-44457,44467-44469,44471-44511,44513-44535,44537-44737 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
................
r44467 | danieljames | 2008-04-16 18:35:56 +0100 (Wed, 16 Apr 2008) | 2 lines
Add C++-0x support to the test allocators.
................
r44468 | danieljames | 2008-04-16 18:36:06 +0100 (Wed, 16 Apr 2008) | 2 lines
Add a C++-0x node_constructor.
................
r44469 | danieljames | 2008-04-16 18:36:16 +0100 (Wed, 16 Apr 2008) | 2 lines
C++-0x constructor for node.
................
r44516 | danieljames | 2008-04-17 21:41:48 +0100 (Thu, 17 Apr 2008) | 16 lines
Merge in my work so far on implementing emplace for compilers with variadic
template & rvalue references.
Merged revisions 44059-44062 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/dev
........
r44059 | danieljames | 2008-04-05 17:41:25 +0100 (Sat, 05 Apr 2008) | 1 line
First stab at implementing emplace - only for compilers with variadic template & rvalue references.
........
r44062 | danieljames | 2008-04-05 19:12:09 +0100 (Sat, 05 Apr 2008) | 1 line
Better variable template arguments, need to add proper support to BoostBook.
........
................
r44616 | danieljames | 2008-04-20 13:30:19 +0100 (Sun, 20 Apr 2008) | 1 line
Merge with trunk, fixes tabs.
................
r44618 | danieljames | 2008-04-20 13:42:38 +0100 (Sun, 20 Apr 2008) | 2 lines
Some extra compile tests.
................
r44619 | danieljames | 2008-04-20 13:42:50 +0100 (Sun, 20 Apr 2008) | 2 lines
Fix an error message.
................
r44703 | danieljames | 2008-04-21 20:19:50 +0100 (Mon, 21 Apr 2008) | 15 lines
Merge latest changes from trunk.
Merged revisions 44616-44702 via svnmerge from
https://svn.boost.org/svn/boost/trunk
........
r44650 | danieljames | 2008-04-20 22:08:57 +0100 (Sun, 20 Apr 2008) | 1 line
Update an include.
........
r44697 | danieljames | 2008-04-21 16:55:40 +0100 (Mon, 21 Apr 2008) | 1 line
Factor out the code for choosing the bucket count, and which bucket that hash values map to make it easier to experiment with alternative policies.
........
................
r44733 | danieljames | 2008-04-23 07:55:43 +0100 (Wed, 23 Apr 2008) | 2 lines
Remove 'reserve_extra'.
................
r44734 | danieljames | 2008-04-23 07:55:55 +0100 (Wed, 23 Apr 2008) | 2 lines
More unnecessary copy tests - showing some weakness in the emplace implementation.
................
r44735 | danieljames | 2008-04-23 07:56:06 +0100 (Wed, 23 Apr 2008) | 2 lines
More tests.
................
r44736 | danieljames | 2008-04-23 07:56:19 +0100 (Wed, 23 Apr 2008) | 2 lines
Comment out a test which requires a C++0x std::pair.
................
r44737 | danieljames | 2008-04-23 07:56:35 +0100 (Wed, 23 Apr 2008) | 2 lines
Avoid creating unnecessary copies in unordered_set::emplace and unordered_map::emplace.
................
[SVN r44738]
2008-04-23 07:09:58 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
const_pointer address(const_reference r) { return const_pointer(&r); }
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
pointer allocate(size_type n)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
pointer p(static_cast<T*>(::operator new(n * sizeof(T))));
|
|
|
|
detail::tracker.track_allocate((void*)p.ptr_, n, sizeof(T), tag_);
|
|
|
|
return p;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
pointer allocate(size_type n, void const*)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
pointer ptr(static_cast<T*>(::operator new(n * sizeof(T))));
|
|
|
|
detail::tracker.track_allocate((void*)ptr, n, sizeof(T), tag_);
|
|
|
|
return ptr;
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2006-05-17 17:19:16 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
void deallocate(pointer p, size_type n)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
detail::tracker.track_deallocate((void*)p.ptr_, n, sizeof(T), tag_);
|
|
|
|
::operator delete((void*)p.ptr_);
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
2011-08-15 20:23:29 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
void construct(T* p, T const& t)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
detail::tracker.track_construct((void*)p, sizeof(T), tag_);
|
|
|
|
new (p) T(t);
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
|
|
|
template <class... Args> void construct(T* p, BOOST_FWD_REF(Args)... args)
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
detail::tracker.track_construct((void*)p, sizeof(T), tag_);
|
|
|
|
new (p) T(boost::forward<Args>(args)...);
|
2017-02-19 13:05:17 +00:00
|
|
|
}
|
|
|
|
#endif
|
2006-12-03 23:08:17 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
void destroy(T* p)
|
2012-07-08 11:55:35 +00:00
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
detail::tracker.track_destroy((void*)p, sizeof(T), tag_);
|
|
|
|
p->~T();
|
2012-07-08 11:55:35 +00:00
|
|
|
}
|
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
size_type max_size() const
|
2010-01-04 22:49:39 +00:00
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
return (std::numeric_limits<size_type>::max)();
|
2006-06-12 23:30:46 +00:00
|
|
|
}
|
2017-02-19 13:05:17 +00:00
|
|
|
|
|
|
|
bool operator==(allocator2 const& x) const { return tag_ == x.tag_; }
|
|
|
|
|
|
|
|
bool operator!=(allocator2 const& x) const { return tag_ != x.tag_; }
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2017-06-11 20:55:59 +01:00
|
|
|
is_select_on_copy = false,
|
|
|
|
is_propagate_on_swap = false,
|
|
|
|
is_propagate_on_assign = false,
|
|
|
|
is_propagate_on_move = false
|
2017-02-19 13:05:17 +00:00
|
|
|
};
|
2017-06-11 20:55:59 +01:00
|
|
|
};
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class T>
|
|
|
|
bool equivalent_impl(
|
2017-02-19 13:05:17 +00:00
|
|
|
allocator1<T> const& x, allocator1<T> const& y, test::derived_type)
|
2017-06-11 20:55:59 +01:00
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
return x == y;
|
2017-06-11 20:55:59 +01:00
|
|
|
}
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class T>
|
|
|
|
bool equivalent_impl(
|
2017-02-19 13:05:17 +00:00
|
|
|
allocator2<T> const& x, allocator2<T> const& y, test::derived_type)
|
2017-06-11 20:55:59 +01:00
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
return x == y;
|
2017-06-11 20:55:59 +01:00
|
|
|
}
|
2006-06-12 23:30:46 +00:00
|
|
|
}
|
|
|
|
|
2006-05-17 17:19:16 +00:00
|
|
|
#endif
|