Update of /cvsroot/boost/boost/boost/intrusive
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23445
Modified Files:
hashtable.hpp list.hpp list_hook.hpp rbtree.hpp
rbtree_algorithms.hpp set.hpp set_hook.hpp slist.hpp
slist_hook.hpp unordered_set.hpp unordered_set_hook.hpp
Added Files:
derivation_value_traits.hpp member_value_traits.hpp
trivial_value_traits.hpp
Log Message:
New Interprocess version
--- NEW FILE: derivation_value_traits.hpp ---
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2006-2007
//
// 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_DERIVATION_VALUE_TRAITS_HPP
#define BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP
#include <boost/intrusive/linking_policy.hpp>
#include <iterator>
namespace boost {
namespace intrusive {
//!This value traits template is used to create value traits
//!from user defined node traits where value_traits::value_type will
//!derive from node_traits::node
template<class T, class NodeTraits, linking_policy Policy>
struct derivation_value_traits
{
public:
typedef NodeTraits
node_traits;
typedef T value_type;
typedef typename node_traits::node node;
typedef typename node_traits::node_ptr node_ptr;
typedef typename node_traits::const_node_ptr
const_node_ptr;
typedef typename boost::pointer_to_other<node_ptr, T>::type pointer;
typedef typename boost::pointer_to_other<node_ptr, const T>::type
const_pointer;
typedef typename std::iterator_traits<pointer>::reference reference;
typedef typename std::iterator_traits<const_pointer>::reference
const_reference;
enum { linking_policy = Policy };
static node_ptr to_node_ptr(reference value)
{ return node_ptr(&value); }
static const_node_ptr to_node_ptr(const_reference value)
{ return node_ptr(&value); }
static pointer to_value_ptr(node_ptr n)
{ return pointer(static_cast<T*>(detail::get_pointer(n))); }
static const_pointer to_value_ptr(const_node_ptr n)
{ return const_pointer(static_cast<T*>(detail::get_pointer(n))); }
};
} //namespace intrusive
} //namespace boost
#endif //BOOST_INTRUSIVE_DERIVATION_VALUE_TRAITS_HPP
--- NEW FILE: member_value_traits.hpp ---
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2006-2007
//
// 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_MEMBER_VALUE_TRAITS_HPP
#define BOOST_INTRUSIVE_MEMBER_VALUE_TRAITS_HPP
#include <boost/intrusive/linking_policy.hpp>
#include <iterator>
#include <boost/intrusive/detail/parent_from_member.hpp>
namespace boost {
namespace intrusive {
//!This value traits template is used to create value traits
//!from user defined node traits where value_traits::value_type will
//!store a node_traits::node
template< class T, class NodeTraits
, typename NodeTraits::node T::* PtrToMember
, linking_policy Policy>
struct member_value_traits
{
public:
typedef NodeTraits
node_traits;
typedef T value_type;
typedef typename node_traits::node node;
typedef typename node_traits::node_ptr node_ptr;
typedef typename node_traits::const_node_ptr
const_node_ptr;
typedef typename boost::pointer_to_other<node_ptr, T>::type pointer;
typedef typename boost::pointer_to_other<node_ptr, const T>::type
const_pointer;
typedef typename std::iterator_traits<pointer>::reference reference;
typedef typename std::iterator_traits<const_pointer>::reference
const_reference;
enum { linking_policy = Policy };
static node_ptr to_node_ptr(reference value)
{ return node_ptr(&(value.*PtrToMember)); }
static const_node_ptr to_node_ptr(const_reference value)
{ return node_ptr(&(value.*PtrToMember)); }
static pointer to_value_ptr(node_ptr n)
{
return pointer(detail::parent_from_member<value_type, node>
(detail::get_pointer(n), PtrToMember));
}
static const_pointer to_value_ptr(const_node_ptr n)
{
return pointer(detail::parent_from_member<value_type, node>
(detail::get_pointer(n), PtrToMember));
}
};
} //namespace intrusive
} //namespace boost
#endif //BOOST_INTRUSIVE_MEMBER_VALUE_TRAITS_HPP
--- NEW FILE: trivial_value_traits.hpp ---
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2006-2007
//
// 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_TRIVIAL_VALUE_TRAITS_HPP
#define BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP
#include <boost/intrusive/linking_policy.hpp>
namespace boost {
namespace intrusive {
//!This value traits template is used to create value traits
//!from user defined node traits where value_traits::value_type and
//!node_traits::node should be equal
template<class NodeTraits, linking_policy LinkingPolicy = safe_link>
struct trivial_value_traits
{
typedef NodeTraits node_traits;
typedef typename node_traits::node_ptr node_ptr;
typedef typename node_traits::const_node_ptr const_node_ptr;
typedef typename node_traits::node value_type;
typedef node_ptr pointer;
typedef const_node_ptr const_pointer;
enum { linking_policy = LinkingPolicy };
static node_ptr to_node_ptr (value_type &value) { return
node_ptr(&value); }
static const_node_ptr to_node_ptr (const value_type &value) { return
const_node_ptr(&value); }
static pointer to_value_ptr(node_ptr n) { return
pointer(n); }
static const_pointer to_value_ptr(const_node_ptr n) { return
const_pointer(n); }
};
} //namespace intrusive
} //namespace boost
#endif //BOOST_INTRUSIVE_TRIVIAL_VALUE_TRAITS_HPP
Index: hashtable.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/hashtable.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- hashtable.hpp 23 Jun 2007 12:55:23 -0000 1.5
+++ hashtable.hpp 22 Jul 2007 14:08:33 -0000 1.6
@@ -22,6 +22,9 @@
#include <boost/intrusive/detail/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/functional/hash.hpp>
+#ifndef BOOST_INTRUSIVE_DISABLE_EXCEPTION_HANDLING
+#include <boost/detail/no_exceptions_support.hpp>
+#endif
//General intrusive utilities
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/detail/pointer_to_other.hpp>
@@ -179,6 +182,19 @@
public:
[...979 lines suppressed...]
- bucket_number = hash % b_len;
+ h = hasher(key);
+ bucket_number = h % b_len;
if(ConstantTimeSize && this->empty()){
return invalid_local_it(this->priv_bucket_info());
@@ -815,11 +1419,11 @@
, size_type &bucket_number_second
, size_type &count) const
{
- size_type hash;
+ size_type h;
count = 0;
//Let's see if the element is present
std::pair<local_iterator, local_iterator> to_return
- ( priv_find(key, hasher, equal, bucket_number_first, hash)
+ ( priv_find(key, hasher, equal, bucket_number_first, h)
, invalid_local_it(this->priv_bucket_info()));
if(to_return.first == to_return.second){
bucket_number_second = bucket_number_first;
Index: list.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/list.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- list.hpp 23 Jun 2007 12:55:23 -0000 1.4
+++ list.hpp 22 Jul 2007 14:08:33 -0000 1.5
@@ -22,6 +22,9 @@
#include <boost/intrusive/detail/pointer_to_other.hpp>
#include <boost/intrusive/linking_policy.hpp>
#include <boost/static_assert.hpp>
+#ifndef BOOST_INTRUSIVE_DISABLE_EXCEPTION_HANDLING
+#include <boost/detail/no_exceptions_support.hpp>
+#endif
#include <iterator>
#include <algorithm>
#include <functional>
@@ -46,10 +49,10 @@
>
class list
: private detail::size_holder<ConstantTimeSize, SizeType>
- , private ValueTraits::node_traits::node
{
/// @cond
private:
+ typename ValueTraits::node_traits::node root_;
typedef list<ValueTraits, ConstantTimeSize, SizeType> this_type;
typedef typename ValueTraits::node_traits node_traits;
typedef detail::size_holder<ConstantTimeSize, SizeType> size_traits;
@@ -99,10 +102,10 @@
}
node_ptr get_root_node()
- { return node_ptr(&static_cast<node&>(*this)); }
+ { return node_ptr(&root_); }
const_node_ptr get_root_node() const
- { return const_node_ptr(&static_cast<const node&>(*this)); }
+ { return const_node_ptr(&root_); }
/// @endcond
public:
@@ -164,7 +167,7 @@
{
node_ptr to_insert = ValueTraits::to_node_ptr(value);
if(safemode_or_autounlink)
-
BOOST_INTRUSIVE_SAFE_MODE_CONTAINER_INSERTION_ASSERT(node_algorithms::unique(to_insert));
+
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
node_algorithms::link_before(this->get_root_node(), to_insert);
size_traits::increment();
}
@@ -183,7 +186,7 @@
{
node_ptr to_insert = ValueTraits::to_node_ptr(value);
if(safemode_or_autounlink)
-
BOOST_INTRUSIVE_SAFE_MODE_CONTAINER_INSERTION_ASSERT(node_algorithms::unique(to_insert));
+
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
node_algorithms::link_before(node_traits::get_next(this->get_root_node()),
to_insert);
size_traits::increment();
}
@@ -409,7 +412,10 @@
//!
//! <b>Complexity</b>: Constant.
static list &container_from_end_iterator(iterator end_iterator)
- { return static_cast<list&>(*end_iterator.pointed_node()); }
+ {
+ return *detail::parent_from_member<list, node>
+ ( detail::get_pointer(end_iterator.pointed_node()), &list::root_);
+ }
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of list.
@@ -420,7 +426,10 @@
//!
//! <b>Complexity</b>: Constant.
static const list &container_from_end_iterator(const_iterator end_iterator)
- { return static_cast<const list&>(*end_iterator.pointed_node()); }
+ {
+ return *detail::parent_from_member<list, node>
+ ( detail::get_pointer(end_iterator.pointed_node()), &list::root_);
+ }
//! <b>Effects</b>: Returns the number of the elements contained in the
list.
//!
@@ -672,16 +681,21 @@
void clone_from(const list &src, Cloner cloner, Disposer disposer)
{
this->clear_and_dispose(disposer);
- try{
+ #ifndef BOOST_INTRUSIVE_DISABLE_EXCEPTION_HANDLING
+ BOOST_TRY{
+ #endif
const_iterator b(src.begin()), e(src.end());
for(; b != e; ++b){
this->push_back(*cloner(*b));
}
+ #ifndef BOOST_INTRUSIVE_DISABLE_EXCEPTION_HANDLING
}
- catch(...){
+ BOOST_CATCH(...){
clear_and_dispose(disposer);
- throw;
+ BOOST_RETHROW;
}
+ BOOST_CATCH_END
+ #endif
}
//! <b>Requires</b>: value must be an lvalue and p must be a valid iterator
of *this.
@@ -699,7 +713,7 @@
{
node_ptr to_insert = ValueTraits::to_node_ptr(value);
if(safemode_or_autounlink)
-
BOOST_INTRUSIVE_SAFE_MODE_CONTAINER_INSERTION_ASSERT(node_algorithms::unique(to_insert));
+
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
node_algorithms::link_before(p.pointed_node(), to_insert);
size_traits::increment();
return iterator(to_insert);
Index: list_hook.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/list_hook.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- list_hook.hpp 23 Jun 2007 12:55:23 -0000 1.3
+++ list_hook.hpp 22 Jul 2007 14:08:33 -0000 1.4
@@ -53,7 +53,7 @@
/// @cond
private:
- typedef circular_list_algorithms<node_traits> node_algorithms;
+ typedef circular_list_algorithms<node_traits> node_algorithms;
public:
typedef typename node_traits::node node;
@@ -174,7 +174,7 @@
//! copy-constructible or assignable.
template<class T>
struct value_traits
- : detail::derivation_value_traits<T, this_type, Tag>
+ : detail::derivation_hook_value_traits<T, this_type, Tag>
{};
//! <b>Effects</b>: Converts a pointer to a node into
@@ -351,7 +351,7 @@
//! T doesn't need to be copy-constructible or assignable.
template<class T, this_type T::* M>
struct value_traits
- : detail::member_value_traits<T, this_type, M>
+ : detail::member_hook_value_traits<T, this_type, M>
{};
//! <b>Effects</b>: Converts a pointer to a node into
Index: rbtree.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/rbtree.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- rbtree.hpp 23 Jun 2007 12:55:23 -0000 1.3
+++ rbtree.hpp 22 Jul 2007 14:08:33 -0000 1.4
@@ -42,14 +42,14 @@
>
class rbtree
: private detail::size_holder<ConstantTimeSize, SizeType>
- , private ValueTraits::node_traits::node
{
/// @cond
private:
+ typename ValueTraits::node_traits::node root_;
typedef rbtree<ValueTraits, Compare
,ConstantTimeSize, SizeType> this_type;
typedef typename ValueTraits::node_traits node_traits;
- typedef detail::size_holder<ConstantTimeSize, SizeType> size_traits;
+ typedef detail::size_holder<ConstantTimeSize, SizeType> size_traits;
//noncopyable
rbtree (const rbtree&);
@@ -352,7 +352,7 @@
detail::key_node_ptr_compare<value_compare, ValueTraits>
key_node_comp(priv_comp());
node_ptr to_insert(ValueTraits::to_node_ptr(value));
if(safemode_or_autounlink)
-
BOOST_INTRUSIVE_SAFE_MODE_CONTAINER_INSERTION_ASSERT(node_algorithms::unique(to_insert));
+
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
size_traits::increment();
return iterator(node_algorithms::insert_equal_upper_bound
(node_ptr(&priv_header()), to_insert, key_node_comp));
@@ -374,7 +374,7 @@
detail::key_node_ptr_compare<value_compare, ValueTraits>
key_node_comp(priv_comp());
node_ptr to_insert(ValueTraits::to_node_ptr(value));
if(safemode_or_autounlink)
-
BOOST_INTRUSIVE_SAFE_MODE_CONTAINER_INSERTION_ASSERT(node_algorithms::unique(to_insert));
+
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
size_traits::increment();
return iterator(node_algorithms::insert_equal_lower_bound
(node_ptr(&priv_header()), to_insert, key_node_comp));
@@ -399,7 +399,7 @@
detail::key_node_ptr_compare<value_compare, ValueTraits>
key_node_comp(priv_comp());
node_ptr to_insert(ValueTraits::to_node_ptr(value));
if(safemode_or_autounlink)
-
BOOST_INTRUSIVE_SAFE_MODE_CONTAINER_INSERTION_ASSERT(node_algorithms::unique(to_insert));
+
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
size_traits::increment();
return iterator(node_algorithms::insert_equal
(node_ptr(&priv_header()), hint.pointed_node(), to_insert,
key_node_comp));
@@ -539,7 +539,7 @@
{
node_ptr to_insert(ValueTraits::to_node_ptr(value));
if(safemode_or_autounlink)
-
BOOST_INTRUSIVE_SAFE_MODE_CONTAINER_INSERTION_ASSERT(node_algorithms::unique(to_insert));
+
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
size_traits::increment();
node_algorithms::insert_unique_commit
(node_ptr(&priv_header()), to_insert, commit_data);
@@ -560,7 +560,7 @@
++ret;
node_ptr to_erase(i.pointed_node());
if(safemode_or_autounlink)
-
BOOST_INTRUSIVE_SAFE_MODE_CONTAINER_INSERTION_ASSERT(!node_algorithms::unique(to_erase));
+
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase));
node_algorithms::erase(&priv_header(), to_erase);
size_traits::decrement();
if(safemode_or_autounlink)
Index: rbtree_algorithms.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/rbtree_algorithms.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- rbtree_algorithms.hpp 23 Jun 2007 12:55:23 -0000 1.4
+++ rbtree_algorithms.hpp 22 Jul 2007 14:08:33 -0000 1.5
@@ -43,7 +43,9 @@
#include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <cstddef>
+#ifndef BOOST_INTRUSIVE_DISABLE_EXCEPTION_HANDLING
#include <boost/detail/no_exceptions_support.hpp>
+#endif
#include <boost/intrusive/detail/utilities.hpp>
@@ -1112,8 +1114,9 @@
// structural copy. source_root and new_parent must be non-null.
node_ptr top = cloner(source_root);
NodeTraits::set_parent(top, new_parent);
-
+ #ifndef BOOST_INTRUSIVE_DISABLE_EXCEPTION_HANDLING
BOOST_TRY {
+ #endif
if(NodeTraits::get_right(source_root)){
NodeTraits::set_right
(top, deep_clone_node(NodeTraits::get_right(source_root), top
@@ -1134,12 +1137,14 @@
new_parent = y;
source_root = NodeTraits::get_left(source_root);
}
+ #ifndef BOOST_INTRUSIVE_DISABLE_EXCEPTION_HANDLING
}
BOOST_CATCH(...){
deep_dispose_node(top, disposer);
BOOST_RETHROW;
}
BOOST_CATCH_END
+ #endif
return top;
}
Index: set.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/set.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- set.hpp 23 Jun 2007 12:55:23 -0000 1.3
+++ set.hpp 22 Jul 2007 14:08:33 -0000 1.4
@@ -1412,6 +1412,15 @@
void clear_and_dispose(Disposer disposer)
{ return tree_.clear_and_dispose(disposer); }
+ //! <b>Effects</b>: Returns the number of contained elements with the given
key
+ //!
+ //! <b>Complexity</b>: Logarithmic to the number of elements contained plus
lineal
+ //! to number of objects with the given key.
+ //!
+ //! <b>Throws</b>: If the internal Compare ordering function throws.
+ size_type count(const_reference value) const
+ { return tree_.count(value); }
+
//! <b>Effects</b>: Returns the number of contained elements with the same
key
//! compared with the given comparison functor.
//!
@@ -1421,7 +1430,7 @@
//! <b>Throws</b>: If comp ordering function throws.
template<class KeyType, class KeyValueCompare>
size_type count(const KeyType& key, KeyValueCompare comp) const
- { return tree_.find(key, comp) != end(); }
+ { return tree_.count(key, comp); }
//! <b>Effects</b>: Returns an iterator to the first element whose
//! key is not less than k or end() if that element does not exist.
Index: set_hook.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/set_hook.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- set_hook.hpp 23 Jun 2007 12:55:23 -0000 1.3
+++ set_hook.hpp 22 Jul 2007 14:08:33 -0000 1.4
@@ -162,7 +162,7 @@
//! copy-constructible or assignable.
template<class T>
struct value_traits
- : detail::derivation_value_traits<T, this_type, Tag>
+ : detail::derivation_hook_value_traits<T, this_type, Tag>
{};
//! <b>Effects</b>: Converts a pointer to a node into
@@ -318,7 +318,7 @@
//! T don't need to be copy-constructible or assignable.
template<class T, this_type T::* P>
struct value_traits
- : detail::member_value_traits<T, this_type, P>
+ : detail::member_hook_value_traits<T, this_type, P>
{};
//! <b>Effects</b>: Converts a pointer to a node into
Index: slist.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/slist.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- slist.hpp 23 Jun 2007 12:55:23 -0000 1.4
+++ slist.hpp 22 Jul 2007 14:08:33 -0000 1.5
@@ -16,6 +16,9 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/static_assert.hpp>
+#ifndef BOOST_INTRUSIVE_DISABLE_EXCEPTION_HANDLING
+#include <boost/detail/no_exceptions_support.hpp>
+#endif
#include <boost/intrusive/detail/assert.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/slist_hook.hpp>
@@ -56,11 +59,12 @@
>
class slist
: private detail::size_holder<ConstantTimeSize, SizeType>
- , private ValueTraits::node_traits::node
{
/// @cond
private:
- typedef slist<ValueTraits, ConstantTimeSize, SizeType> this_type;
+ typename ValueTraits::node_traits::node root_;
+
+ typedef slist<ValueTraits, ConstantTimeSize, SizeType> this_type;
typedef typename ValueTraits::node_traits node_traits;
typedef detail::size_holder<ConstantTimeSize, SizeType> size_traits;
@@ -102,10 +106,10 @@
BOOST_STATIC_ASSERT(!(ConstantTimeSize && ((int)ValueTraits::linking_policy
== (int)auto_unlink)));
node_ptr get_root_node()
- { return node_ptr(&static_cast<node&>(*this)); }
+ { return node_ptr(&root_); }
const_node_ptr get_root_node() const
- { return const_node_ptr(&static_cast<const node&>(*this)); }
+ { return const_node_ptr(&root_); }
static node_ptr uncast(const_node_ptr ptr)
{
@@ -213,7 +217,7 @@
{
node_ptr to_insert = ValueTraits::to_node_ptr(value);
if(safemode_or_autounlink)
-
BOOST_INTRUSIVE_SAFE_MODE_CONTAINER_INSERTION_ASSERT(node_algorithms::unique(to_insert));
+
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
node_algorithms::link_after(this->get_root_node(), to_insert);
size_traits::increment();
}
@@ -353,7 +357,10 @@
//!
//! <b>Complexity</b>: Constant.
static slist &container_from_end_iterator(iterator end_iterator)
- { return static_cast<slist&>(*end_iterator.pointed_node()); }
+ {
+ return *detail::parent_from_member<slist, node>
+ ( detail::get_pointer(end_iterator.pointed_node()), &slist::root_);
+ }
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! of slist.
@@ -364,7 +371,10 @@
//!
//! <b>Complexity</b>: Constant.
static const slist &container_from_end_iterator(const_iterator end_iterator)
- { return static_cast<const slist&>(*end_iterator.pointed_node()); }
+ {
+ return *detail::parent_from_member<slist, node>
+ ( detail::get_pointer(end_iterator.pointed_node()), &slist::root_);
+ }
//! <b>Effects</b>: Returns the number of the elements contained in the
list.
//!
@@ -526,17 +536,22 @@
void clone_from(const slist &src, Cloner cloner, Disposer disposer)
{
this->clear_and_dispose(disposer);
- try{
+ #ifndef BOOST_INTRUSIVE_DISABLE_EXCEPTION_HANDLING
+ BOOST_TRY{
+ #endif
iterator prev = this->before_begin();
const_iterator b(src.begin()), e(src.end());
for(; b != e; ++b, ++prev){
this->insert_after(prev, *cloner(*b));
}
+ #ifndef BOOST_INTRUSIVE_DISABLE_EXCEPTION_HANDLING
}
- catch(...){
- clear_and_dispose(disposer);
- throw;
+ BOOST_CATCH(...){
+ this->clear_and_dispose(disposer);
+ BOOST_RETHROW;
}
+ BOOST_CATCH_END
+ #endif
}
//! <b>Requires</b>: value must be an lvalue and prev_p must point to an
element
@@ -556,7 +571,7 @@
{
node_ptr n = ValueTraits::to_node_ptr(value);
if(safemode_or_autounlink)
-
BOOST_INTRUSIVE_SAFE_MODE_CONTAINER_INSERTION_ASSERT(node_algorithms::unique(n));
+ BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(n));
node_algorithms::link_after(prev_p.pointed_node(), n);
size_traits::increment();
return iterator (n);
Index: slist_hook.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/slist_hook.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- slist_hook.hpp 23 Jun 2007 12:55:23 -0000 1.3
+++ slist_hook.hpp 22 Jul 2007 14:08:33 -0000 1.4
@@ -177,7 +177,7 @@
//! copy-constructible or assignable.
template<class T>
struct value_traits
- : detail::derivation_value_traits<T, this_type, Tag>
+ : detail::derivation_hook_value_traits<T, this_type, Tag>
{};
//! <b>Effects</b>: Converts a pointer to a node into
@@ -358,7 +358,7 @@
//! T doesn't need to be copy-constructible or assignable.
template<class T, this_type T::* M>
struct value_traits
- : detail::member_value_traits<T, this_type, M>
+ : detail::member_hook_value_traits<T, this_type, M>
{};
//! <b>Effects</b>: Converts a pointer to a node into
Index: unordered_set.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/unordered_set.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- unordered_set.hpp 23 Jun 2007 12:55:23 -0000 1.3
+++ unordered_set.hpp 22 Jul 2007 14:08:34 -0000 1.4
@@ -302,6 +302,22 @@
std::pair<iterator, bool> insert(reference value)
{ return table_.insert_unique(value); }
+ //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
+ //! of type value_type.
+ //!
+ //! <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).
+ //! Worst case O(N*this->size()).
+ //!
+ //! <b>Throws</b>: If the internal hasher or the equality functor throws.
Basic guarantee.
+ //!
+ //! <b>Note</b>: Does not affect the validity of iterators and references.
+ //! No copy-constructors are called.
+ template<class Iterator>
+ void insert(Iterator b, Iterator e)
+ { table_.insert_unique(b, e); }
+
//! <b>Requires</b>: "hasher" must be a hash function that induces
//! the same hash values as the stored hasher. The difference is that
//! "hasher" hashes the given key instead of the value_type.
@@ -364,22 +380,6 @@
iterator insert_commit(reference value, const insert_commit_data
&commit_data)
{ return table_.insert_unique_commit(value, commit_data); }
- //! <b>Requires</b>: Dereferencing iterator must yield an lvalue
- //! of type value_type.
- //!
- //! <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).
- //! Worst case O(N*this->size()).
- //!
- //! <b>Throws</b>: If the internal hasher or the equality functor throws.
Basic guarantee.
- //!
- //! <b>Note</b>: Does not affect the validity of iterators and references.
- //! No copy-constructors are called.
- template<class Iterator>
- void insert(Iterator b, Iterator e)
- { table_.insert_unique(b, e); }
-
//! <b>Effects</b>: Erases the element pointed to by i.
//!
//! <b>Complexity</b>: Average case O(1), worst case O(this->size()).
@@ -696,7 +696,7 @@
//! <b>Requires</b>: value must be an lvalue and shall be in a
unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
//!
- //! <b>Effects</b>: Returns: a valid iterator i belonging to the
unordered_set
+ //! <b>Effects</b>: Returns: a valid iterator belonging to the unordered_set
//! that points to the value
//!
//! <b>Complexity</b>: Constant.
@@ -708,7 +708,7 @@
//! <b>Requires</b>: value must be an lvalue and shall be in a
unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
//!
- //! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
+ //! <b>Effects</b>: Returns: a valid const_iterator belonging to the
//! unordered_set that points to the value
//!
//! <b>Complexity</b>: Constant.
@@ -720,7 +720,7 @@
//! <b>Requires</b>: value must be an lvalue and shall be in a
unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
//!
- //! <b>Effects</b>: Returns: a valid local_iterator i belonging to the
unordered_set
+ //! <b>Effects</b>: Returns: a valid local_iterator belonging to the
unordered_set
//! that points to the value
//!
//! <b>Complexity</b>: Constant.
@@ -732,7 +732,7 @@
//! <b>Requires</b>: value must be an lvalue and shall be in a
unordered_set of
//! appropriate type. Otherwise the behavior is undefined.
//!
- //! <b>Effects</b>: Returns: a valid const_local_iterator i belonging to
+ //! <b>Effects</b>: Returns: a valid const_local_iterator belonging to
//! the unordered_set that points to the value
//!
//! <b>Complexity</b>: Constant.
@@ -768,7 +768,7 @@
//! <b>Throws</b>: If the hash functor throws.
//!
//! <b>Note</b>: the return value is in the range [0, this->bucket_count()).
- size_type bucket(const key_type& k) const
+ size_type bucket(const value_type& k) const
{ return table_.bucket(k); }
//! <b>Requires</b>: "hasher" must be a hash function that induces
@@ -1530,7 +1530,7 @@
//! <b>Requires</b>: value must be an lvalue and shall be in a
unordered_multiset of
//! appropriate type. Otherwise the behavior is undefined.
//!
- //! <b>Effects</b>: Returns: a valid iterator i belonging to the
unordered_multiset
+ //! <b>Effects</b>: Returns: a valid iterator belonging to the
unordered_multiset
//! that points to the value
//!
//! <b>Complexity</b>: Constant.
@@ -1542,7 +1542,7 @@
//! <b>Requires</b>: value must be an lvalue and shall be in a
unordered_multiset of
//! appropriate type. Otherwise the behavior is undefined.
//!
- //! <b>Effects</b>: Returns: a valid const_iterator i belonging to the
+ //! <b>Effects</b>: Returns: a valid const_iterator belonging to the
//! unordered_multiset that points to the value
//!
//! <b>Complexity</b>: Constant.
@@ -1554,7 +1554,7 @@
//! <b>Requires</b>: value must be an lvalue and shall be in a
unordered_multiset of
//! appropriate type. Otherwise the behavior is undefined.
//!
- //! <b>Effects</b>: Returns: a valid local_iterator i belonging to the
unordered_multiset
+ //! <b>Effects</b>: Returns: a valid local_iterator belonging to the
unordered_multiset
//! that points to the value
//!
//! <b>Complexity</b>: Constant.
@@ -1566,7 +1566,7 @@
//! <b>Requires</b>: value must be an lvalue and shall be in a
unordered_multiset of
//! appropriate type. Otherwise the behavior is undefined.
//!
- //! <b>Effects</b>: Returns: a valid const_local_iterator i belonging to
+ //! <b>Effects</b>: Returns: a valid const_local_iterator belonging to
//! the unordered_multiset that points to the value
//!
//! <b>Complexity</b>: Constant.
@@ -1602,7 +1602,7 @@
//! <b>Throws</b>: If the hash functor throws.
//!
//! <b>Note</b>: the return value is in the range [0, this->bucket_count()).
- size_type bucket(const key_type& k) const
+ size_type bucket(const value_type& k) const
{ return table_.bucket(k); }
//! <b>Requires</b>: "hasher" must be a hash function that induces
Index: unordered_set_hook.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/intrusive/unordered_set_hook.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- unordered_set_hook.hpp 23 Jun 2007 12:55:23 -0000 1.3
+++ unordered_set_hook.hpp 22 Jul 2007 14:08:34 -0000 1.4
@@ -121,7 +121,7 @@
//! copy-constructible or assignable.
template<class T>
struct value_traits
- : detail::derivation_value_traits<T, this_type, Tag>
+ : detail::derivation_hook_value_traits<T, this_type, Tag>
{};
//! <b>Effects</b>: Converts a pointer to a node into
@@ -241,7 +241,7 @@
//! T doesn't need to be copy-constructible or assignable.
template<class T, this_type T::* M>
struct value_traits
- : detail::member_value_traits<T, this_type, M>
+ : detail::member_hook_value_traits<T, this_type, M>
{};
//! <b>Effects</b>: Removes the node if it's inserted in a container.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs