mirror of
https://github.com/boostorg/intrusive.git
synced 2025-08-03 22:44:43 +02:00
Merged intrusive from trunk
[SVN r81662]
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/]
|
||||
|
||||
[library Boost.Intrusive
|
||||
[quickbook 1.4]
|
||||
[quickbook 1.5]
|
||||
[authors [Krzikalla, Olaf], [Gaztanaga, Ion]]
|
||||
[copyright 2005 Olaf Krzikalla, 2006-2012 Ion Gaztanaga]
|
||||
[id intrusive]
|
||||
@@ -3829,6 +3829,14 @@ all the objects to be inserted in intrusive containers in containers like `std::
|
||||
|
||||
[section:release_notes Release Notes]
|
||||
|
||||
[section:release_notes_boost_1_53_00 Boost 1.53 Release]
|
||||
|
||||
* Fixed GCC -Wshadow warnings.
|
||||
* Added missing `explicit` keyword in several intrusive container constructors.
|
||||
* Replaced deprecated BOOST_NO_XXXX with newer BOOST_NO_CXX11_XXX macros.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:release_notes_boost_1_51_00 Boost 1.51 Release]
|
||||
|
||||
* Fixed bugs
|
||||
|
@@ -86,7 +86,7 @@ class avl_set_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor of the value_compare object throws.
|
||||
avl_set_impl( const value_compare &cmp = value_compare()
|
||||
explicit avl_set_impl( const value_compare &cmp = value_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_(cmp, v_traits)
|
||||
{}
|
||||
@@ -1381,7 +1381,7 @@ class avl_multiset_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor/operator() of the value_compare object throws.
|
||||
avl_multiset_impl( const value_compare &cmp = value_compare()
|
||||
explicit avl_multiset_impl( const value_compare &cmp = value_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_(cmp, v_traits)
|
||||
{}
|
||||
|
@@ -219,7 +219,7 @@ class avltree_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor of the value_compare object throws. Basic guarantee.
|
||||
avltree_impl( const value_compare &cmp = value_compare()
|
||||
explicit avltree_impl( const value_compare &cmp = value_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: data_(cmp, v_traits)
|
||||
{
|
||||
@@ -542,9 +542,9 @@ class avltree_impl
|
||||
template<class Iterator>
|
||||
void insert_equal(Iterator b, Iterator e)
|
||||
{
|
||||
iterator end_(this->end());
|
||||
iterator iend(this->end());
|
||||
for (; b != e; ++b)
|
||||
this->insert_equal(end_, *b);
|
||||
this->insert_equal(iend, *b);
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: value must be an lvalue
|
||||
@@ -608,9 +608,9 @@ class avltree_impl
|
||||
void insert_unique(Iterator b, Iterator e)
|
||||
{
|
||||
if(this->empty()){
|
||||
iterator end_(this->end());
|
||||
iterator iend(this->end());
|
||||
for (; b != e; ++b)
|
||||
this->insert_unique(end_, *b);
|
||||
this->insert_unique(iend, *b);
|
||||
}
|
||||
else{
|
||||
for (; b != e; ++b)
|
||||
|
@@ -174,7 +174,7 @@ class circular_list_algorithms
|
||||
NodeTraits::set_previous(this_node, prev);
|
||||
NodeTraits::set_next(this_node, nxt_node);
|
||||
//nxt_node might be an alias for prev->next_
|
||||
//so use it before update it before NodeTraits::set_next(prev, ...)
|
||||
//so use it before NodeTraits::set_next(prev, ...)
|
||||
//is called and the reference changes it's value
|
||||
NodeTraits::set_previous(nxt_node, this_node);
|
||||
NodeTraits::set_next(prev, this_node);
|
||||
|
@@ -149,7 +149,7 @@ BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type)
|
||||
template <typename T> struct first_param
|
||||
{ typedef void type; };
|
||||
|
||||
#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <template <typename, typename...> class TemplateClass, typename T, typename... Args>
|
||||
struct first_param< TemplateClass<T, Args...> >
|
||||
@@ -173,7 +173,7 @@ template <typename T> struct first_param
|
||||
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS)
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
#endif //!defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
///////////////////////////
|
||||
//struct type_rebind_mode
|
||||
@@ -245,7 +245,7 @@ struct type_rebinder< Ptr, U, 1u >
|
||||
// OtherArgs>, where OtherArgs comprises zero or more type parameters.
|
||||
// Many pointers fit this form, hence many pointers will get a
|
||||
// reasonable default for rebind.
|
||||
#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <template <class, class...> class Ptr, typename T, class... Tn, class U>
|
||||
struct type_rebinder<Ptr<T, Tn...>, U, 0u >
|
||||
@@ -277,7 +277,7 @@ struct type_rebinder
|
||||
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS)
|
||||
#include BOOST_PP_LOCAL_ITERATE()
|
||||
|
||||
#endif //!defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
} //namespace detail {
|
||||
} //namespace intrusive {
|
||||
|
@@ -1020,7 +1020,7 @@ class tree_algorithms
|
||||
if(hint == header || comp(key, hint)){
|
||||
node_ptr prev(hint);
|
||||
//Previous value should be less than the key
|
||||
if(hint == begin_node(header)|| comp((prev = prev_node(hint)), key)){
|
||||
if(hint == begin_node(header) || comp((prev = prev_node(hint)), key)){
|
||||
commit_data.link_left = unique(header) || !NodeTraits::get_left(hint);
|
||||
commit_data.node = commit_data.link_left ? hint : prev;
|
||||
if(pdepth){
|
||||
|
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
#define BOOST_INTRUSIVE_PERFECT_FORWARDING
|
||||
#endif
|
||||
|
||||
|
@@ -424,20 +424,20 @@ struct group_functions
|
||||
{
|
||||
node_ptr nxt_ptr(node_traits::get_next(to_erase_ptr));
|
||||
node_ptr prev_in_group_ptr(group_traits::get_next(to_erase_ptr));
|
||||
bool last_in_group_bool = (end_ptr == nxt_ptr) ||
|
||||
bool last_in_group = (end_ptr == nxt_ptr) ||
|
||||
(group_traits::get_next(nxt_ptr) != to_erase_ptr);
|
||||
bool first_in_group_bool = node_traits::get_next(prev_in_group_ptr) != to_erase_ptr;
|
||||
bool is_first_in_group = node_traits::get_next(prev_in_group_ptr) != to_erase_ptr;
|
||||
|
||||
if(first_in_group_bool && last_in_group_bool){
|
||||
if(is_first_in_group && last_in_group){
|
||||
group_algorithms::init(to_erase_ptr);
|
||||
}
|
||||
else if(first_in_group_bool){
|
||||
else if(is_first_in_group){
|
||||
group_algorithms::unlink_after(nxt_ptr);
|
||||
}
|
||||
else if(last_in_group_bool){
|
||||
node_ptr first_in_group_ptr =
|
||||
else if(last_in_group){
|
||||
node_ptr first_in_group =
|
||||
get_first_in_group_of_last_in_group(to_erase_ptr);
|
||||
group_algorithms::unlink_after(first_in_group_ptr);
|
||||
group_algorithms::unlink_after(first_in_group);
|
||||
}
|
||||
else{
|
||||
group_algorithms::unlink_after(nxt_ptr);
|
||||
@@ -888,7 +888,7 @@ class hashtable_impl
|
||||
//!
|
||||
//! <b>Notes</b>: buckets array must be disposed only after
|
||||
//! *this is disposed.
|
||||
hashtable_impl ( const bucket_traits &b_traits
|
||||
explicit hashtable_impl ( const bucket_traits &b_traits
|
||||
, const hasher & hash_func = hasher()
|
||||
, const key_equal &equal_func = key_equal()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
@@ -896,12 +896,12 @@ class hashtable_impl
|
||||
{
|
||||
this->priv_initialize_buckets();
|
||||
this->priv_size_traits().set_size(size_type(0));
|
||||
size_type bucket_size_ = this->priv_bucket_count();
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(bucket_size_ != 0);
|
||||
size_type bucket_sz = this->priv_bucket_count();
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(bucket_sz != 0);
|
||||
//Check power of two bucket array if the option is activated
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT
|
||||
(!power_2_buckets || (0 == (bucket_size_ & (bucket_size_-1))));
|
||||
this->priv_split_traits().set_size(bucket_size_>>1);
|
||||
(!power_2_buckets || (0 == (bucket_sz & (bucket_sz-1))));
|
||||
this->priv_split_traits().set_size(bucket_sz>>1);
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: to-do
|
||||
@@ -1026,9 +1026,9 @@ class hashtable_impl
|
||||
return this->begin() == this->end();
|
||||
}
|
||||
else{
|
||||
size_type bucket_count_ = this->priv_bucket_count();
|
||||
size_type bucket_cnt = this->priv_bucket_count();
|
||||
const bucket_type *b = boost::intrusive::detail::to_raw_pointer(this->priv_bucket_pointer());
|
||||
for (size_type n = 0; n < bucket_count_; ++n, ++b){
|
||||
for (size_type n = 0; n < bucket_cnt; ++n, ++b){
|
||||
if(!b->empty()){
|
||||
return false;
|
||||
}
|
||||
@@ -1049,9 +1049,9 @@ class hashtable_impl
|
||||
return this->priv_size_traits().get_size();
|
||||
else{
|
||||
size_type len = 0;
|
||||
size_type bucket_count_ = this->priv_bucket_count();
|
||||
size_type bucket_cnt = this->priv_bucket_count();
|
||||
const bucket_type *b = boost::intrusive::detail::to_raw_pointer(this->priv_bucket_pointer());
|
||||
for (size_type n = 0; n < bucket_count_; ++n, ++b){
|
||||
for (size_type n = 0; n < bucket_cnt; ++n, ++b){
|
||||
len += b->size();
|
||||
}
|
||||
return len;
|
||||
@@ -1468,9 +1468,9 @@ class hashtable_impl
|
||||
siterator first_local_it(b.slist_it());
|
||||
size_type first_bucket_num = this->priv_get_bucket_num(first_local_it);
|
||||
|
||||
const bucket_ptr bucket_pointer_ = this->priv_bucket_pointer();
|
||||
const bucket_ptr buck_ptr = this->priv_bucket_pointer();
|
||||
siterator before_first_local_it
|
||||
= this->priv_get_previous(bucket_pointer_[first_bucket_num], first_local_it);
|
||||
= this->priv_get_previous(buck_ptr[first_bucket_num], first_local_it);
|
||||
size_type last_bucket_num;
|
||||
siterator last_local_it;
|
||||
|
||||
@@ -1478,7 +1478,7 @@ class hashtable_impl
|
||||
//of the last bucket
|
||||
if(e == this->end()){
|
||||
last_bucket_num = this->bucket_count() - 1;
|
||||
last_local_it = bucket_pointer_[last_bucket_num].end();
|
||||
last_local_it = buck_ptr[last_bucket_num].end();
|
||||
}
|
||||
else{
|
||||
last_local_it = e.slist_it();
|
||||
@@ -1533,7 +1533,7 @@ class hashtable_impl
|
||||
siterator it =
|
||||
this->priv_find(key, hash_func, equal_func, bucket_num, h, prev);
|
||||
bool success = it != this->priv_invalid_local_it();
|
||||
size_type count_(0);
|
||||
size_type cnt(0);
|
||||
if(!success){
|
||||
return 0;
|
||||
}
|
||||
@@ -1541,12 +1541,12 @@ class hashtable_impl
|
||||
siterator last = bucket_type::s_iterator_to
|
||||
(*node_traits::get_next(group_functions_t::get_last_in_group
|
||||
(hashtable_impl::dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t())));
|
||||
this->priv_erase_range_impl(bucket_num, prev, last, disposer, count_);
|
||||
this->priv_erase_range_impl(bucket_num, prev, last, disposer, cnt);
|
||||
}
|
||||
else{
|
||||
//If found erase all equal values
|
||||
bucket_type &b = this->priv_bucket_pointer()[bucket_num];
|
||||
for(siterator end_ = b.end(); it != end_; ++count_, ++it){
|
||||
for(siterator end_sit = b.end(); it != end_sit; ++cnt, ++it){
|
||||
slist_node_ptr n(it.pointed_node());
|
||||
const value_type &v = this->priv_value_from_slist_node(n);
|
||||
if(compare_hash){
|
||||
@@ -1563,7 +1563,7 @@ class hashtable_impl
|
||||
b.erase_after_and_dispose(prev, it, make_node_disposer(disposer));
|
||||
}
|
||||
this->priv_erasure_update_cache();
|
||||
return count_;
|
||||
return cnt;
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Erases all of the elements.
|
||||
@@ -1630,9 +1630,9 @@ class hashtable_impl
|
||||
template<class KeyType, class KeyHasher, class KeyValueEqual>
|
||||
size_type count(const KeyType &key, const KeyHasher &hash_func, const KeyValueEqual &equal_func) const
|
||||
{
|
||||
size_type bucket_n1, bucket_n2, count_;
|
||||
this->priv_equal_range(key, hash_func, equal_func, bucket_n1, bucket_n2, count_);
|
||||
return count_;
|
||||
size_type bucket_n1, bucket_n2, cnt;
|
||||
this->priv_equal_range(key, hash_func, equal_func, bucket_n1, bucket_n2, cnt);
|
||||
return cnt;
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Finds an iterator to the first element is equal to
|
||||
@@ -1746,9 +1746,9 @@ class hashtable_impl
|
||||
std::pair<iterator,iterator> equal_range
|
||||
(const KeyType &key, KeyHasher hash_func, KeyValueEqual equal_func)
|
||||
{
|
||||
size_type bucket_n1, bucket_n2, count_;
|
||||
size_type bucket_n1, bucket_n2, cnt;
|
||||
std::pair<siterator, siterator> ret = this->priv_equal_range
|
||||
(key, hash_func, equal_func, bucket_n1, bucket_n2, count_);
|
||||
(key, hash_func, equal_func, bucket_n1, bucket_n2, cnt);
|
||||
return std::pair<iterator, iterator>
|
||||
(iterator(ret.first, this), iterator(ret.second, this));
|
||||
}
|
||||
@@ -1788,9 +1788,9 @@ class hashtable_impl
|
||||
std::pair<const_iterator,const_iterator> equal_range
|
||||
(const KeyType &key, KeyHasher hash_func, KeyValueEqual equal_func) const
|
||||
{
|
||||
size_type bucket_n1, bucket_n2, count_;
|
||||
size_type bucket_n1, bucket_n2, cnt;
|
||||
std::pair<siterator, siterator> ret =
|
||||
this->priv_equal_range(key, hash_func, equal_func, bucket_n1, bucket_n2, count_);
|
||||
this->priv_equal_range(key, hash_func, equal_func, bucket_n1, bucket_n2, cnt);
|
||||
return std::pair<const_iterator, const_iterator>
|
||||
(const_iterator(ret.first, this), const_iterator(ret.second, this));
|
||||
}
|
||||
@@ -2102,9 +2102,9 @@ class hashtable_impl
|
||||
|
||||
if(!fast_shrink){
|
||||
siterator before_i(old_bucket.before_begin());
|
||||
siterator end_(old_bucket.end());
|
||||
siterator end_sit(old_bucket.end());
|
||||
siterator i(old_bucket.begin());
|
||||
for(;i != end_; ++i){
|
||||
for(;i != end_sit; ++i){
|
||||
const value_type &v = this->priv_value_from_slist_node(i.pointed_node());
|
||||
const std::size_t hash_value = this->priv_stored_or_compute_hash(v, store_hash_t());
|
||||
const size_type new_n = this->priv_hash_to_bucket(hash_value, new_bucket_count, new_bucket_count);
|
||||
@@ -2160,18 +2160,18 @@ class hashtable_impl
|
||||
//This function is only available for containers with incremental hashing
|
||||
BOOST_STATIC_ASSERT(( incremental && power_2_buckets ));
|
||||
const size_type split_idx = this->priv_split_traits().get_size();
|
||||
const size_type bucket_count_ = this->priv_bucket_count();
|
||||
const bucket_ptr bucket_pointer_ = this->priv_bucket_pointer();
|
||||
const size_type bucket_cnt = this->priv_bucket_count();
|
||||
const bucket_ptr buck_ptr = this->priv_bucket_pointer();
|
||||
|
||||
if(grow){
|
||||
//Test if the split variable can be changed
|
||||
if(split_idx >= bucket_count_)
|
||||
if(split_idx >= bucket_cnt)
|
||||
return false;
|
||||
|
||||
const size_type bucket_to_rehash = split_idx - bucket_count_/2;
|
||||
bucket_type &old_bucket = bucket_pointer_[bucket_to_rehash];
|
||||
const size_type bucket_to_rehash = split_idx - bucket_cnt/2;
|
||||
bucket_type &old_bucket = buck_ptr[bucket_to_rehash];
|
||||
siterator before_i(old_bucket.before_begin());
|
||||
const siterator end_(old_bucket.end());
|
||||
const siterator end_sit(old_bucket.end());
|
||||
siterator i(old_bucket.begin());
|
||||
this->priv_split_traits().increment();
|
||||
|
||||
@@ -2179,8 +2179,8 @@ class hashtable_impl
|
||||
//moving elements from old_bucket to the target bucket, all moved
|
||||
//elements are moved back to the original one.
|
||||
detail::incremental_rehash_rollback<bucket_type, split_traits> rollback
|
||||
( bucket_pointer_[split_idx], old_bucket, this->priv_split_traits());
|
||||
for(;i != end_; ++i){
|
||||
( buck_ptr[split_idx], old_bucket, this->priv_split_traits());
|
||||
for(;i != end_sit; ++i){
|
||||
const value_type &v = this->priv_value_from_slist_node(i.pointed_node());
|
||||
const std::size_t hash_value = this->priv_stored_or_compute_hash(v, store_hash_t());
|
||||
const size_type new_n = this->priv_hash_to_bucket(hash_value);
|
||||
@@ -2191,7 +2191,7 @@ class hashtable_impl
|
||||
before_i = last;
|
||||
}
|
||||
else{
|
||||
bucket_type &new_b = bucket_pointer_[new_n];
|
||||
bucket_type &new_b = buck_ptr[new_n];
|
||||
new_b.splice_after(new_b.before_begin(), old_bucket, before_i, last);
|
||||
}
|
||||
i = before_i;
|
||||
@@ -2202,11 +2202,11 @@ class hashtable_impl
|
||||
}
|
||||
else{
|
||||
//Test if the split variable can be changed
|
||||
if(split_idx <= bucket_count_/2)
|
||||
if(split_idx <= bucket_cnt/2)
|
||||
return false;
|
||||
const size_type target_bucket_num = split_idx - 1 - bucket_count_/2;
|
||||
bucket_type &target_bucket = bucket_pointer_[target_bucket_num];
|
||||
bucket_type &source_bucket = bucket_pointer_[split_idx-1];
|
||||
const size_type target_bucket_num = split_idx - 1 - bucket_cnt/2;
|
||||
bucket_type &target_bucket = buck_ptr[target_bucket_num];
|
||||
bucket_type &source_bucket = buck_ptr[split_idx-1];
|
||||
target_bucket.splice_after(target_bucket.cbefore_begin(), source_bucket);
|
||||
this->priv_split_traits().decrement();
|
||||
this->priv_insertion_update_cache(target_bucket_num);
|
||||
@@ -2324,20 +2324,20 @@ class hashtable_impl
|
||||
std::size_t priv_hash_to_bucket(std::size_t hash_value) const
|
||||
{ return this->priv_hash_to_bucket(hash_value, this->priv_real_bucket_traits().bucket_count(), this->priv_split_traits().get_size()); }
|
||||
|
||||
std::size_t priv_hash_to_bucket(std::size_t hash_value, std::size_t bucket_count_, std::size_t split) const
|
||||
std::size_t priv_hash_to_bucket(std::size_t hash_value, std::size_t bucket_cnt, std::size_t split) const
|
||||
{
|
||||
std::size_t bucket_number = hashtable_impl::priv_hash_to_bucket_impl(hash_value, bucket_count_, power_2_buckets_t());
|
||||
std::size_t bucket_number = hashtable_impl::priv_hash_to_bucket_impl(hash_value, bucket_cnt, power_2_buckets_t());
|
||||
if(incremental)
|
||||
if(bucket_number >= split)
|
||||
bucket_number -= bucket_count_/2;
|
||||
bucket_number -= bucket_cnt/2;
|
||||
return bucket_number;
|
||||
}
|
||||
|
||||
static std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_count, detail::false_)
|
||||
{ return hash_value % bucket_count; }
|
||||
static std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_cnt, detail::false_)
|
||||
{ return hash_value % bucket_cnt; }
|
||||
|
||||
static std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_count, detail::true_)
|
||||
{ return hash_value & (bucket_count - 1); }
|
||||
static std::size_t priv_hash_to_bucket_impl(std::size_t hash_value, std::size_t bucket_cnt, detail::true_)
|
||||
{ return hash_value & (bucket_cnt - 1); }
|
||||
|
||||
const key_equal &priv_equal() const
|
||||
{ return static_cast<const key_equal&>(this->data_.internal_.bucket_hash_equal_.get()); }
|
||||
@@ -2413,20 +2413,20 @@ class hashtable_impl
|
||||
|
||||
template<class Disposer>
|
||||
void priv_erase_range_impl
|
||||
(size_type bucket_num, siterator before_first_it, siterator end_, Disposer disposer, size_type &num_erased)
|
||||
(size_type bucket_num, siterator before_first_it, siterator end_sit, Disposer disposer, size_type &num_erased)
|
||||
{
|
||||
const bucket_ptr buckets = this->priv_bucket_pointer();
|
||||
bucket_type &b = buckets[bucket_num];
|
||||
|
||||
if(before_first_it == b.before_begin() && end_ == b.end()){
|
||||
if(before_first_it == b.before_begin() && end_sit == b.end()){
|
||||
this->priv_erase_range_impl(bucket_num, 1, disposer, num_erased);
|
||||
}
|
||||
else{
|
||||
num_erased = 0;
|
||||
siterator to_erase(before_first_it);
|
||||
++to_erase;
|
||||
slist_node_ptr end_ptr = end_.pointed_node();
|
||||
while(to_erase != end_){
|
||||
slist_node_ptr end_ptr = end_sit.pointed_node();
|
||||
while(to_erase != end_sit){
|
||||
group_functions_t::erase_from_group(end_ptr, hashtable_impl::dcast_bucket_ptr(to_erase.pointed_node()), optimize_multikey_t());
|
||||
to_erase = b.erase_after_and_dispose(before_first_it, make_node_disposer(disposer));
|
||||
++num_erased;
|
||||
@@ -2447,8 +2447,8 @@ class hashtable_impl
|
||||
siterator b_begin(b.before_begin());
|
||||
siterator nxt(b_begin);
|
||||
++nxt;
|
||||
siterator end_(b.end());
|
||||
while(nxt != end_){
|
||||
siterator end_sit(b.end());
|
||||
while(nxt != end_sit){
|
||||
group_functions_t::init_group(hashtable_impl::dcast_bucket_ptr(nxt.pointed_node()), optimize_multikey_t());
|
||||
nxt = b.erase_after_and_dispose
|
||||
(b_begin, make_node_disposer(disposer));
|
||||
@@ -2648,8 +2648,8 @@ class hashtable_impl
|
||||
siterator priv_begin(detail::false_) const
|
||||
{
|
||||
size_type n = 0;
|
||||
size_type bucket_count_ = this->priv_bucket_count();
|
||||
for (n = 0; n < bucket_count_; ++n){
|
||||
size_type bucket_cnt = this->priv_bucket_count();
|
||||
for (n = 0; n < bucket_cnt; ++n){
|
||||
bucket_type &b = this->priv_bucket_pointer()[n];
|
||||
if(!b.empty()){
|
||||
return b.begin();
|
||||
@@ -2772,9 +2772,9 @@ class hashtable_impl
|
||||
void priv_initialize_buckets()
|
||||
{ this->priv_clear_buckets(this->priv_bucket_pointer(), this->priv_bucket_count()); }
|
||||
|
||||
void priv_clear_buckets(bucket_ptr buckets_ptr, size_type bucket_count_)
|
||||
void priv_clear_buckets(bucket_ptr buckets_ptr, size_type bucket_cnt)
|
||||
{
|
||||
for(; bucket_count_--; ++buckets_ptr){
|
||||
for(; bucket_cnt--; ++buckets_ptr){
|
||||
if(safemode_or_autounlink){
|
||||
hashtable_impl::priv_clear_group_nodes(*buckets_ptr, optimize_multikey_t());
|
||||
buckets_ptr->clear_and_dispose(detail::init_disposer<node_algorithms>());
|
||||
@@ -2877,10 +2877,10 @@ class hashtable_impl
|
||||
, KeyValueEqual equal_func
|
||||
, size_type &bucket_number_first
|
||||
, size_type &bucket_number_second
|
||||
, size_type &count_) const
|
||||
, size_type &cnt) const
|
||||
{
|
||||
std::size_t h;
|
||||
count_ = 0;
|
||||
cnt = 0;
|
||||
siterator prev;
|
||||
//Let's see if the element is present
|
||||
std::pair<siterator, siterator> to_return
|
||||
@@ -2890,23 +2890,23 @@ class hashtable_impl
|
||||
bucket_number_second = bucket_number_first;
|
||||
return to_return;
|
||||
}
|
||||
{
|
||||
//If it's present, find the first that it's not equal in
|
||||
//the same bucket
|
||||
{
|
||||
bucket_type &b = this->priv_bucket_pointer()[bucket_number_first];
|
||||
siterator it = to_return.first;
|
||||
if(optimize_multikey){
|
||||
to_return.second = bucket_type::s_iterator_to
|
||||
(*node_traits::get_next(group_functions_t::get_last_in_group
|
||||
(hashtable_impl::dcast_bucket_ptr(it.pointed_node()), optimize_multikey_t())));
|
||||
count_ = std::distance(it, to_return.second);
|
||||
cnt = std::distance(it, to_return.second);
|
||||
if(to_return.second != b.end()){
|
||||
bucket_number_second = bucket_number_first;
|
||||
return to_return;
|
||||
}
|
||||
}
|
||||
else{
|
||||
++count_;
|
||||
++cnt;
|
||||
++it;
|
||||
while(it != b.end()){
|
||||
const value_type &v = this->priv_value_from_slist_node(it.pointed_node());
|
||||
@@ -2924,7 +2924,7 @@ class hashtable_impl
|
||||
return to_return;
|
||||
}
|
||||
++it;
|
||||
++count_;
|
||||
++cnt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -202,7 +202,7 @@ class list_impl
|
||||
//!
|
||||
//! <b>Throws</b>: If real_value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks).
|
||||
list_impl(const value_traits &v_traits = value_traits())
|
||||
explicit list_impl(const value_traits &v_traits = value_traits())
|
||||
: data_(v_traits)
|
||||
{
|
||||
this->priv_size_traits().set_size(size_type(0));
|
||||
@@ -916,9 +916,9 @@ class list_impl
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: p must be a valid iterator of *this.
|
||||
//! start and end must point to elements contained in list x.
|
||||
//! f and e must point to elements contained in list x.
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range pointed by start and end from list x to this list,
|
||||
//! <b>Effects</b>: Transfers the range pointed by f and e from list x to this list,
|
||||
//! before the the element pointed by p. No destructors or copy constructors are called.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
@@ -928,19 +928,19 @@ class list_impl
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void splice(const_iterator p, list_impl&x, const_iterator start, const_iterator end_)
|
||||
void splice(const_iterator p, list_impl&x, const_iterator f, const_iterator e)
|
||||
{
|
||||
if(constant_time_size)
|
||||
this->splice(p, x, start, end_, std::distance(start, end_));
|
||||
this->splice(p, x, f, e, std::distance(f, e));
|
||||
else
|
||||
this->splice(p, x, start, end_, 1);//distance is a dummy value
|
||||
this->splice(p, x, f, e, 1);//distance is a dummy value
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: p must be a valid iterator of *this.
|
||||
//! start and end must point to elements contained in list x.
|
||||
//! n == std::distance(start, end)
|
||||
//! f and e must point to elements contained in list x.
|
||||
//! n == std::distance(f, e)
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range pointed by start and end from list x to this list,
|
||||
//! <b>Effects</b>: Transfers the range pointed by f and e from list x to this list,
|
||||
//! before the the element pointed by p. No destructors or copy constructors are called.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
@@ -949,19 +949,19 @@ class list_impl
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void splice(const_iterator p, list_impl&x, const_iterator start, const_iterator end_, difference_type n)
|
||||
void splice(const_iterator p, list_impl&x, const_iterator f, const_iterator e, difference_type n)
|
||||
{
|
||||
if(n){
|
||||
if(constant_time_size){
|
||||
size_traits &thist = this->priv_size_traits();
|
||||
size_traits &xt = x.priv_size_traits();
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(n == std::distance(start, end_));
|
||||
node_algorithms::transfer(p.pointed_node(), start.pointed_node(), end_.pointed_node());
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(n == std::distance(f, e));
|
||||
node_algorithms::transfer(p.pointed_node(), f.pointed_node(), e.pointed_node());
|
||||
thist.set_size(thist.get_size() + n);
|
||||
xt.set_size(xt.get_size() - n);
|
||||
}
|
||||
else{
|
||||
node_algorithms::transfer(p.pointed_node(), start.pointed_node(), end_.pointed_node());
|
||||
node_algorithms::transfer(p.pointed_node(), f.pointed_node(), e.pointed_node());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -81,10 +81,10 @@ struct pointer_traits
|
||||
typedef typename boost::intrusive::detail::type_rebinder<Ptr, U>::type type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_ALIASES)
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
template <class U> using rebind = typename boost::intrusive::detail::type_rebinder<Ptr, U>::type;
|
||||
#endif
|
||||
#endif //#if !defined(BOOST_NO_TEMPLATE_ALIASES)
|
||||
#endif //#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
//! <b>Remark</b>: If element_type is (possibly cv-qualified) void, r type is unspecified; otherwise,
|
||||
//! it is element_type &.
|
||||
@@ -225,7 +225,7 @@ struct pointer_traits<T*>
|
||||
template <class U> using rebind = U*;
|
||||
#else
|
||||
typedef typename boost::intrusive::detail::unvoid<element_type>::type& reference;
|
||||
#if !defined(BOOST_NO_TEMPLATE_ALIASES)
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
template <class U> using rebind = U*;
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -224,7 +224,7 @@ class rbtree_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructorof the value_compare object throws. Basic guarantee.
|
||||
rbtree_impl( const value_compare &cmp = value_compare()
|
||||
explicit rbtree_impl( const value_compare &cmp = value_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: data_(cmp, v_traits)
|
||||
{
|
||||
|
@@ -93,7 +93,7 @@ class set_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor of the value_compare object throws.
|
||||
set_impl( const value_compare &cmp = value_compare()
|
||||
explicit set_impl( const value_compare &cmp = value_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_(cmp, v_traits)
|
||||
{}
|
||||
@@ -1394,7 +1394,7 @@ class multiset_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor/operator() of the value_compare object throws.
|
||||
multiset_impl( const value_compare &cmp = value_compare()
|
||||
explicit multiset_impl( const value_compare &cmp = value_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_(cmp, v_traits)
|
||||
{}
|
||||
|
@@ -84,7 +84,7 @@ class sg_set_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor of the value_compare object throws.
|
||||
sg_set_impl( const value_compare &cmp = value_compare()
|
||||
explicit sg_set_impl( const value_compare &cmp = value_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_(cmp, v_traits)
|
||||
{}
|
||||
@@ -1417,7 +1417,7 @@ class sg_multiset_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor/operator() of the value_compare object throws.
|
||||
sg_multiset_impl( const value_compare &cmp = value_compare()
|
||||
explicit sg_multiset_impl( const value_compare &cmp = value_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_(cmp, v_traits)
|
||||
{}
|
||||
|
@@ -370,7 +370,7 @@ class sgtree_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructorof the value_compare object throws. Basic guarantee.
|
||||
sgtree_impl( const value_compare &cmp = value_compare()
|
||||
explicit sgtree_impl( const value_compare &cmp = value_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: data_(cmp, v_traits)
|
||||
{
|
||||
@@ -701,9 +701,9 @@ class sgtree_impl
|
||||
template<class Iterator>
|
||||
void insert_equal(Iterator b, Iterator e)
|
||||
{
|
||||
iterator end_(this->end());
|
||||
iterator iend(this->end());
|
||||
for (; b != e; ++b)
|
||||
this->insert_equal(end_, *b);
|
||||
this->insert_equal(iend, *b);
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: value must be an lvalue
|
||||
@@ -767,9 +767,9 @@ class sgtree_impl
|
||||
void insert_unique(Iterator b, Iterator e)
|
||||
{
|
||||
if(this->empty()){
|
||||
iterator end_(this->end());
|
||||
iterator iend(this->end());
|
||||
for (; b != e; ++b)
|
||||
this->insert_unique(end_, *b);
|
||||
this->insert_unique(iend, *b);
|
||||
}
|
||||
else{
|
||||
for (; b != e; ++b)
|
||||
|
@@ -186,10 +186,17 @@ class slist_impl
|
||||
{ return this->set_last_node(n, detail::bool_<cache_last>()); }
|
||||
|
||||
static node_ptr get_last_node(detail::bool_<false>)
|
||||
{ return node_ptr(); }
|
||||
{
|
||||
//This function shall not be used if cache_last is not true
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(cache_last);
|
||||
return node_ptr();
|
||||
}
|
||||
|
||||
static void set_last_node(const node_ptr &, detail::bool_<false>)
|
||||
{}
|
||||
{
|
||||
//This function shall not be used if cache_last is not true
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(cache_last);
|
||||
}
|
||||
|
||||
node_ptr get_last_node(detail::bool_<true>)
|
||||
{ return node_ptr(data_.root_plus_size_.last_); }
|
||||
@@ -273,19 +280,56 @@ class slist_impl
|
||||
{ return this->get_real_value_traits(detail::bool_<external_value_traits>()); }
|
||||
|
||||
public:
|
||||
|
||||
///@cond
|
||||
|
||||
//! <b>Requires</b>: f and before_l belong to another slist.
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range [f, before_l] to this
|
||||
//! list, after the element pointed by prev_pos.
|
||||
//! No destructors or copy constructors are called.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the number of elements transferred
|
||||
//! if constant_time_size is true. Constant-time otherwise.
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
//!
|
||||
//! <b>Warning</b>: Experimental function, don't use it!
|
||||
slist_impl( const node_ptr & f, const node_ptr & before_l
|
||||
, size_type n, const value_traits &v_traits = value_traits())
|
||||
: data_(v_traits)
|
||||
{
|
||||
if(n){
|
||||
this->priv_size_traits().set_size(n);
|
||||
if(cache_last){
|
||||
this->set_last_node(before_l);
|
||||
}
|
||||
node_traits::set_next(this->get_root_node(), f);
|
||||
node_traits::set_next(before_l, this->get_end_node());
|
||||
}
|
||||
else{
|
||||
this->set_default_constructed_state();
|
||||
}
|
||||
}
|
||||
|
||||
///@endcond
|
||||
|
||||
//! <b>Effects</b>: constructs an empty list.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant
|
||||
//!
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks).
|
||||
slist_impl(const value_traits &v_traits = value_traits())
|
||||
explicit slist_impl(const value_traits &v_traits = value_traits())
|
||||
: data_(v_traits)
|
||||
{ this->set_default_constructed_state(); }
|
||||
|
||||
//! <b>Requires</b>: Dereferencing iterator must yield an lvalue of type value_type.
|
||||
//!
|
||||
//! <b>Effects</b>: Constructs a list equal to [first,last).
|
||||
//! <b>Effects</b>: Constructs a list equal to [b ,e).
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear in std::distance(b, e). No copy constructors are called.
|
||||
//!
|
||||
@@ -406,7 +450,14 @@ class slist_impl
|
||||
void push_back(reference value)
|
||||
{
|
||||
BOOST_STATIC_ASSERT((cache_last));
|
||||
this->insert_after(const_iterator(this->get_last_node(), this), value);
|
||||
node_ptr n = get_real_value_traits().to_node_ptr(value);
|
||||
if(safemode_or_autounlink)
|
||||
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::inited(n));
|
||||
node_algorithms::link_after(this->get_last_node(), n);
|
||||
if(cache_last){
|
||||
this->set_last_node(n);
|
||||
}
|
||||
this->priv_size_traits().increment();
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Erases the first element of the list.
|
||||
@@ -573,9 +624,13 @@ class slist_impl
|
||||
//!
|
||||
//! <b>Note</b>: This function is present only if cached_last<> option is true.
|
||||
iterator last()
|
||||
{ return iterator (this->get_last_node(), this); }
|
||||
{
|
||||
//This function shall not be used if cache_last is not true
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(cache_last);
|
||||
return iterator (this->get_last_node(), this);
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
|
||||
//! <b>Effects</b>: Returns a const_iterator to the last element contained in the list.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
@@ -583,9 +638,13 @@ class slist_impl
|
||||
//!
|
||||
//! <b>Note</b>: This function is present only if cached_last<> option is true.
|
||||
const_iterator last() const
|
||||
{ return const_iterator (this->get_last_node(), this); }
|
||||
{
|
||||
//This function shall not be used if cache_last is not true
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(cache_last);
|
||||
return const_iterator (this->get_last_node(), this);
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
|
||||
//! <b>Effects</b>: Returns a const_iterator to the last element contained in the list.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
@@ -749,7 +808,7 @@ class slist_impl
|
||||
//! an lvalue of type value_type and prev_p must point to an element
|
||||
//! contained by the list or to the end node.
|
||||
//!
|
||||
//! <b>Effects</b>: Inserts the [first, last)
|
||||
//! <b>Effects</b>: Inserts the [f, l)
|
||||
//! after the position prev_p.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
@@ -758,10 +817,10 @@ class slist_impl
|
||||
//!
|
||||
//! <b>Note</b>: Does not affect the validity of iterators and references.
|
||||
template<class Iterator>
|
||||
void insert_after(const_iterator prev_p, Iterator first, Iterator last_)
|
||||
void insert_after(const_iterator prev_p, Iterator f, Iterator l)
|
||||
{
|
||||
for (; first != last_; ++first)
|
||||
prev_p = this->insert_after(prev_p, *first);
|
||||
for (; f != l; ++f)
|
||||
prev_p = this->insert_after(prev_p, *f);
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: value must be an lvalue and p must point to an element
|
||||
@@ -812,7 +871,7 @@ class slist_impl
|
||||
iterator erase_after(const_iterator prev)
|
||||
{ return this->erase_after_and_dispose(prev, detail::null_disposer()); }
|
||||
|
||||
//! <b>Effects</b>: Erases the range (before_first, last) from
|
||||
//! <b>Effects</b>: Erases the range (before_f, l) from
|
||||
//! the list. No destructors are called.
|
||||
//!
|
||||
//! <b>Returns</b>: the first element remaining beyond the removed elements,
|
||||
@@ -825,26 +884,26 @@ class slist_impl
|
||||
//!
|
||||
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
|
||||
//! erased element.
|
||||
iterator erase_after(const_iterator before_first, const_iterator last_)
|
||||
iterator erase_after(const_iterator before_f, const_iterator l)
|
||||
{
|
||||
if(safemode_or_autounlink || constant_time_size){
|
||||
return this->erase_after_and_dispose(before_first, last_, detail::null_disposer());
|
||||
return this->erase_after_and_dispose(before_f, l, detail::null_disposer());
|
||||
}
|
||||
else{
|
||||
node_ptr bfp = before_first.pointed_node();
|
||||
node_ptr lp = last_.pointed_node();
|
||||
const node_ptr bfp = before_f.pointed_node();
|
||||
const node_ptr lp = l.pointed_node();
|
||||
if(cache_last){
|
||||
if(lp == this->get_end_node()){
|
||||
this->set_last_node(bfp);
|
||||
}
|
||||
}
|
||||
node_algorithms::unlink_after(bfp, lp);
|
||||
return last_.unconst();
|
||||
return l.unconst();
|
||||
}
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Erases the range (before_first, last) from
|
||||
//! the list. n must be std::distance(before_first, last) - 1.
|
||||
//! <b>Effects</b>: Erases the range (before_f, l) from
|
||||
//! the list. n must be std::distance(before_f, l) - 1.
|
||||
//! No destructors are called.
|
||||
//!
|
||||
//! <b>Returns</b>: the first element remaining beyond the removed elements,
|
||||
@@ -853,19 +912,19 @@ class slist_impl
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: constant-time if link_mode is normal_link.
|
||||
//! Linear to the elements (last - before_first) otherwise.
|
||||
//! Linear to the elements (l - before_f) otherwise.
|
||||
//!
|
||||
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
|
||||
//! erased element.
|
||||
iterator erase_after(const_iterator before_first, const_iterator last_, difference_type n)
|
||||
iterator erase_after(const_iterator before_f, const_iterator l, size_type n)
|
||||
{
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(++const_iterator(before_first), last_) == difference_type(n));
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(++const_iterator(before_f), l) == difference_type(n));
|
||||
if(safemode_or_autounlink){
|
||||
return this->erase_after(before_first, last_);
|
||||
return this->erase_after(before_f, l);
|
||||
}
|
||||
else{
|
||||
node_ptr bfp = before_first.pointed_node();
|
||||
node_ptr lp = last_.pointed_node();
|
||||
const node_ptr bfp = before_f.pointed_node();
|
||||
const node_ptr lp = l.pointed_node();
|
||||
if(cache_last){
|
||||
if((lp == this->get_end_node())){
|
||||
this->set_last_node(bfp);
|
||||
@@ -875,7 +934,7 @@ class slist_impl
|
||||
if(constant_time_size){
|
||||
this->priv_size_traits().set_size(this->priv_size_traits().get_size() - n);
|
||||
}
|
||||
return last_.unconst();
|
||||
return l.unconst();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -894,7 +953,7 @@ class slist_impl
|
||||
iterator erase(const_iterator i)
|
||||
{ return this->erase_after(this->previous(i)); }
|
||||
|
||||
//! <b>Requires</b>: first and last must be valid iterator to elements in *this.
|
||||
//! <b>Requires</b>: f and l must be valid iterator to elements in *this.
|
||||
//!
|
||||
//! <b>Effects</b>: Erases the range pointed by b and e.
|
||||
//! No destructors are called.
|
||||
@@ -904,15 +963,15 @@ class slist_impl
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the elements before last.
|
||||
//! <b>Complexity</b>: Linear to the elements before l.
|
||||
//!
|
||||
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
|
||||
//! erased elements.
|
||||
iterator erase(const_iterator first, const_iterator last_)
|
||||
{ return this->erase_after(this->previous(first), last_); }
|
||||
iterator erase(const_iterator f, const_iterator l)
|
||||
{ return this->erase_after(this->previous(f), l); }
|
||||
|
||||
//! <b>Effects</b>: Erases the range [first, last) from
|
||||
//! the list. n must be std::distance(first, last).
|
||||
//! <b>Effects</b>: Erases the range [f, l) from
|
||||
//! the list. n must be std::distance(f, l).
|
||||
//! No destructors are called.
|
||||
//!
|
||||
//! <b>Returns</b>: the first element remaining beyond the removed elements,
|
||||
@@ -920,13 +979,13 @@ class slist_impl
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: linear to the elements before first if link_mode is normal_link
|
||||
//! and constant_time_size is activated. Linear to the elements before last otherwise.
|
||||
//! <b>Complexity</b>: linear to the elements before f if link_mode is normal_link
|
||||
//! and constant_time_size is activated. Linear to the elements before l otherwise.
|
||||
//!
|
||||
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
|
||||
//! erased element.
|
||||
iterator erase(const_iterator first, const_iterator last_, difference_type n)
|
||||
{ return this->erase_after(this->previous(first), last_, n); }
|
||||
iterator erase(const_iterator f, const_iterator l, size_type n)
|
||||
{ return this->erase_after(this->previous(f), l, n); }
|
||||
|
||||
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
|
||||
//!
|
||||
@@ -986,7 +1045,7 @@ class slist_impl
|
||||
|
||||
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
|
||||
//!
|
||||
//! <b>Effects</b>: Erases the range (before_first, last) from
|
||||
//! <b>Effects</b>: Erases the range (before_f, l) from
|
||||
//! the list.
|
||||
//! Disposer::operator()(pointer) is called for the removed elements.
|
||||
//!
|
||||
@@ -995,13 +1054,13 @@ class slist_impl
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Lineal to the elements (last - before_first + 1).
|
||||
//! <b>Complexity</b>: Lineal to the elements (l - before_f + 1).
|
||||
//!
|
||||
//! <b>Note</b>: Invalidates the iterators to the erased element.
|
||||
template<class Disposer>
|
||||
iterator erase_after_and_dispose(const_iterator before_first, const_iterator last_, Disposer disposer)
|
||||
iterator erase_after_and_dispose(const_iterator before_f, const_iterator l, Disposer disposer)
|
||||
{
|
||||
node_ptr bfp(before_first.pointed_node()), lp(last_.pointed_node());
|
||||
node_ptr bfp(before_f.pointed_node()), lp(l.pointed_node());
|
||||
node_ptr fp(node_traits::get_next(bfp));
|
||||
node_algorithms::unlink_after(bfp, lp);
|
||||
while(fp != lp){
|
||||
@@ -1015,7 +1074,7 @@ class slist_impl
|
||||
if(cache_last && (node_traits::get_next(bfp) == this->get_end_node())){
|
||||
this->set_last_node(bfp);
|
||||
}
|
||||
return last_.unconst();
|
||||
return l.unconst();
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
|
||||
@@ -1043,7 +1102,7 @@ class slist_impl
|
||||
{ return this->erase_and_dispose(const_iterator(i), disposer); }
|
||||
#endif
|
||||
|
||||
//! <b>Requires</b>: first and last must be valid iterator to elements in *this.
|
||||
//! <b>Requires</b>: f and l must be valid iterator to elements in *this.
|
||||
//! Disposer::operator()(pointer) shouldn't throw.
|
||||
//!
|
||||
//! <b>Effects</b>: Erases the range pointed by b and e.
|
||||
@@ -1056,13 +1115,13 @@ class slist_impl
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the number of erased elements plus linear
|
||||
//! to the elements before first.
|
||||
//! to the elements before f.
|
||||
//!
|
||||
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
|
||||
//! erased elements.
|
||||
template<class Disposer>
|
||||
iterator erase_and_dispose(const_iterator first, const_iterator last_, Disposer disposer)
|
||||
{ return this->erase_after_and_dispose(this->previous(first), last_, disposer); }
|
||||
iterator erase_and_dispose(const_iterator f, const_iterator l, Disposer disposer)
|
||||
{ return this->erase_after_and_dispose(this->previous(f), l, disposer); }
|
||||
|
||||
//! <b>Requires</b>: Dereferencing iterator must yield
|
||||
//! an lvalue of type value_type.
|
||||
@@ -1121,23 +1180,23 @@ class slist_impl
|
||||
//!
|
||||
//! <b>Complexity</b>: In general, linear to the elements contained in x.
|
||||
//! Constant-time if cache_last<> option is true and also constant-time if
|
||||
//! linear<> option is true "this" is empty and "last" is not used.
|
||||
//! linear<> option is true "this" is empty and "l" is not used.
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
//!
|
||||
//! <b>Additional note</b>: If the optional parameter "last" is provided, it will be
|
||||
//! <b>Additional note</b>: If the optional parameter "l" is provided, it will be
|
||||
//! assigned to the last spliced element or prev if x is empty.
|
||||
//! This iterator can be used as new "prev" iterator for a new splice_after call.
|
||||
//! that will splice new values after the previously spliced values.
|
||||
void splice_after(const_iterator prev, slist_impl &x, const_iterator *last_ = 0)
|
||||
void splice_after(const_iterator prev, slist_impl &x, const_iterator *l = 0)
|
||||
{
|
||||
if(x.empty()){
|
||||
if(last_) *last_ = prev;
|
||||
if(l) *l = prev;
|
||||
}
|
||||
else if(linear && this->empty()){
|
||||
this->swap(x);
|
||||
if(last_) *last_ = this->previous(this->cend());
|
||||
if(l) *l = this->previous(this->cend());
|
||||
}
|
||||
else{
|
||||
const_iterator last_x(x.previous(x.end())); //<- constant time if cache_last is active
|
||||
@@ -1152,7 +1211,7 @@ class slist_impl
|
||||
node_algorithms::transfer_after( prev_n, x.before_begin().pointed_node(), last_x_n);
|
||||
this->priv_size_traits().set_size(this->priv_size_traits().get_size() + x.priv_size_traits().get_size());
|
||||
x.priv_size_traits().set_size(size_type(0));
|
||||
if(last_) *last_ = last_x;
|
||||
if(l) *l = last_x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1176,10 +1235,10 @@ class slist_impl
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: prev_pos must be a dereferenceable iterator in *this or be
|
||||
//! before_begin(), and before_first and before_last belong to x and
|
||||
//! ++before_first != x.end() && before_last != x.end().
|
||||
//! before_begin(), and before_f and before_l belong to x and
|
||||
//! ++before_f != x.end() && before_l != x.end().
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range (before_first, before_last] from list x to this
|
||||
//! <b>Effects</b>: Transfers the range (before_f, before_l] from list x to this
|
||||
//! list, after the element pointed by prev_pos.
|
||||
//! No destructors or copy constructors are called.
|
||||
//!
|
||||
@@ -1190,21 +1249,21 @@ class slist_impl
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_first, const_iterator before_last)
|
||||
void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_f, const_iterator before_l)
|
||||
{
|
||||
if(constant_time_size)
|
||||
this->splice_after(prev_pos, x, before_first, before_last, std::distance(before_first, before_last));
|
||||
this->splice_after(prev_pos, x, before_f, before_l, std::distance(before_f, before_l));
|
||||
else
|
||||
this->priv_splice_after
|
||||
(prev_pos.pointed_node(), x, before_first.pointed_node(), before_last.pointed_node());
|
||||
(prev_pos.pointed_node(), x, before_f.pointed_node(), before_l.pointed_node());
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: prev_pos must be a dereferenceable iterator in *this or be
|
||||
//! before_begin(), and before_first and before_last belong to x and
|
||||
//! ++before_first != x.end() && before_last != x.end() and
|
||||
//! n == std::distance(before_first, before_last).
|
||||
//! before_begin(), and before_f and before_l belong to x and
|
||||
//! ++before_f != x.end() && before_l != x.end() and
|
||||
//! n == std::distance(before_f, before_l).
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range (before_first, before_last] from list x to this
|
||||
//! <b>Effects</b>: Transfers the range (before_f, before_l] from list x to this
|
||||
//! list, after the element pointed by p. No destructors or copy constructors are called.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
@@ -1213,18 +1272,16 @@ class slist_impl
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_first, const_iterator before_last, difference_type n)
|
||||
void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_f, const_iterator before_l, size_type n)
|
||||
{
|
||||
if(n){
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(before_first, before_last) == n);
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(before_f, before_l) == difference_type(n));
|
||||
this->priv_splice_after
|
||||
(prev_pos.pointed_node(), x, before_first.pointed_node(), before_last.pointed_node());
|
||||
(prev_pos.pointed_node(), x, before_f.pointed_node(), before_l.pointed_node());
|
||||
if(constant_time_size){
|
||||
this->priv_size_traits().set_size(this->priv_size_traits().get_size() + n);
|
||||
x.priv_size_traits().set_size(x.priv_size_traits().get_size() - n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: it is an iterator to an element in *this.
|
||||
//!
|
||||
@@ -1243,12 +1300,12 @@ class slist_impl
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
//!
|
||||
//! <b>Additional note</b>: If the optional parameter "last" is provided, it will be
|
||||
//! <b>Additional note</b>: If the optional parameter "l" is provided, it will be
|
||||
//! assigned to the last spliced element or prev if x is empty.
|
||||
//! This iterator can be used as new "prev" iterator for a new splice_after call.
|
||||
//! that will splice new values after the previously spliced values.
|
||||
void splice(const_iterator it, slist_impl &x, const_iterator *last_ = 0)
|
||||
{ this->splice_after(this->previous(it), x, last_); }
|
||||
void splice(const_iterator it, slist_impl &x, const_iterator *l = 0)
|
||||
{ this->splice_after(this->previous(it), x, l); }
|
||||
|
||||
//! <b>Requires</b>: it p must be a valid iterator of *this.
|
||||
//! elem must point to an element contained in list
|
||||
@@ -1268,43 +1325,43 @@ class slist_impl
|
||||
{ return this->splice_after(this->previous(pos), x, x.previous(elem)); }
|
||||
|
||||
//! <b>Requires</b>: pos must be a dereferenceable iterator in *this
|
||||
//! and first and last belong to x and first and last a valid range on x.
|
||||
//! and f and f belong to x and f and f a valid range on x.
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range [first, last) from list x to this
|
||||
//! <b>Effects</b>: Transfers the range [f, l) from list x to this
|
||||
//! list, before the element pointed by pos.
|
||||
//! No destructors or copy constructors are called.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the sum of elements before pos, first, and last
|
||||
//! <b>Complexity</b>: Linear to the sum of elements before pos, f, and l
|
||||
//! plus linear to the number of elements transferred if constant_time_size is true.
|
||||
//! Linear to the sum of elements before first, and last
|
||||
//! Linear to the sum of elements before f, and l
|
||||
//! plus linear to the number of elements transferred if constant_time_size is true
|
||||
//! if cache_last<> is true and pos == end()
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void splice(const_iterator pos, slist_impl &x, const_iterator first, const_iterator last_)
|
||||
{ return this->splice_after(this->previous(pos), x, x.previous(first), x.previous(last_)); }
|
||||
void splice(const_iterator pos, slist_impl &x, const_iterator f, const_iterator l)
|
||||
{ return this->splice_after(this->previous(pos), x, x.previous(f), x.previous(l)); }
|
||||
|
||||
//! <b>Requires</b>: pos must be a dereferenceable iterator in *this
|
||||
//! and first and last belong to x and first and last a valid range on x.
|
||||
//! n == std::distance(first, last).
|
||||
//! and f and l belong to x and f and l a valid range on x.
|
||||
//! n == std::distance(f, l).
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range [first, last) from list x to this
|
||||
//! <b>Effects</b>: Transfers the range [f, l) from list x to this
|
||||
//! list, before the element pointed by pos.
|
||||
//! No destructors or copy constructors are called.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to the sum of elements before pos, first, and last.
|
||||
//! Linear to the sum of elements before first and last
|
||||
//! <b>Complexity</b>: Linear to the sum of elements before pos, f, and l.
|
||||
//! Linear to the sum of elements before f and l
|
||||
//! if cache_last<> is true and pos == end().
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void splice(const_iterator pos, slist_impl &x, const_iterator first, const_iterator last_, difference_type n)
|
||||
{ return this->splice_after(this->previous(pos), x, x.previous(first), x.previous(last_), n); }
|
||||
void splice(const_iterator pos, slist_impl &x, const_iterator f, const_iterator l, size_type n)
|
||||
{ return this->splice_after(this->previous(pos), x, x.previous(f), x.previous(l), n); }
|
||||
|
||||
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
|
||||
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
|
||||
@@ -1402,14 +1459,14 @@ class slist_impl
|
||||
//!
|
||||
//! <b>Note</b>: Iterators and references are not invalidated.
|
||||
//!
|
||||
//! <b>Additional note</b>: If optional "last" argument is passed, it is assigned
|
||||
//! <b>Additional note</b>: If optional "l" argument is passed, it is assigned
|
||||
//! to an iterator to the last transferred value or end() is x is empty.
|
||||
template<class Predicate>
|
||||
void merge(slist_impl& x, Predicate p, const_iterator *last_ = 0)
|
||||
void merge(slist_impl& x, Predicate p, const_iterator *l = 0)
|
||||
{
|
||||
const_iterator e(this->cend()), ex(x.cend()), bb(this->cbefore_begin()),
|
||||
bb_next;
|
||||
if(last_) *last_ = e.unconst();
|
||||
if(l) *l = e.unconst();
|
||||
while(!x.empty()){
|
||||
const_iterator ibx_next(x.cbefore_begin()), ibx(ibx_next++);
|
||||
while (++(bb_next = bb) != e && !p(*ibx_next, *bb_next)){
|
||||
@@ -1417,7 +1474,7 @@ class slist_impl
|
||||
}
|
||||
if(bb_next == e){
|
||||
//Now transfer the rest to the end of the container
|
||||
this->splice_after(bb, x, last_);
|
||||
this->splice_after(bb, x, l);
|
||||
break;
|
||||
}
|
||||
else{
|
||||
@@ -1426,7 +1483,7 @@ class slist_impl
|
||||
ibx = ibx_next; ++n;
|
||||
} while(++(ibx_next = ibx) != ex && p(*ibx_next, *bb_next));
|
||||
this->splice_after(bb, x, x.before_begin(), ibx, n);
|
||||
if(last_) *last_ = ibx;
|
||||
if(l) *l = ibx;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1728,11 +1785,12 @@ class slist_impl
|
||||
(prev_from.pointed_node(), i.pointed_node()), this);
|
||||
}
|
||||
|
||||
///@cond
|
||||
|
||||
//! <b>Requires</b>: prev_pos must be a dereferenceable iterator in *this or be
|
||||
//! before_begin(), and before_first and before_last belong to x and
|
||||
//! ++before_first != x.end() && before_last != x.end().
|
||||
//! before_begin(), and f and before_l belong to another slist.
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range (before_first, before_last] to this
|
||||
//! <b>Effects</b>: Transfers the range [f, before_l] to this
|
||||
//! list, after the element pointed by prev_pos.
|
||||
//! No destructors or copy constructors are called.
|
||||
//!
|
||||
@@ -1741,67 +1799,70 @@ class slist_impl
|
||||
//! <b>Complexity</b>: Linear to the number of elements transferred
|
||||
//! if constant_time_size is true. Constant-time otherwise.
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void incorporate_after(const_iterator prev_from, const node_ptr & first, const node_ptr & before_last)
|
||||
//! <b>Note</b>: Iterators of values obtained from the list that owned f and before_l now
|
||||
//! point to elements of this list. Iterators of this list and all the references are not invalidated.
|
||||
//!
|
||||
//! <b>Warning</b>: Experimental function, don't use it!
|
||||
void incorporate_after(const_iterator prev_pos, const node_ptr & f, const node_ptr & before_l)
|
||||
{
|
||||
if(constant_time_size)
|
||||
this->incorporate_after(prev_from, first, before_last, std::distance(first, before_last)+1);
|
||||
this->incorporate_after(prev_pos, f, before_l, std::distance(f, before_l)+1);
|
||||
else
|
||||
this->priv_incorporate_after
|
||||
(prev_from.pointed_node(), first, before_last);
|
||||
this->priv_incorporate_after(prev_pos.pointed_node(), f, before_l);
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: prev_pos must be a dereferenceable iterator in *this or be
|
||||
//! before_begin(), and before_first and before_last belong to x and
|
||||
//! ++before_first != x.end() && before_last != x.end() and
|
||||
//! n == std::distance(first, before_last) + 1.
|
||||
//! before_begin(), and f and before_l belong to another slist.
|
||||
//! n == std::distance(f, before_l) + 1.
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range (before_first, before_last] from list x to this
|
||||
//! list, after the element pointed by p. No destructors or copy constructors are called.
|
||||
//! <b>Effects</b>: Transfers the range [f, before_l] to this
|
||||
//! list, after the element pointed by prev_pos.
|
||||
//! No destructors or copy constructors are called.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
//!
|
||||
//! <b>Complexity</b>: Constant time.
|
||||
//!
|
||||
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
|
||||
//! list. Iterators of this list and all the references are not invalidated.
|
||||
void incorporate_after(const_iterator prev_pos, const node_ptr & first, const node_ptr & before_last, difference_type n)
|
||||
//! <b>Note</b>: Iterators of values obtained from the list that owned f and before_l now
|
||||
//! point to elements of this list. Iterators of this list and all the references are not invalidated.
|
||||
//!
|
||||
//! <b>Warning</b>: Experimental function, don't use it!
|
||||
void incorporate_after(const_iterator prev_pos, const node_ptr & f, const node_ptr & before_l, size_type n)
|
||||
{
|
||||
if(n){
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(std::distance(iterator(first, this), iterator(before_last, this))+1 == n);
|
||||
this->priv_incorporate_after(prev_pos.pointed_node(), first, before_last);
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(n > 0);
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(size_type(std::distance(iterator(f, this), iterator(before_l, this)))+1 == n);
|
||||
this->priv_incorporate_after(prev_pos.pointed_node(), f, before_l);
|
||||
if(constant_time_size){
|
||||
this->priv_size_traits().set_size(this->priv_size_traits().get_size() + n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///@endcond
|
||||
|
||||
private:
|
||||
void priv_splice_after(const node_ptr & prev_pos_n, slist_impl &x, const node_ptr & before_first_n, const node_ptr & before_last_n)
|
||||
void priv_splice_after(const node_ptr & prev_pos_n, slist_impl &x, const node_ptr & before_f_n, const node_ptr & before_l_n)
|
||||
{
|
||||
if (before_first_n != before_last_n && prev_pos_n != before_first_n && prev_pos_n != before_last_n)
|
||||
{
|
||||
if(cache_last){
|
||||
if(node_traits::get_next(prev_pos_n) == this->get_end_node()){
|
||||
this->set_last_node(before_last_n);
|
||||
if (cache_last && (before_f_n != before_l_n)){
|
||||
if(prev_pos_n == this->get_last_node()){
|
||||
this->set_last_node(before_l_n);
|
||||
}
|
||||
if(node_traits::get_next(before_last_n) == x.get_end_node()){
|
||||
x.set_last_node(before_first_n);
|
||||
if(&x != this && node_traits::get_next(before_l_n) == x.get_end_node()){
|
||||
x.set_last_node(before_f_n);
|
||||
}
|
||||
}
|
||||
node_algorithms::transfer_after(prev_pos_n, before_first_n, before_last_n);
|
||||
}
|
||||
node_algorithms::transfer_after(prev_pos_n, before_f_n, before_l_n);
|
||||
}
|
||||
|
||||
void priv_incorporate_after(const node_ptr & prev_pos_n, const node_ptr & first_n, const node_ptr & before_last_n)
|
||||
void priv_incorporate_after(const node_ptr & prev_pos_n, const node_ptr & first_n, const node_ptr & before_l_n)
|
||||
{
|
||||
if(cache_last){
|
||||
if(node_traits::get_next(prev_pos_n) == this->get_end_node()){
|
||||
this->set_last_node(before_last_n);
|
||||
if(prev_pos_n == this->get_last_node()){
|
||||
this->set_last_node(before_l_n);
|
||||
}
|
||||
}
|
||||
node_algorithms::incorporate_after(prev_pos_n, first_n, before_last_n);
|
||||
node_algorithms::incorporate_after(prev_pos_n, first_n, before_l_n);
|
||||
}
|
||||
|
||||
void priv_reverse(detail::bool_<false>)
|
||||
@@ -1816,9 +1877,9 @@ class slist_impl
|
||||
|
||||
void priv_shift_backwards(size_type n, detail::bool_<false>)
|
||||
{
|
||||
node_ptr last_ = node_algorithms::move_forward(this->get_root_node(), (std::size_t)n);
|
||||
if(cache_last && last_){
|
||||
this->set_last_node(last_);
|
||||
node_ptr l = node_algorithms::move_forward(this->get_root_node(), (std::size_t)n);
|
||||
if(cache_last && l){
|
||||
this->set_last_node(l);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1837,9 +1898,9 @@ class slist_impl
|
||||
|
||||
void priv_shift_forward(size_type n, detail::bool_<false>)
|
||||
{
|
||||
node_ptr last_ = node_algorithms::move_backwards(this->get_root_node(), (std::size_t)n);
|
||||
if(cache_last && last_){
|
||||
this->set_last_node(last_);
|
||||
node_ptr l = node_algorithms::move_backwards(this->get_root_node(), (std::size_t)n);
|
||||
if(cache_last && l){
|
||||
this->set_last_node(l);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2100,11 +2161,20 @@ class slist
|
||||
typedef typename Base::value_traits value_traits;
|
||||
typedef typename Base::iterator iterator;
|
||||
typedef typename Base::const_iterator const_iterator;
|
||||
typedef typename Base::size_type size_type;
|
||||
typedef typename Base::node_ptr node_ptr;
|
||||
|
||||
slist(const value_traits &v_traits = value_traits())
|
||||
explicit slist(const value_traits &v_traits = value_traits())
|
||||
: Base(v_traits)
|
||||
{}
|
||||
|
||||
struct incorporate_t{};
|
||||
|
||||
slist( const node_ptr & f, const node_ptr & before_l
|
||||
, size_type n, const value_traits &v_traits = value_traits())
|
||||
: Base(f, before_l, n, v_traits)
|
||||
{}
|
||||
|
||||
template<class Iterator>
|
||||
slist(Iterator b, Iterator e, const value_traits &v_traits = value_traits())
|
||||
: Base(b, e, v_traits)
|
||||
|
@@ -86,7 +86,7 @@ class splay_set_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor of the value_compare object throws.
|
||||
splay_set_impl( const value_compare &cmp = value_compare()
|
||||
explicit splay_set_impl( const value_compare &cmp = value_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_(cmp, v_traits)
|
||||
{}
|
||||
@@ -1404,7 +1404,7 @@ class splay_multiset_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor/operator() of the value_compare object throws.
|
||||
splay_multiset_impl( const value_compare &cmp = value_compare()
|
||||
explicit splay_multiset_impl( const value_compare &cmp = value_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_(cmp, v_traits)
|
||||
{}
|
||||
|
@@ -214,7 +214,7 @@ class splaytree_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructorof the value_compare object throws. Basic guarantee.
|
||||
splaytree_impl( const value_compare &cmp = value_compare()
|
||||
explicit splaytree_impl( const value_compare &cmp = value_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: data_(cmp, v_traits)
|
||||
{
|
||||
@@ -540,9 +540,9 @@ class splaytree_impl
|
||||
void insert_equal(Iterator b, Iterator e)
|
||||
{
|
||||
if(this->empty()){
|
||||
iterator end_(this->end());
|
||||
iterator iend(this->end());
|
||||
for (; b != e; ++b)
|
||||
this->insert_equal(end_, *b);
|
||||
this->insert_equal(iend, *b);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -9,8 +9,8 @@
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BOOST_INTRUSIVE_TRIE_HPP
|
||||
#define BOOST_INTRUSIVE_TRIE_HPP
|
||||
#ifndef BOOST_INTRUSIVE_TREAP_HPP
|
||||
#define BOOST_INTRUSIVE_TREAP_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <algorithm>
|
||||
@@ -232,7 +232,7 @@ class treap_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor of the value_compare/priority_compare objects throw. Basic guarantee.
|
||||
treap_impl( const value_compare &cmp = value_compare()
|
||||
explicit treap_impl( const value_compare &cmp = value_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: data_(cmp, pcmp, v_traits)
|
||||
@@ -627,9 +627,9 @@ class treap_impl
|
||||
template<class Iterator>
|
||||
void insert_equal(Iterator b, Iterator e)
|
||||
{
|
||||
iterator end_(this->end());
|
||||
iterator iend(this->end());
|
||||
for (; b != e; ++b)
|
||||
this->insert_equal(end_, *b);
|
||||
this->insert_equal(iend, *b);
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: value must be an lvalue
|
||||
@@ -696,9 +696,9 @@ class treap_impl
|
||||
void insert_unique(Iterator b, Iterator e)
|
||||
{
|
||||
if(this->empty()){
|
||||
iterator end_(this->end());
|
||||
iterator iend(this->end());
|
||||
for (; b != e; ++b)
|
||||
this->insert_unique(end_, *b);
|
||||
this->insert_unique(iend, *b);
|
||||
}
|
||||
else{
|
||||
for (; b != e; ++b)
|
||||
@@ -1879,4 +1879,4 @@ class treap
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_TRIE_HPP
|
||||
#endif //BOOST_INTRUSIVE_TREAP_HPP
|
||||
|
@@ -87,7 +87,7 @@ class treap_set_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor of the value_compare object throws.
|
||||
treap_set_impl( const value_compare &cmp = value_compare()
|
||||
explicit treap_set_impl( const value_compare &cmp = value_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_(cmp, pcmp, v_traits)
|
||||
@@ -1498,7 +1498,7 @@ class treap_multiset_impl
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
//! or the copy constructor of the value_compare/priority_compare objects throw.
|
||||
treap_multiset_impl( const value_compare &cmp = value_compare()
|
||||
explicit treap_multiset_impl( const value_compare &cmp = value_compare()
|
||||
, const priority_compare &pcmp = priority_compare()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
: tree_(cmp, pcmp, v_traits)
|
||||
|
@@ -122,7 +122,7 @@ class unordered_set_impl
|
||||
//!
|
||||
//! <b>Notes</b>: buckets array must be disposed only after
|
||||
//! *this is disposed.
|
||||
unordered_set_impl( const bucket_traits &b_traits
|
||||
explicit unordered_set_impl( const bucket_traits &b_traits
|
||||
, const hasher & hash_func = hasher()
|
||||
, const key_equal &equal_func = key_equal()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
@@ -1193,7 +1193,7 @@ class unordered_multiset_impl
|
||||
//!
|
||||
//! <b>Notes</b>: buckets array must be disposed only after
|
||||
//! *this is disposed.
|
||||
unordered_multiset_impl ( const bucket_traits &b_traits
|
||||
explicit unordered_multiset_impl ( const bucket_traits &b_traits
|
||||
, const hasher & hash_func = hasher()
|
||||
, const key_equal &equal_func = key_equal()
|
||||
, const value_traits &v_traits = value_traits())
|
||||
|
@@ -145,11 +145,13 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_erase_burst(
|
||||
TEST_INTRUSIVE_SEQUENCE_EXPECTED(testset, testset.begin());
|
||||
|
||||
//Ordered erasure
|
||||
{
|
||||
iterator it(testset.begin()), itend(testset.end());
|
||||
for(int i = 0; it != itend; ++i){
|
||||
BOOST_TEST(&*it == &values[i]);
|
||||
it = testset.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_TEST(testset.empty());
|
||||
|
||||
|
@@ -233,7 +233,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(std::vector
|
||||
cmp_val_lower.value_ = 1;
|
||||
cmp_val_upper.value_ = 2;
|
||||
//left-closed, right-closed
|
||||
std::pair<iterator,iterator> range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, true);
|
||||
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, true);
|
||||
BOOST_TEST (range.first->value_ == 1);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (std::distance (range.first, range.second) == 3);
|
||||
|
@@ -305,7 +305,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(std::vector<type
|
||||
cmp_val_lower.value_ = 1;
|
||||
cmp_val_upper.value_ = 2;
|
||||
//left-closed, right-closed
|
||||
std::pair<iterator,iterator> range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, true);
|
||||
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, true);
|
||||
BOOST_TEST (range.first->value_ == 1);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (std::distance (range.first, range.second) == 2);
|
||||
|
@@ -20,7 +20,7 @@ class CompleteSmartPtr
|
||||
|
||||
public:
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_ALIASES)
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
template <class U> using rebind = CompleteSmartPtr<U>;
|
||||
#else
|
||||
template <class U> struct rebind
|
||||
|
@@ -53,8 +53,8 @@ struct stateful_value_traits
|
||||
|
||||
static const link_mode_type link_mode = normal_link;
|
||||
|
||||
stateful_value_traits(pointer values, node_ptr node_array)
|
||||
: values_(values), node_array_(node_array)
|
||||
stateful_value_traits(pointer vals, node_ptr node_array)
|
||||
: values_(vals), node_array_(node_array)
|
||||
{}
|
||||
|
||||
node_ptr to_node_ptr (value_type &value)
|
||||
|
@@ -111,9 +111,9 @@ void test_sequence_container(Container & c, Data & d)
|
||||
BOOST_TEST( !c.empty() );
|
||||
|
||||
{
|
||||
typename Data::iterator i = d.begin();
|
||||
++++i;
|
||||
c.insert( c.begin(), *(i) );
|
||||
typename Data::iterator di = d.begin();
|
||||
++++di;
|
||||
c.insert( c.begin(), *(di) );
|
||||
}
|
||||
|
||||
i = c.erase( c.begin(), c.end() );
|
||||
@@ -361,12 +361,16 @@ void test_unordered_associative_container_invariants(Container & c, Data & d, bo
|
||||
std::pair<const_iterator, const_iterator> er = c.equal_range(*di);
|
||||
size_type cnt = std::distance(er.first, er.second);
|
||||
BOOST_TEST( cnt == c.count(*di));
|
||||
if(cnt > 1)
|
||||
for(const_iterator n = er.first, i = n++, e = er.second; n != e; ++i, ++n){
|
||||
if(cnt > 1){
|
||||
const_iterator n = er.first;
|
||||
i = n++;
|
||||
const_iterator e = er.second;
|
||||
for(; n != e; ++i, ++n){
|
||||
BOOST_TEST( c.key_eq()(*i, *n) );
|
||||
BOOST_TEST( c.hash_function()(*i) == c.hash_function()(*n) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_type blen = c.bucket_count();
|
||||
size_type total_objects = 0;
|
||||
|
@@ -212,6 +212,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
|
||||
> unordered_multiset_type;
|
||||
typedef typename unordered_multiset_type::bucket_traits bucket_traits;
|
||||
typedef typename unordered_multiset_type::iterator iterator;
|
||||
{
|
||||
typename unordered_multiset_type::bucket_type buckets [BucketSize];
|
||||
unordered_multiset_type testset(bucket_traits(
|
||||
pointer_traits<typename unordered_multiset_type::bucket_ptr>::
|
||||
@@ -326,6 +327,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
|
||||
BOOST_TEST (testset_new.size() == (max -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
typename unordered_multiset_type::bucket_type buckets [BucketSize];
|
||||
const unsigned int NumBucketSize = BucketSize;
|
||||
|
Reference in New Issue
Block a user