mirror of
https://github.com/boostorg/intrusive.git
synced 2025-08-02 22:14:35 +02:00
Changes for Boost.1.39
[SVN r52032]
This commit is contained in:
@@ -26,18 +26,18 @@ class ebo_functor_holder_impl
|
|||||||
ebo_functor_holder_impl()
|
ebo_functor_holder_impl()
|
||||||
{}
|
{}
|
||||||
ebo_functor_holder_impl(const T& t)
|
ebo_functor_holder_impl(const T& t)
|
||||||
: t(t)
|
: t_(t)
|
||||||
{}
|
{}
|
||||||
template<class Arg1, class Arg2>
|
template<class Arg1, class Arg2>
|
||||||
ebo_functor_holder_impl(const Arg1& arg1, const Arg2& arg2)
|
ebo_functor_holder_impl(const Arg1& arg1, const Arg2& arg2)
|
||||||
: t(arg1, arg2)
|
: t_(arg1, arg2)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
T& get(){return t;}
|
T& get(){return t_;}
|
||||||
const T& get()const{return t;}
|
const T& get()const{return t_;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T t;
|
T t_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@@ -64,7 +64,7 @@ class is_convertible
|
|||||||
class false_t { char dummy[2]; };
|
class false_t { char dummy[2]; };
|
||||||
static true_t dispatch(U);
|
static true_t dispatch(U);
|
||||||
static false_t dispatch(...);
|
static false_t dispatch(...);
|
||||||
static T trigger();
|
static const T &trigger();
|
||||||
public:
|
public:
|
||||||
static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t);
|
static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t);
|
||||||
};
|
};
|
||||||
|
@@ -15,7 +15,8 @@
|
|||||||
#include <boost/intrusive/detail/config_begin.hpp>
|
#include <boost/intrusive/detail/config_begin.hpp>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#if defined(BOOST_MSVC) || (defined (BOOST_WINDOWS) && defined(BOOST_INTEL))
|
#if defined(BOOST_MSVC) || ((defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && defined(BOOST_INTEL))
|
||||||
|
|
||||||
#define BOOST_INTRUSIVE_MSVC_COMPLIANT_PTR_TO_MEMBER
|
#define BOOST_INTRUSIVE_MSVC_COMPLIANT_PTR_TO_MEMBER
|
||||||
#include <boost/cstdint.hpp>
|
#include <boost/cstdint.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
@@ -99,8 +99,8 @@ class tree_iterator
|
|||||||
: members_ (0, 0)
|
: members_ (0, 0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit tree_iterator(node_ptr node, const Container *cont_ptr)
|
explicit tree_iterator(node_ptr nodeptr, const Container *cont_ptr)
|
||||||
: members_ (node, cont_ptr)
|
: members_ (nodeptr, cont_ptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
tree_iterator(tree_iterator<Container, false> const& other)
|
tree_iterator(tree_iterator<Container, false> const& other)
|
||||||
@@ -110,8 +110,8 @@ class tree_iterator
|
|||||||
const node_ptr &pointed_node() const
|
const node_ptr &pointed_node() const
|
||||||
{ return members_.nodeptr_; }
|
{ return members_.nodeptr_; }
|
||||||
|
|
||||||
tree_iterator &operator=(const node_ptr &node)
|
tree_iterator &operator=(const node_ptr &nodeptr)
|
||||||
{ members_.nodeptr_ = node; return static_cast<tree_iterator&>(*this); }
|
{ members_.nodeptr_ = nodeptr; return static_cast<tree_iterator&>(*this); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
tree_iterator& operator++()
|
tree_iterator& operator++()
|
||||||
|
@@ -718,6 +718,8 @@ class hashtable_impl
|
|||||||
|
|
||||||
//Constant-time size is incompatible with auto-unlink hooks!
|
//Constant-time size is incompatible with auto-unlink hooks!
|
||||||
BOOST_STATIC_ASSERT(!(constant_time_size && ((int)real_value_traits::link_mode == (int)auto_unlink)));
|
BOOST_STATIC_ASSERT(!(constant_time_size && ((int)real_value_traits::link_mode == (int)auto_unlink)));
|
||||||
|
//Cache begin is incompatible with auto-unlink hooks!
|
||||||
|
BOOST_STATIC_ASSERT(!(cache_begin && ((int)real_value_traits::link_mode == (int)auto_unlink)));
|
||||||
|
|
||||||
template<class Disposer>
|
template<class Disposer>
|
||||||
node_cast_adaptor<detail::node_disposer<Disposer, hashtable_impl> >
|
node_cast_adaptor<detail::node_disposer<Disposer, hashtable_impl> >
|
||||||
@@ -871,7 +873,7 @@ class hashtable_impl
|
|||||||
|
|
||||||
//! <b>Effects</b>: Returns true if the container is empty.
|
//! <b>Effects</b>: Returns true if the container is empty.
|
||||||
//!
|
//!
|
||||||
//! <b>Complexity</b>: if constant-time size and cache_last options are disabled,
|
//! <b>Complexity</b>: if constant-time size and cache_begin options are disabled,
|
||||||
//! average constant time (worst case, with empty() == true: O(this->bucket_count()).
|
//! average constant time (worst case, with empty() == true: O(this->bucket_count()).
|
||||||
//! Otherwise constant.
|
//! Otherwise constant.
|
||||||
//!
|
//!
|
||||||
|
@@ -978,7 +978,8 @@ class list_impl
|
|||||||
carry.splice(carry.cbegin(), *this, this->cbegin());
|
carry.splice(carry.cbegin(), *this, this->cbegin());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(i < fill && !counter[i].empty()) {
|
while(i < fill && !counter[i].empty()) {
|
||||||
carry.merge(counter[i++], p);
|
counter[i].merge(carry, p);
|
||||||
|
carry.swap(counter[i++]);
|
||||||
}
|
}
|
||||||
carry.swap(counter[i]);
|
carry.swap(counter[i]);
|
||||||
if(i == fill)
|
if(i == fill)
|
||||||
@@ -1021,21 +1022,26 @@ class list_impl
|
|||||||
template<class Predicate>
|
template<class Predicate>
|
||||||
void merge(list_impl& x, Predicate p)
|
void merge(list_impl& x, Predicate p)
|
||||||
{
|
{
|
||||||
const_iterator e(this->end());
|
const_iterator e(this->cend()), ex(x.cend());
|
||||||
const_iterator bx(x.begin());
|
const_iterator b(this->cbegin());
|
||||||
const_iterator ex(x.end());
|
while(!x.empty()){
|
||||||
|
const_iterator ix(x.cbegin());
|
||||||
for (const_iterator b = this->cbegin(); b != e; ++b) {
|
while (b != e && !p(*ix, *b)){
|
||||||
size_type n(0);
|
++b;
|
||||||
const_iterator ix(bx);
|
}
|
||||||
while(ix != ex && p(*ix, *b)){
|
if(b == e){
|
||||||
++ix; ++n;
|
//Now transfer the rest to the end of the container
|
||||||
|
this->splice(e, x);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
size_type n(0);
|
||||||
|
do{
|
||||||
|
++ix; ++n;
|
||||||
|
} while(ix != ex && p(*ix, *b));
|
||||||
|
this->splice(b, x, x.begin(), ix, n);
|
||||||
}
|
}
|
||||||
this->splice(b, x, bx, ix, n);
|
|
||||||
bx = ix;
|
|
||||||
}
|
}
|
||||||
//Now transfer the rest at the end of the container
|
|
||||||
this->splice(e, x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Effects</b>: Reverses the order of elements in the list.
|
//! <b>Effects</b>: Reverses the order of elements in the list.
|
||||||
|
@@ -513,9 +513,9 @@ class rbtree_impl
|
|||||||
template<class Iterator>
|
template<class Iterator>
|
||||||
void insert_equal(Iterator b, Iterator e)
|
void insert_equal(Iterator b, Iterator e)
|
||||||
{
|
{
|
||||||
iterator end(this->end());
|
iterator iend(this->end());
|
||||||
for (; b != e; ++b)
|
for (; b != e; ++b)
|
||||||
this->insert_equal(end, *b);
|
this->insert_equal(iend, *b);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! <b>Requires</b>: value must be an lvalue
|
//! <b>Requires</b>: value must be an lvalue
|
||||||
@@ -579,9 +579,9 @@ class rbtree_impl
|
|||||||
void insert_unique(Iterator b, Iterator e)
|
void insert_unique(Iterator b, Iterator e)
|
||||||
{
|
{
|
||||||
if(this->empty()){
|
if(this->empty()){
|
||||||
iterator end(this->end());
|
iterator iend(this->end());
|
||||||
for (; b != e; ++b)
|
for (; b != e; ++b)
|
||||||
this->insert_unique(end, *b);
|
this->insert_unique(iend, *b);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
for (; b != e; ++b)
|
for (; b != e; ++b)
|
||||||
|
@@ -598,7 +598,7 @@ class slist_impl
|
|||||||
void swap(slist_impl& other)
|
void swap(slist_impl& other)
|
||||||
{
|
{
|
||||||
if(cache_last){
|
if(cache_last){
|
||||||
this->priv_swap_cache_last(other);
|
priv_swap_cache_last(this, &other);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this->priv_swap_lists(this->get_root_node(), other.get_root_node(), detail::bool_<linear>());
|
this->priv_swap_lists(this->get_root_node(), other.get_root_node(), detail::bool_<linear>());
|
||||||
@@ -1264,6 +1264,7 @@ class slist_impl
|
|||||||
carry.splice_after(carry.cbefore_begin(), *this, this->cbefore_begin());
|
carry.splice_after(carry.cbefore_begin(), *this, this->cbefore_begin());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(i < fill && !counter[i].empty()) {
|
while(i < fill && !counter[i].empty()) {
|
||||||
|
carry.swap(counter[i]);
|
||||||
last_inserted = carry.merge(counter[i++], p);
|
last_inserted = carry.merge(counter[i++], p);
|
||||||
}
|
}
|
||||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(counter[i].empty());
|
BOOST_INTRUSIVE_INVARIANT_ASSERT(counter[i].empty());
|
||||||
@@ -1340,24 +1341,26 @@ class slist_impl
|
|||||||
template<class Predicate>
|
template<class Predicate>
|
||||||
iterator merge(slist_impl& x, Predicate p)
|
iterator merge(slist_impl& x, Predicate p)
|
||||||
{
|
{
|
||||||
const_iterator a(cbefore_begin()), e(cend()), ax(x.cbefore_begin()), ex(x.cend());
|
const_iterator e(this->cend()), ex(x.cend()), bb(this->cbefore_begin()),
|
||||||
const_iterator last_inserted(e);
|
bb_next, last_inserted(e);
|
||||||
const_iterator a_next;
|
while(!x.empty()){
|
||||||
while(++(a_next = a) != e && !x.empty()) {
|
const_iterator ibx_next(x.cbefore_begin()), ibx(ibx_next++);
|
||||||
const_iterator ix(ax);
|
while (++(bb_next = bb) != e && !p(*ibx_next, *bb_next)){
|
||||||
const_iterator cx;
|
bb = bb_next;
|
||||||
size_type n(0);
|
|
||||||
while(++(cx = ix) != ex && p(*cx, *a_next)){
|
|
||||||
++ix; ++n;
|
|
||||||
}
|
}
|
||||||
if(ax != ix){
|
if(bb_next == e){
|
||||||
this->splice_after(a, x, ax, ix, n);
|
//Now transfer the rest to the end of the container
|
||||||
last_inserted = ix;
|
last_inserted = this->splice_after(bb, x);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
size_type n(0);
|
||||||
|
do{
|
||||||
|
ibx = ibx_next; ++n;
|
||||||
|
} while(++(ibx_next = ibx) != ex && p(*ibx_next, *bb_next));
|
||||||
|
this->splice_after(bb, x, x.before_begin(), ibx, n);
|
||||||
|
last_inserted = ibx;
|
||||||
}
|
}
|
||||||
a = a_next;
|
|
||||||
}
|
|
||||||
if (!x.empty()){
|
|
||||||
last_inserted = this->splice_after(a, x);
|
|
||||||
}
|
}
|
||||||
return last_inserted.unconst();
|
return last_inserted.unconst();
|
||||||
}
|
}
|
||||||
@@ -1711,22 +1714,40 @@ class slist_impl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void priv_swap_cache_last(slist_impl &other)
|
static void priv_swap_cache_last(slist_impl *this_impl, slist_impl *other_impl)
|
||||||
{
|
{
|
||||||
node_ptr other_last(other.get_last_node());
|
bool other_was_empty = false;
|
||||||
node_ptr this_last(this->get_last_node());
|
if(this_impl->empty()){
|
||||||
node_ptr other_bfirst(other.get_root_node());
|
//Check if both are empty or
|
||||||
node_ptr this_bfirst(this->get_root_node());
|
if(other_impl->empty())
|
||||||
node_algorithms::transfer_after(this_bfirst, other_bfirst, other_last);
|
return;
|
||||||
node_algorithms::transfer_after(other_bfirst, other_last != other_bfirst? other_last : this_bfirst, this_last);
|
//If this is empty swap pointers
|
||||||
node_ptr tmp(this->get_last_node());
|
slist_impl *tmp = this_impl;
|
||||||
this->set_last_node(other.get_last_node());
|
this_impl = other_impl;
|
||||||
other.set_last_node(tmp);
|
other_impl = tmp;
|
||||||
if(this->get_last_node() == other_bfirst){
|
other_was_empty = true;
|
||||||
this->set_last_node(this_bfirst);
|
|
||||||
}
|
}
|
||||||
if(other.get_last_node() == this_bfirst){
|
else{
|
||||||
other.set_last_node(other_bfirst);
|
other_was_empty = other_impl->empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Precondition: this is not empty
|
||||||
|
node_ptr other_old_last(other_impl->get_last_node());
|
||||||
|
node_ptr other_bfirst(other_impl->get_root_node());
|
||||||
|
node_ptr this_bfirst(this_impl->get_root_node());
|
||||||
|
node_ptr this_old_last(this_impl->get_last_node());
|
||||||
|
|
||||||
|
//Move all nodes from this to other's beginning
|
||||||
|
node_algorithms::transfer_after(other_bfirst, this_bfirst, this_old_last);
|
||||||
|
other_impl->set_last_node(this_old_last);
|
||||||
|
|
||||||
|
if(other_was_empty){
|
||||||
|
this_impl->set_last_node(this_bfirst);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//Move trailing nodes from other to this
|
||||||
|
node_algorithms::transfer_after(this_bfirst, this_old_last, other_old_last);
|
||||||
|
this_impl->set_last_node(other_old_last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user