mirror of
https://github.com/boostorg/intrusive.git
synced 2025-08-02 22:14:35 +02:00
Avoid including <iterator>, use intrusive's own version to avoid ADL clashes and minimize some dependencies.
This commit is contained in:
@@ -85,8 +85,8 @@ struct bstbase3
|
||||
typedef typename node_traits::const_node_ptr const_node_ptr;
|
||||
typedef tree_iterator<value_traits, false> iterator;
|
||||
typedef tree_iterator<value_traits, true> const_iterator;
|
||||
typedef boost::intrusive::detail::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef boost::intrusive::detail::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef boost::intrusive::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef boost::intrusive::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(typename value_traits::pointer) pointer;
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(typename value_traits::const_pointer) const_pointer;
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(typename pointer_traits<pointer>::element_type) value_type;
|
||||
@@ -619,8 +619,8 @@ class bstree_impl
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(value_compare) key_compare;
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(iterator_type) iterator;
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(const_iterator_type) const_iterator;
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(boost::intrusive::detail::reverse_iterator<iterator>) reverse_iterator;
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(boost::intrusive::detail::reverse_iterator<const_iterator>) const_reverse_iterator;
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(boost::intrusive::reverse_iterator<iterator>) reverse_iterator;
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(boost::intrusive::reverse_iterator<const_iterator>) const_reverse_iterator;
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(typename value_traits::node_traits) node_traits;
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(typename node_traits::node) node;
|
||||
typedef BOOST_INTRUSIVE_IMPDEF(typename node_traits::node_ptr) node_ptr;
|
||||
|
@@ -17,67 +17,24 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/detail/iterator.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/is_stateful_value_traits.hpp>
|
||||
#include <boost/intrusive/detail/std_fwd.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
template<class Category, class T, class Distance, class Pointer, class Reference>
|
||||
struct iterator
|
||||
{
|
||||
typedef Category iterator_category;
|
||||
typedef T value_type;
|
||||
typedef Distance difference_type;
|
||||
typedef Pointer pointer;
|
||||
typedef Reference reference;
|
||||
};
|
||||
|
||||
template<class Iterator>
|
||||
struct iterator_traits
|
||||
{
|
||||
typedef typename Iterator::difference_type difference_type;
|
||||
typedef typename Iterator::value_type value_type;
|
||||
typedef typename Iterator::pointer pointer;
|
||||
typedef typename Iterator::reference reference;
|
||||
typedef typename Iterator::iterator_category iterator_category;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iterator_traits<T*>
|
||||
{
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iterator_traits<const T*>
|
||||
{
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef const T* pointer;
|
||||
typedef const T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
template<class ValueTraits>
|
||||
struct value_traits_pointers
|
||||
{
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
|
||||
(boost::intrusive::detail::
|
||||
, ValueTraits, value_traits_ptr
|
||||
, typename pointer_traits<typename ValueTraits::node_traits::node_ptr>::template
|
||||
, typename boost::intrusive::pointer_traits<typename ValueTraits::node_traits::node_ptr>::template
|
||||
rebind_pointer<ValueTraits>::type) value_traits_ptr;
|
||||
|
||||
typedef typename pointer_traits<value_traits_ptr>::template
|
||||
typedef typename boost::intrusive::pointer_traits<value_traits_ptr>::template
|
||||
rebind_pointer<ValueTraits const>::type const_value_traits_ptr;
|
||||
};
|
||||
|
||||
@@ -154,73 +111,6 @@ struct iiterator_members<NodePtr, StoredPointer, false>
|
||||
NodePtr nodeptr_;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class InputIt, class Distance> inline
|
||||
void advance_impl(InputIt& it, Distance n, const std::input_iterator_tag&)
|
||||
{
|
||||
while(n--)
|
||||
++it;
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance> inline
|
||||
void advance_impl(InputIt& it, Distance n, std::forward_iterator_tag &)
|
||||
{
|
||||
while(n--)
|
||||
++it;
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance> inline
|
||||
void advance_impl(InputIt& it, Distance n, std::bidirectional_iterator_tag &)
|
||||
{
|
||||
for (; 0 < n; --n)
|
||||
++it;
|
||||
for (; n < 0; ++n)
|
||||
--it;
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance>
|
||||
inline void advance_impl(InputIt& it, Distance n, const std::random_access_iterator_tag &)
|
||||
{
|
||||
it += n;
|
||||
}
|
||||
|
||||
} //namespace detail
|
||||
|
||||
template<class InputIt, class Distance>
|
||||
inline void iterator_advance(InputIt& it, Distance n)
|
||||
{ // increment iterator by offset, arbitrary iterators
|
||||
boost::intrusive::detail::advance_impl(it, n, boost::intrusive::iterator_traits<InputIt>::iterator_category());
|
||||
}
|
||||
|
||||
namespace detail{
|
||||
|
||||
template<class InputIt, class Distance, class Category>
|
||||
inline void distance_impl(InputIt first, InputIt last, Distance& off, const Category &)
|
||||
{
|
||||
while(first != last){
|
||||
++off;
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance> inline
|
||||
void distance_impl(InputIt first, InputIt last, Distance& off, const std::random_access_iterator_tag&)
|
||||
{
|
||||
off += last - first;
|
||||
}
|
||||
|
||||
} //namespace detail
|
||||
|
||||
template<class InputIt> inline
|
||||
typename iterator_traits<InputIt>::difference_type iterator_distance(InputIt first, InputIt last)
|
||||
{
|
||||
typename iterator_traits<InputIt>::difference_type off = 0;
|
||||
boost::intrusive::detail::distance_impl(first, last, off, boost::intrusive::iterator_traits<InputIt>::iterator_category());
|
||||
return off;
|
||||
}
|
||||
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
|
131
include/boost/intrusive/detail/iterator.hpp
Normal file
131
include/boost/intrusive/detail/iterator.hpp
Normal file
@@ -0,0 +1,131 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-2014
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_ITERATOR_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_ITERATOR_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/intrusive/detail/std_fwd.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
template<class Category, class T, class Distance, class Pointer = T*, class Reference = T&>
|
||||
struct iterator
|
||||
{
|
||||
typedef Category iterator_category;
|
||||
typedef T value_type;
|
||||
typedef Distance difference_type;
|
||||
typedef Pointer pointer;
|
||||
typedef Reference reference;
|
||||
};
|
||||
|
||||
template<class Iterator>
|
||||
struct iterator_traits
|
||||
{
|
||||
typedef typename Iterator::difference_type difference_type;
|
||||
typedef typename Iterator::value_type value_type;
|
||||
typedef typename Iterator::pointer pointer;
|
||||
typedef typename Iterator::reference reference;
|
||||
typedef typename Iterator::iterator_category iterator_category;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iterator_traits<T*>
|
||||
{
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iterator_traits<const T*>
|
||||
{
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef const T* pointer;
|
||||
typedef const T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class InputIt, class Distance> inline
|
||||
void advance_impl(InputIt& it, Distance n, const std::input_iterator_tag&)
|
||||
{
|
||||
while(n--)
|
||||
++it;
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance> inline
|
||||
void advance_impl(InputIt& it, Distance n, std::forward_iterator_tag &)
|
||||
{
|
||||
while(n--)
|
||||
++it;
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance> inline
|
||||
void advance_impl(InputIt& it, Distance n, std::bidirectional_iterator_tag &)
|
||||
{
|
||||
for (; 0 < n; --n)
|
||||
++it;
|
||||
for (; n < 0; ++n)
|
||||
--it;
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance>
|
||||
inline void advance_impl(InputIt& it, Distance n, const std::random_access_iterator_tag &)
|
||||
{
|
||||
it += n;
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance, class Category>
|
||||
inline void distance_impl(InputIt first, InputIt last, Distance& off, const Category &)
|
||||
{
|
||||
while(first != last){
|
||||
++off;
|
||||
++first;
|
||||
}
|
||||
}
|
||||
|
||||
template<class InputIt, class Distance> inline
|
||||
void distance_impl(InputIt first, InputIt last, Distance& off, const std::random_access_iterator_tag&)
|
||||
{
|
||||
off += last - first;
|
||||
}
|
||||
|
||||
} //namespace detail
|
||||
|
||||
template<class InputIt, class Distance>
|
||||
inline void iterator_advance(InputIt& it, Distance n)
|
||||
{ // increment iterator by offset, arbitrary iterators
|
||||
boost::intrusive::detail::advance_impl(it, n, typename boost::intrusive::iterator_traits<InputIt>::iterator_category());
|
||||
}
|
||||
|
||||
template<class InputIt> inline
|
||||
typename iterator_traits<InputIt>::difference_type iterator_distance(InputIt first, InputIt last)
|
||||
{
|
||||
typename iterator_traits<InputIt>::difference_type off = 0;
|
||||
boost::intrusive::detail::distance_impl(first, last, off, typename boost::intrusive::iterator_traits<InputIt>::iterator_category());
|
||||
return off;
|
||||
}
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_ITERATOR_HPP
|
@@ -10,19 +10,18 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_ITERATOR_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_ITERATOR_HPP
|
||||
#ifndef BOOST_INTRUSIVE_DETAIL_REVERSE_ITERATOR_HPP
|
||||
#define BOOST_INTRUSIVE_DETAIL_REVERSE_ITERATOR_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/iiterator.hpp>
|
||||
#include <boost/intrusive/detail/iterator.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
template<class It>
|
||||
class reverse_iterator
|
||||
@@ -130,10 +129,9 @@ class reverse_iterator
|
||||
It m_current; // the wrapped iterator
|
||||
};
|
||||
|
||||
} //namespace detail
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
} //namespace intrusive {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_ITERATOR_HPP
|
||||
#endif //BOOST_INTRUSIVE_DETAIL_REVERSE_ITERATOR_HPP
|
||||
|
@@ -1660,7 +1660,7 @@ class hashtable_impl
|
||||
//!
|
||||
//! <b>Effects</b>: Equivalent to this->insert_equal(t) for each element in [b, e).
|
||||
//!
|
||||
//! <b>Complexity</b>: Average case O(N), where N is std::distance(b, e).
|
||||
//! <b>Complexity</b>: Average case O(N), where N is distance(b, e).
|
||||
//! Worst case O(N*this->size()).
|
||||
//!
|
||||
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee.
|
||||
@@ -1706,7 +1706,7 @@ class hashtable_impl
|
||||
//!
|
||||
//! <b>Effects</b>: Equivalent to this->insert_unique(t) for each element in [b, e).
|
||||
//!
|
||||
//! <b>Complexity</b>: Average case O(N), where N is std::distance(b, e).
|
||||
//! <b>Complexity</b>: Average case O(N), where N is distance(b, e).
|
||||
//! Worst case O(N*this->size()).
|
||||
//!
|
||||
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee.
|
||||
@@ -1819,7 +1819,7 @@ class hashtable_impl
|
||||
|
||||
//! <b>Effects</b>: Erases the range pointed to by b end e.
|
||||
//!
|
||||
//! <b>Complexity</b>: Average case O(std::distance(b, e)),
|
||||
//! <b>Complexity</b>: Average case O(distance(b, e)),
|
||||
//! worst case O(this->size()).
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
@@ -1896,7 +1896,7 @@ class hashtable_impl
|
||||
//! <b>Effects</b>: Erases the range pointed to by b end e.
|
||||
//! Disposer::operator()(pointer) is called for the removed elements.
|
||||
//!
|
||||
//! <b>Complexity</b>: Average case O(std::distance(b, e)),
|
||||
//! <b>Complexity</b>: Average case O(distance(b, e)),
|
||||
//! worst case O(this->size()).
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
|
@@ -97,8 +97,8 @@ class list_impl
|
||||
typedef SizeType size_type;
|
||||
typedef list_iterator<value_traits, false> iterator;
|
||||
typedef list_iterator<value_traits, true> const_iterator;
|
||||
typedef boost::intrusive::detail::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef boost::intrusive::detail::reverse_iterator<const_iterator>const_reverse_iterator;
|
||||
typedef boost::intrusive::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef boost::intrusive::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef typename value_traits::node_traits node_traits;
|
||||
typedef typename node_traits::node node;
|
||||
typedef typename node_traits::node_ptr node_ptr;
|
||||
@@ -187,7 +187,7 @@ class list_impl
|
||||
//!
|
||||
//! <b>Effects</b>: Constructs a list equal to the range [first,last).
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear in std::distance(b, e). No copy constructors are called.
|
||||
//! <b>Complexity</b>: Linear in distance(b, e). No copy constructors are called.
|
||||
//!
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks).
|
||||
@@ -604,7 +604,7 @@ class list_impl
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: b and e must be valid iterators to elements in *this.
|
||||
//! n must be std::distance(b, e).
|
||||
//! n must be distance(b, e).
|
||||
//!
|
||||
//! <b>Effects</b>: Erases the element range pointed by b and e
|
||||
//! No destructors are called.
|
||||
@@ -915,12 +915,12 @@ class list_impl
|
||||
if(constant_time_size)
|
||||
this->splice(p, x, f, e, node_algorithms::distance(f.pointed_node(), e.pointed_node()));
|
||||
else
|
||||
this->splice(p, x, f, e, 1);//distance is a dummy value
|
||||
this->splice(p, x, f, e, 1);//intrusive::iterator_distance is a dummy value
|
||||
}
|
||||
|
||||
//! <b>Requires</b>: p must be a valid iterator of *this.
|
||||
//! f and e must point to elements contained in list x.
|
||||
//! n == std::distance(f, e)
|
||||
//! n == distance(f, e)
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range pointed by f and e from list x to this list,
|
||||
//! before the element pointed by p. No destructors or copy constructors are called.
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include <boost/intrusive/detail/default_header_holder.hpp>
|
||||
#include <boost/intrusive/detail/uncast.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/iterator.hpp>
|
||||
#include <boost/intrusive/detail/slist_iterator.hpp>
|
||||
#include <boost/intrusive/detail/array_initializer.hpp>
|
||||
#include <boost/intrusive/detail/exception_disposer.hpp>
|
||||
@@ -314,7 +315,7 @@ class slist_impl
|
||||
//!
|
||||
//! <b>Effects</b>: Constructs a list equal to [b ,e).
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear in std::distance(b, e). No copy constructors are called.
|
||||
//! <b>Complexity</b>: Linear in distance(b, e). No copy constructors are called.
|
||||
//!
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks).
|
||||
@@ -908,7 +909,7 @@ class slist_impl
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Erases the range (before_f, l) from
|
||||
//! the list. n must be std::distance(before_f, l) - 1.
|
||||
//! the list. n must be distance(before_f, l) - 1.
|
||||
//! No destructors are called.
|
||||
//!
|
||||
//! <b>Returns</b>: the first element remaining beyond the removed elements,
|
||||
@@ -976,7 +977,7 @@ class slist_impl
|
||||
{ return this->erase_after(this->previous(f), l); }
|
||||
|
||||
//! <b>Effects</b>: Erases the range [f, l) from
|
||||
//! the list. n must be std::distance(f, l).
|
||||
//! the list. n must be distance(f, l).
|
||||
//! No destructors are called.
|
||||
//!
|
||||
//! <b>Returns</b>: the first element remaining beyond the removed elements,
|
||||
@@ -1266,7 +1267,7 @@ class slist_impl
|
||||
//! <b>Requires</b>: prev_pos must be a dereferenceable iterator in *this or be
|
||||
//! 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).
|
||||
//! n == distance(before_f, before_l).
|
||||
//!
|
||||
//! <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.
|
||||
@@ -1351,7 +1352,7 @@ class slist_impl
|
||||
|
||||
//! <b>Requires</b>: pos must be a dereferenceable iterator in *this
|
||||
//! and f and l belong to x and f and l a valid range on x.
|
||||
//! n == std::distance(f, l).
|
||||
//! n == distance(f, l).
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range [f, l) from list x to this
|
||||
//! list, before the element pointed by pos.
|
||||
@@ -1829,7 +1830,7 @@ class slist_impl
|
||||
|
||||
//! <b>Requires</b>: prev_pos must be a dereferenceable iterator in *this or be
|
||||
//! before_begin(), and f and before_l belong to another slist.
|
||||
//! n == std::distance(f, before_l) + 1.
|
||||
//! n == distance(f, before_l) + 1.
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range [f, before_l] to this
|
||||
//! list, after the element pointed by prev_pos.
|
||||
@@ -1848,7 +1849,7 @@ class slist_impl
|
||||
if(n){
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT(n > 0);
|
||||
BOOST_INTRUSIVE_INVARIANT_ASSERT
|
||||
(size_type(std::distance
|
||||
(size_type(boost::intrusive::iterator_distance
|
||||
( iterator(f, this->priv_value_traits_ptr())
|
||||
, iterator(before_l, this->priv_value_traits_ptr())))
|
||||
+1 == n);
|
||||
|
@@ -101,7 +101,7 @@ class treap_set_impl
|
||||
//! [b, e).
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
|
||||
//! comp and otherwise N * log N, where N is std::distance(last, first).
|
||||
//! comp and otherwise N * log N, where N is distance(last, first).
|
||||
//!
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
@@ -602,7 +602,7 @@ class treap_multiset_impl
|
||||
//! [b, e).
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear in N if [b, e) is already sorted using
|
||||
//! comp and otherwise N * log N, where N is std::distance(last, first).
|
||||
//! comp and otherwise N * log N, where N is distance(last, first).
|
||||
//!
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
|
||||
|
@@ -134,7 +134,7 @@ class unordered_set_impl
|
||||
//! <b>Effects</b>: Constructs an empty unordered_set and inserts elements from
|
||||
//! [b, e).
|
||||
//!
|
||||
//! <b>Complexity</b>: If N is std::distance(b, e): Average case is O(N)
|
||||
//! <b>Complexity</b>: If N is distance(b, e): Average case is O(N)
|
||||
//! (with a good hash function and with buckets_len >= N),worst case O(N2).
|
||||
//!
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
@@ -325,7 +325,7 @@ class unordered_set_impl
|
||||
//!
|
||||
//! <b>Effects</b>: Equivalent to this->insert(t) for each element in [b, e).
|
||||
//!
|
||||
//! <b>Complexity</b>: Average case O(N), where N is std::distance(b, e).
|
||||
//! <b>Complexity</b>: Average case O(N), where N is distance(b, e).
|
||||
//! Worst case O(N*this->size()).
|
||||
//!
|
||||
//! <b>Throws</b>: If the internal hasher or the equality functor throws. Basic guarantee.
|
||||
@@ -413,7 +413,7 @@ class unordered_set_impl
|
||||
|
||||
//! <b>Effects</b>: Erases the range pointed to by b end e.
|
||||
//!
|
||||
//! <b>Complexity</b>: Average case O(std::distance(b, e)),
|
||||
//! <b>Complexity</b>: Average case O(distance(b, e)),
|
||||
//! worst case O(this->size()).
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
@@ -485,7 +485,7 @@ class unordered_set_impl
|
||||
//! <b>Effects</b>: Erases the range pointed to by b end e.
|
||||
//! Disposer::operator()(pointer) is called for the removed elements.
|
||||
//!
|
||||
//! <b>Complexity</b>: Average case O(std::distance(b, e)),
|
||||
//! <b>Complexity</b>: Average case O(distance(b, e)),
|
||||
//! worst case O(this->size()).
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
@@ -1227,7 +1227,7 @@ class unordered_multiset_impl
|
||||
//! <b>Effects</b>: Constructs an empty unordered_multiset and inserts elements from
|
||||
//! [b, e).
|
||||
//!
|
||||
//! <b>Complexity</b>: If N is std::distance(b, e): Average case is O(N)
|
||||
//! <b>Complexity</b>: If N is distance(b, e): Average case is O(N)
|
||||
//! (with a good hash function and with buckets_len >= N),worst case O(N2).
|
||||
//!
|
||||
//! <b>Throws</b>: If value_traits::node_traits::node
|
||||
@@ -1442,7 +1442,7 @@ class unordered_multiset_impl
|
||||
|
||||
//! <b>Effects</b>: Erases the range pointed to by b end e.
|
||||
//!
|
||||
//! <b>Complexity</b>: Average case O(std::distance(b, e)),
|
||||
//! <b>Complexity</b>: Average case O(distance(b, e)),
|
||||
//! worst case O(this->size()).
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
@@ -1521,7 +1521,7 @@ class unordered_multiset_impl
|
||||
//! <b>Effects</b>: Erases the range pointed to by b end e.
|
||||
//! Disposer::operator()(pointer) is called for the removed elements.
|
||||
//!
|
||||
//! <b>Complexity</b>: Average case O(std::distance(b, e)),
|
||||
//! <b>Complexity</b>: Average case O(distance(b, e)),
|
||||
//! worst case O(this->size()).
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
|
@@ -292,6 +292,9 @@
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\is_stateful_value_traits.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\iterator.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\..\boost\intrusive\detail\key_nodeptr_comp.hpp">
|
||||
</File>
|
||||
|
@@ -13,7 +13,7 @@
|
||||
#ifndef BOOST_INTRUSIVE_TEST_COMMON_FUNCTORS_HPP
|
||||
#define BOOST_INTRUSIVE_TEST_COMMON_FUNCTORS_HPP
|
||||
|
||||
#include<boost/intrusive/detail/iiterator.hpp>
|
||||
#include<boost/intrusive/detail/iterator.hpp>
|
||||
#include<boost/intrusive/detail/mpl.hpp>
|
||||
#include<boost/static_assert.hpp>
|
||||
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "common_functors.hpp"
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/detail/iterator.hpp>
|
||||
#include "test_macros.hpp"
|
||||
#include "test_container.hpp"
|
||||
#include "generic_assoc_test.hpp"
|
||||
@@ -226,7 +227,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
|
||||
|
||||
BOOST_TEST (range.first->value_ == 2);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (std::distance (range.first, range.second) == 2);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 2);
|
||||
|
||||
(&cmp_val)->value_ = 7;
|
||||
BOOST_TEST (testset.find (cmp_val) == testset.end());
|
||||
@@ -246,7 +247,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
|
||||
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);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 3);
|
||||
}
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
@@ -254,14 +255,14 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
|
||||
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
|
||||
BOOST_TEST (const_range.first->value_ == 1);
|
||||
BOOST_TEST (const_range.second->value_ == 2);
|
||||
BOOST_TEST (std::distance (const_range.first, const_range.second) == 1);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
|
||||
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
(&cmp_val_upper)->value_ = 3;
|
||||
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
|
||||
BOOST_TEST (range.first->value_ == 1);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (std::distance (range.first, range.second) == 3);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 3);
|
||||
}
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
@@ -269,7 +270,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
|
||||
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, false, true);
|
||||
BOOST_TEST (const_range.first->value_ == 2);
|
||||
BOOST_TEST (const_range.second->value_ == 3);
|
||||
BOOST_TEST (std::distance (const_range.first, const_range.second) == 2);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 2);
|
||||
}
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
@@ -277,7 +278,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
|
||||
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, false, false);
|
||||
BOOST_TEST (range.first->value_ == 2);
|
||||
BOOST_TEST (range.second->value_ == 2);
|
||||
BOOST_TEST (std::distance (range.first, range.second) == 0);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 0);
|
||||
}
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 5;
|
||||
@@ -285,7 +286,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(value_cont_
|
||||
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
|
||||
BOOST_TEST (const_range.first->value_ == 5);
|
||||
BOOST_TEST (const_range.second == const_testset.end());
|
||||
BOOST_TEST (std::distance (const_range.first, const_range.second) == 1);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "common_functors.hpp"
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/intrusive/options.hpp>
|
||||
#include <boost/intrusive/detail/iterator.hpp>
|
||||
#include "test_macros.hpp"
|
||||
#include "test_container.hpp"
|
||||
#include "generic_assoc_test.hpp"
|
||||
@@ -292,7 +293,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
|
||||
|
||||
BOOST_TEST (range.first->value_ == 2);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (std::distance (range.first, range.second) == 1);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 1);
|
||||
|
||||
(&cmp_val)->value_ = 7;
|
||||
BOOST_TEST (testset.find (cmp_val) == testset.end());
|
||||
@@ -314,7 +315,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
|
||||
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);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 2);
|
||||
}
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
@@ -322,14 +323,14 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
|
||||
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
|
||||
BOOST_TEST (const_range.first->value_ == 1);
|
||||
BOOST_TEST (const_range.second->value_ == 2);
|
||||
BOOST_TEST (std::distance (const_range.first, const_range.second) == 1);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
|
||||
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
(&cmp_val_upper)->value_ = 3;
|
||||
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
|
||||
BOOST_TEST (range.first->value_ == 1);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (std::distance (range.first, range.second) == 2);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 2);
|
||||
}
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
@@ -337,7 +338,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
|
||||
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, false, true);
|
||||
BOOST_TEST (const_range.first->value_ == 2);
|
||||
BOOST_TEST (const_range.second->value_ == 3);
|
||||
BOOST_TEST (std::distance (const_range.first, const_range.second) == 1);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
|
||||
}
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 1;
|
||||
@@ -345,7 +346,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
|
||||
range = testset.bounded_range (cmp_val_lower, cmp_val_upper, false, false);
|
||||
BOOST_TEST (range.first->value_ == 2);
|
||||
BOOST_TEST (range.second->value_ == 2);
|
||||
BOOST_TEST (std::distance (range.first, range.second) == 0);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 0);
|
||||
}
|
||||
{
|
||||
(&cmp_val_lower)->value_ = 5;
|
||||
@@ -353,7 +354,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(value_cont_type&
|
||||
const_range = const_testset.bounded_range (cmp_val_lower, cmp_val_upper, true, false);
|
||||
BOOST_TEST (const_range.first->value_ == 5);
|
||||
BOOST_TEST (const_range.second == const_testset.end());
|
||||
BOOST_TEST (std::distance (const_range.first, const_range.second) == 1);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (const_range.first, const_range.second) == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,3 @@
|
||||
/*
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Olaf Krzikalla 2004-2006.
|
||||
@@ -541,11 +540,3 @@ int main()
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
*/
|
||||
|
||||
#include <boost/intrusive/list_hook.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
@@ -16,6 +16,7 @@
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/simple_disposers.hpp>
|
||||
#include <boost/intrusive/detail/iterator.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
namespace boost {
|
||||
@@ -386,14 +387,14 @@ void test_unordered_associative_container_invariants(Container & c, Data & d)
|
||||
di != de ; ++di ){
|
||||
const_iterator i = c.find(*di);
|
||||
size_type nb = c.bucket(*i);
|
||||
size_type bucket_elem = std::distance(c.begin(nb), c.end(nb));
|
||||
size_type bucket_elem = boost::intrusive::iterator_distance(c.begin(nb), c.end(nb));
|
||||
BOOST_TEST( bucket_elem == c.bucket_size(nb) );
|
||||
BOOST_TEST( &*c.local_iterator_to(*c.find(*di)) == &*i );
|
||||
BOOST_TEST( &*c.local_iterator_to(*const_cast<const Container &>(c).find(*di)) == &*i );
|
||||
BOOST_TEST( &*Container::s_local_iterator_to(*c.find(*di)) == &*i );
|
||||
BOOST_TEST( &*Container::s_local_iterator_to(*const_cast<const Container &>(c).find(*di)) == &*i );
|
||||
std::pair<const_iterator, const_iterator> er = c.equal_range(*di);
|
||||
size_type cnt = std::distance(er.first, er.second);
|
||||
size_type cnt = boost::intrusive::iterator_distance(er.first, er.second);
|
||||
BOOST_TEST( cnt == c.count(*di));
|
||||
if(cnt > 1){
|
||||
const_iterator n = er.first;
|
||||
|
@@ -12,6 +12,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/intrusive/unordered_set.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/iterator.hpp>
|
||||
#include "itestvalue.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "common_functors.hpp"
|
||||
@@ -19,6 +20,7 @@
|
||||
#include <algorithm> //std::sort std::find
|
||||
#include <set>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
#include "test_macros.hpp"
|
||||
#include "test_container.hpp"
|
||||
|
||||
@@ -367,7 +369,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
|
||||
}
|
||||
|
||||
//Erase the same values in both the intrusive and original vector
|
||||
std::size_t erased_cnt = std::distance(it_beg_pos, it_end_pos);
|
||||
std::size_t erased_cnt = boost::intrusive::iterator_distance(it_beg_pos, it_end_pos);
|
||||
|
||||
//Erase values from the intrusive container
|
||||
testset.erase(it_beg_pos, it_end_pos);
|
||||
@@ -671,7 +673,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>:
|
||||
|
||||
BOOST_TEST (range.first->value_ == 2);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (std::distance (range.first, range.second) == 2);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 2);
|
||||
|
||||
cmp_val.value_ = 7;
|
||||
BOOST_TEST (testset.find (cmp_val) == testset.end());
|
||||
|
@@ -12,6 +12,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/intrusive/unordered_set.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/detail/iterator.hpp>
|
||||
#include "itestvalue.hpp"
|
||||
#include "smart_ptr.hpp"
|
||||
#include "common_functors.hpp"
|
||||
@@ -180,7 +181,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
|
||||
unordered_set_type testset1(values.begin(), values.end(), bucket_traits(
|
||||
pointer_traits<typename unordered_set_type::bucket_ptr>::
|
||||
pointer_to(buckets[0]), BucketSize));
|
||||
BOOST_TEST (5 == std::distance(testset1.begin(), testset1.end()));
|
||||
BOOST_TEST (5 == boost::intrusive::iterator_distance(testset1.begin(), testset1.end()));
|
||||
|
||||
if(Incremental){
|
||||
{ int init_values [] = { 4, 5, 1, 2, 3 };
|
||||
@@ -525,7 +526,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
|
||||
|
||||
BOOST_TEST (range.first->value_ == 2);
|
||||
BOOST_TEST (range.second->value_ == 3);
|
||||
BOOST_TEST (std::distance (range.first, range.second) == 1);
|
||||
BOOST_TEST (boost::intrusive::iterator_distance (range.first, range.second) == 1);
|
||||
|
||||
cmp_val.value_ = 7;
|
||||
BOOST_TEST (testset.find (cmp_val) == testset.end());
|
||||
|
Reference in New Issue
Block a user