|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70299 - in trunk/boost/intrusive: . detail
From: igaztanaga_at_[hidden]
Date: 2011-03-21 04:58:31
Author: igaztanaga
Date: 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
New Revision: 70299
URL: http://svn.boost.org/trac/boost/changeset/70299
Log:
Added experimental move semantics to containers. Undocumented
Text files modified:
trunk/boost/intrusive/avl_set.hpp | 52 +++++++++++++++---
trunk/boost/intrusive/avltree.hpp | 36 ++++++++++++-
trunk/boost/intrusive/detail/hashtable_node.hpp | 22 ++++++++
trunk/boost/intrusive/hashtable.hpp | 109 +++++++++++++++++++++++++++++++--------
trunk/boost/intrusive/list.hpp | 39 +++++++++++--
trunk/boost/intrusive/rbtree.hpp | 34 +++++++++++-
trunk/boost/intrusive/set.hpp | 52 +++++++++++++++---
trunk/boost/intrusive/sg_set.hpp | 50 +++++++++++++++--
trunk/boost/intrusive/sgtree.hpp | 34 +++++++++++
trunk/boost/intrusive/slist.hpp | 43 +++++++++++----
trunk/boost/intrusive/splay_set.hpp | 52 +++++++++++++++---
trunk/boost/intrusive/splaytree.hpp | 33 +++++++++++
trunk/boost/intrusive/treap.hpp | 37 ++++++++++++-
trunk/boost/intrusive/treap_set.hpp | 52 +++++++++++++++---
trunk/boost/intrusive/unordered_set.hpp | 57 ++++++++++++++++----
15 files changed, 589 insertions(+), 113 deletions(-)
Modified: trunk/boost/intrusive/avl_set.hpp
==============================================================================
--- trunk/boost/intrusive/avl_set.hpp (original)
+++ trunk/boost/intrusive/avl_set.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -16,6 +16,7 @@
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/avltree.hpp>
#include <boost/intrusive/detail/mpl.hpp>
+#include <boost/move/move.hpp>
#include <iterator>
namespace boost {
@@ -42,12 +43,8 @@
/// @cond
typedef avltree_impl<Config> tree_type;
//! This class is
- //! non-copyable
- avl_set_impl (const avl_set_impl&);
-
- //! This class is
- //! non-assignable
- avl_set_impl &operator =(const avl_set_impl&);
+ //! movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_set_impl)
typedef tree_type implementation_defined;
/// @endcond
@@ -113,6 +110,17 @@
: tree_(true, b, e, cmp, v_traits)
{}
+ //! <b>Effects</b>: to-do
+ //!
+ avl_set_impl(BOOST_RV_REF(avl_set_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ avl_set_impl& operator=(BOOST_RV_REF(avl_set_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the avl_set
//! are not deleted (i.e. no destructors are called).
//!
@@ -1181,6 +1189,7 @@
#endif
::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_set)
public:
typedef typename Base::value_compare value_compare;
typedef typename Base::value_traits value_traits;
@@ -1202,6 +1211,13 @@
: Base(b, e, cmp, v_traits)
{}
+ avl_set(BOOST_RV_REF(avl_set) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ avl_set& operator=(BOOST_RV_REF(avl_set) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static avl_set &container_from_end_iterator(iterator end_iterator)
{ return static_cast<avl_set &>(Base::container_from_end_iterator(end_iterator)); }
@@ -1238,9 +1254,8 @@
/// @cond
typedef avltree_impl<Config> tree_type;
- //Non-copyable and non-assignable
- avl_multiset_impl (const avl_multiset_impl&);
- avl_multiset_impl &operator =(const avl_multiset_impl&);
+ //Movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_multiset_impl)
typedef tree_type implementation_defined;
/// @endcond
@@ -1305,6 +1320,17 @@
: tree_(false, b, e, cmp, v_traits)
{}
+ //! <b>Effects</b>: to-do
+ //!
+ avl_multiset_impl(BOOST_RV_REF(avl_multiset_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ avl_multiset_impl& operator=(BOOST_RV_REF(avl_multiset_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the avl_multiset
//! are not deleted (i.e. no destructors are called).
//!
@@ -2280,6 +2306,7 @@
#endif
::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(avl_multiset)
public:
typedef typename Base::value_compare value_compare;
typedef typename Base::value_traits value_traits;
@@ -2301,6 +2328,13 @@
: Base(b, e, cmp, v_traits)
{}
+ avl_multiset(BOOST_RV_REF(avl_multiset) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ avl_multiset& operator=(BOOST_RV_REF(avl_multiset) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static avl_multiset &container_from_end_iterator(iterator end_iterator)
{ return static_cast<avl_multiset &>(Base::container_from_end_iterator(end_iterator)); }
Modified: trunk/boost/intrusive/avltree.hpp
==============================================================================
--- trunk/boost/intrusive/avltree.hpp (original)
+++ trunk/boost/intrusive/avltree.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -32,6 +32,7 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/avltree_algorithms.hpp>
#include <boost/intrusive/link_mode.hpp>
+#include <boost/move/move.hpp>
namespace boost {
namespace intrusive {
@@ -122,9 +123,8 @@
private:
typedef detail::size_holder<constant_time_size, size_type> size_traits;
- //noncopyable
- avltree_impl (const avltree_impl&);
- avltree_impl operator =(const avltree_impl&);
+ //noncopyable, movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(avltree_impl)
enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -159,6 +159,12 @@
value_compare &priv_comp()
{ return data_.node_plus_pred_.get(); }
+ const value_traits &priv_value_traits() const
+ { return data_; }
+
+ value_traits &priv_value_traits()
+ { return data_; }
+
const node &priv_header() const
{ return data_.node_plus_pred_.header_plus_size_.header_; }
@@ -241,6 +247,21 @@
this->insert_equal(b, e);
}
+ //! <b>Effects</b>: to-do
+ //!
+ avltree_impl(BOOST_RV_REF(avltree_impl) x)
+ : data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
+ {
+ node_algorithms::init_header(&priv_header());
+ this->priv_size_traits().set_size(size_type(0));
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ avltree_impl& operator=(BOOST_RV_REF(avltree_impl) x)
+ { this->swap(x); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the set
//! are not deleted (i.e. no destructors are called), but the nodes according to
//! the value_traits template parameter are reinitialized and thus can be reused.
@@ -1606,6 +1627,8 @@
#endif
::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(avltree)
+
public:
typedef typename Base::value_compare value_compare;
typedef typename Base::value_traits value_traits;
@@ -1628,6 +1651,13 @@
: Base(unique, b, e, cmp, v_traits)
{}
+ avltree(BOOST_RV_REF(avltree) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ avltree& operator=(BOOST_RV_REF(avltree) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static avltree &container_from_end_iterator(iterator end_iterator)
{ return static_cast<avltree &>(Base::container_from_end_iterator(end_iterator)); }
Modified: trunk/boost/intrusive/detail/hashtable_node.hpp
==============================================================================
--- trunk/boost/intrusive/detail/hashtable_node.hpp (original)
+++ trunk/boost/intrusive/detail/hashtable_node.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -23,6 +23,9 @@
#include <boost/intrusive/detail/slist_node.hpp> //remove-me
#include <cstddef>
#include <boost/pointer_cast.hpp>
+#include <boost/move/move.hpp>
+
+
namespace boost {
namespace intrusive {
namespace detail {
@@ -76,6 +79,10 @@
template<class Slist>
struct bucket_traits_impl
{
+ private:
+ BOOST_COPYABLE_AND_MOVABLE(bucket_traits_impl)
+
+ public:
/// @cond
typedef typename boost::pointer_to_other
< typename Slist::pointer, bucket_impl<Slist> >::type bucket_ptr;
@@ -86,6 +93,21 @@
: buckets_(buckets), buckets_len_(len)
{}
+ bucket_traits_impl(BOOST_RV_REF(bucket_traits_impl) x)
+ : buckets_(x.buckets_), buckets_len_(x.buckets_len_)
+ { x.buckets_ = bucket_ptr(0); x.buckets_len_ = 0; }
+
+ bucket_traits_impl& operator=(BOOST_RV_REF(bucket_traits_impl) x)
+ {
+ buckets_ = x.buckets_; buckets_len_ = x.buckets_len_;
+ x.buckets_ = bucket_ptr(0); x.buckets_len_ = 0; return *this;
+ }
+
+ bucket_traits_impl& operator=(BOOST_COPY_ASSIGN_REF(bucket_traits_impl) x)
+ {
+ buckets_ = x.buckets_; buckets_len_ = x.buckets_len_; return *this;
+ }
+
bucket_ptr bucket_begin() const
{ return buckets_; }
Modified: trunk/boost/intrusive/hashtable.hpp
==============================================================================
--- trunk/boost/intrusive/hashtable.hpp (original)
+++ trunk/boost/intrusive/hashtable.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -38,6 +38,7 @@
#include <boost/intrusive/slist.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/type_traits.hpp>
+#include <boost/move/move.hpp>
namespace boost {
namespace intrusive {
@@ -212,7 +213,7 @@
template<class Config>
struct bucket_plus_size
- : public detail::size_holder
+ : public detail::size_holder //size_traits
< 0 != (Config::bool_flags & hash_bool_flags::constant_time_size_pos)
, typename Config::size_type>
{
@@ -221,15 +222,23 @@
, typename Config::size_type> size_traits;
typedef typename Config::bucket_traits bucket_traits;
- bucket_plus_size(const bucket_traits &b_traits)
- : bucket_traits_(b_traits)
+ template<class BucketTraits>
+ bucket_plus_size(BOOST_FWD_REF(BucketTraits) b_traits)
+ : bucket_traits_(::boost::forward<BucketTraits>(b_traits))
{}
+
+ bucket_plus_size & operator =(const bucket_plus_size &x)
+ {
+ this->size_traits::operator=(x);
+ bucket_traits_ = x.bucket_traits_;
+ return *this;
+ }
bucket_traits bucket_traits_;
};
template<class Config>
struct bucket_hash_t
- : public detail::ebo_functor_holder<typename Config::hash>
+ : public detail::ebo_functor_holder<typename Config::hash> //hash
{
typedef typename Config::hash hasher;
typedef detail::size_holder
@@ -237,22 +246,26 @@
, typename Config::size_type> size_traits;
typedef typename Config::bucket_traits bucket_traits;
- bucket_hash_t(const bucket_traits &b_traits, const hasher & h)
- : detail::ebo_functor_holder<hasher>(h), bucket_plus_size_(b_traits)
+ template<class BucketTraits>
+ bucket_hash_t(BOOST_FWD_REF(BucketTraits) b_traits, const hasher & h)
+ : detail::ebo_functor_holder<hasher>(h), bucket_plus_size_(::boost::forward<BucketTraits>(b_traits))
{}
bucket_plus_size<Config> bucket_plus_size_;
};
template<class Config, bool>
-struct bucket_hash_equal_t : public detail::ebo_functor_holder<typename Config::equal>
+struct bucket_hash_equal_t
+ : public detail::ebo_functor_holder<typename Config::equal>
{
typedef typename Config::equal equal;
typedef typename Config::hash hasher;
typedef typename Config::bucket_traits bucket_traits;
- bucket_hash_equal_t(const bucket_traits &b_traits, const hasher & h, const equal &e)
- : detail::ebo_functor_holder<typename Config::equal>(e), bucket_hash(b_traits, h)
+ template<class BucketTraits>
+ bucket_hash_equal_t(BOOST_FWD_REF(BucketTraits) b_traits, const hasher & h, const equal &e)
+ : detail::ebo_functor_holder<typename Config::equal>(e)//equal()
+ , bucket_hash(::boost::forward<BucketTraits>(b_traits), h)
{}
bucket_hash_t<Config> bucket_hash;
};
@@ -267,8 +280,10 @@
typedef typename unordered_bucket_ptr_impl
<typename Config::value_traits>::type bucket_ptr;
- bucket_hash_equal_t(const bucket_traits &b_traits, const hasher & h, const equal &e)
- : detail::ebo_functor_holder<typename Config::equal>(e), bucket_hash(b_traits, h)
+ template<class BucketTraits>
+ bucket_hash_equal_t(BOOST_FWD_REF(BucketTraits) b_traits, const hasher & h, const equal &e)
+ : detail::ebo_functor_holder<typename Config::equal>(e) //equal()
+ , bucket_hash(::boost::forward<BucketTraits>(b_traits), h)
{}
bucket_hash_t<Config> bucket_hash;
bucket_ptr cached_begin_;
@@ -283,22 +298,25 @@
typedef typename Config::hash hasher;
typedef typename Config::bucket_traits bucket_traits;
- hashtable_data_t( const bucket_traits &b_traits, const hasher & h
+ template<class BucketTraits>
+ hashtable_data_t( BOOST_FWD_REF(BucketTraits) b_traits, const hasher & h
, const equal &e, const value_traits &val_traits)
- : Config::value_traits(val_traits), internal_(b_traits, h, e)
+ : Config::value_traits(val_traits) //value_traits
+ , internal_(::boost::forward<BucketTraits>(b_traits), h, e)
{}
typedef typename detail::usetopt_mask
< Config
, detail::hash_bool_flags::constant_time_size_pos
- | detail::hash_bool_flags::incremental_pos
+ | detail::hash_bool_flags::incremental_pos
>::type masked_config_t;
struct internal
- : public detail::size_holder
+ : public detail::size_holder //split_traits
< 0 != (Config::bool_flags & hash_bool_flags::incremental_pos)
, typename Config::size_type>
{
- internal(const bucket_traits &b_traits, const hasher & h, const equal &e)
- : bucket_hash_equal_(b_traits, h, e)
+ template<class BucketTraits>
+ internal(BOOST_FWD_REF(BucketTraits) b_traits, const hasher & h, const equal &e)
+ : bucket_hash_equal_(::boost::forward<BucketTraits>(b_traits), h, e)
{}
bucket_hash_equal_t
@@ -707,9 +725,8 @@
};
private:
- //noncopyable
- hashtable_impl (const hashtable_impl&);
- hashtable_impl operator =(const hashtable_impl&);
+ //noncopyable, movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(hashtable_impl)
enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -791,6 +808,33 @@
priv_split_traits().set_size(bucket_size>>1);
}
+ //! <b>Effects</b>: to-do
+ //!
+ hashtable_impl(BOOST_RV_REF(hashtable_impl) x)
+ : data_( ::boost::move(x.priv_bucket_traits())
+ , ::boost::move(x.priv_hasher())
+ , ::boost::move(x.priv_equal())
+ , ::boost::move(x.priv_value_traits())
+ )
+ {
+ priv_swap_cache(cache_begin_t(), x);
+ x.priv_initialize_cache();
+ if(constant_time_size){
+ this->priv_size_traits().set_size(size_type(0));
+ this->priv_size_traits().set_size(x.priv_size_traits().get_size());
+ x.priv_size_traits().set_size(size_type(0));
+ }
+ if(incremental){
+ this->priv_split_traits().set_size(x.priv_split_traits().get_size());
+ x.priv_split_traits().set_size(size_type(0));
+ }
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ hashtable_impl& operator=(BOOST_RV_REF(hashtable_impl) x)
+ { this->swap(x); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set
//! are not deleted (i.e. no destructors are called).
//!
@@ -935,14 +979,15 @@
swap(this->priv_equal(), other.priv_equal());
swap(this->priv_hasher(), other.priv_hasher());
//These can't throw
- swap(this->priv_real_bucket_traits(), other.priv_real_bucket_traits());
+ swap(this->priv_bucket_traits(), other.priv_bucket_traits());
+ swap(this->priv_value_traits(), other.priv_value_traits());
priv_swap_cache(cache_begin_t(), other);
if(constant_time_size){
size_type backup = this->priv_size_traits().get_size();
this->priv_size_traits().set_size(other.priv_size_traits().get_size());
other.priv_size_traits().set_size(backup);
}
- else if(incremental){
+ if(incremental){
size_type backup = this->priv_split_traits().get_size();
this->priv_split_traits().set_size(other.priv_split_traits().get_size());
other.priv_split_traits().set_size(backup);
@@ -2201,6 +2246,12 @@
key_equal &priv_equal()
{ return static_cast<key_equal&>(this->data_.internal_.bucket_hash_equal_.get()); }
+ const value_traits &priv_value_traits() const
+ { return data_; }
+
+ value_traits &priv_value_traits()
+ { return data_; }
+
value_type &priv_value_from_slist_node(slist_node_ptr n)
{ return *this->get_real_value_traits().to_value_ptr(dcast_bucket_ptr(n)); }
@@ -2225,6 +2276,12 @@
real_bucket_traits &priv_real_bucket_traits()
{ return this->priv_real_bucket_traits(detail::bool_<external_bucket_traits>()); }
+ const bucket_traits &priv_bucket_traits() const
+ { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; }
+
+ bucket_traits &priv_bucket_traits()
+ { return this->data_.internal_.bucket_hash_equal_.bucket_hash.bucket_plus_size_.bucket_traits_; }
+
const hasher &priv_hasher() const
{ return static_cast<const hasher&>(this->data_.internal_.bucket_hash_equal_.bucket_hash.get()); }
@@ -2989,6 +3046,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(hashtable)
public:
typedef typename Base::value_traits value_traits;
@@ -3010,6 +3068,13 @@
, const value_traits &v_traits = value_traits())
: Base(b_traits, hash_func, equal_func, v_traits)
{}
+
+ hashtable(BOOST_RV_REF(hashtable) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ hashtable& operator=(BOOST_RV_REF(hashtable) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
};
#endif
Modified: trunk/boost/intrusive/list.hpp
==============================================================================
--- trunk/boost/intrusive/list.hpp (original)
+++ trunk/boost/intrusive/list.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -30,7 +30,7 @@
#include <algorithm>
#include <functional>
#include <cstddef>
-//iG pending #include <boost/pointer_cast.hpp>
+#include <boost/move/move.hpp>
namespace boost {
namespace intrusive {
@@ -114,9 +114,8 @@
private:
typedef detail::size_holder<constant_time_size, size_type> size_traits;
- //Non-copyable and non-moveable
- list_impl (const list_impl&);
- list_impl &operator =(const list_impl&);
+ //noncopyable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(list_impl)
enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -173,10 +172,10 @@
real_value_traits &get_real_value_traits(detail::bool_<true>)
{ return data_.get_value_traits(*this); }
- const value_traits &get_value_traits() const
+ const value_traits &priv_value_traits() const
{ return data_; }
- value_traits &get_value_traits()
+ value_traits &priv_value_traits()
{ return data_; }
protected:
@@ -229,6 +228,21 @@
this->insert(this->cend(), b, e);
}
+ //! <b>Effects</b>: to-do
+ //!
+ list_impl(BOOST_RV_REF(list_impl) x)
+ : data_(::boost::move(x.priv_value_traits()))
+ {
+ this->priv_size_traits().set_size(size_type(0));
+ node_algorithms::init_header(this->get_root_node());
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ list_impl& operator=(BOOST_RV_REF(list_impl) x)
+ { this->swap(x); return *this; }
+
//! <b>Effects</b>: If it's not a safe-mode or an auto-unlink value_type
//! the destructor does nothing
//! (ie. no code is generated). Otherwise it detaches all elements from this.
@@ -988,8 +1002,8 @@
{
if(node_traits::get_next(this->get_root_node())
!= node_traits::get_previous(this->get_root_node())){
- list_impl carry(this->get_value_traits());
- detail::array_initializer<list_impl, 64> counter(this->get_value_traits());
+ list_impl carry(this->priv_value_traits());
+ detail::array_initializer<list_impl, 64> counter(this->priv_value_traits());
int fill = 0;
while(!this->empty()){
carry.splice(carry.cbegin(), *this, this->cbegin());
@@ -1473,6 +1487,8 @@
typedef typename Base::real_value_traits real_value_traits;
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(list)
+
public:
typedef typename Base::value_traits value_traits;
typedef typename Base::iterator iterator;
@@ -1487,6 +1503,13 @@
: Base(b, e, v_traits)
{}
+ list(BOOST_RV_REF(list) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ list& operator=(BOOST_RV_REF(list) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static list &container_from_end_iterator(iterator end_iterator)
{ return static_cast<list &>(Base::container_from_end_iterator(end_iterator)); }
Modified: trunk/boost/intrusive/rbtree.hpp
==============================================================================
--- trunk/boost/intrusive/rbtree.hpp (original)
+++ trunk/boost/intrusive/rbtree.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -33,7 +33,7 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/rbtree_algorithms.hpp>
#include <boost/intrusive/link_mode.hpp>
-//iG pending #include <boost/pointer_cast.hpp>
+#include <boost/move/move.hpp>
namespace boost {
namespace intrusive {
@@ -122,8 +122,7 @@
typedef detail::size_holder<constant_time_size, size_type> size_traits;
//noncopyable
- rbtree_impl (const rbtree_impl&);
- rbtree_impl operator =(const rbtree_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(rbtree_impl)
enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -158,6 +157,12 @@
value_compare &priv_comp()
{ return data_.node_plus_pred_.get(); }
+ const value_traits &priv_value_traits() const
+ { return data_; }
+
+ value_traits &priv_value_traits()
+ { return data_; }
+
const node &priv_header() const
{ return data_.node_plus_pred_.header_plus_size_.header_; }
@@ -254,6 +259,21 @@
this->insert_equal(b, e);
}
+ //! <b>Effects</b>: to-do
+ //!
+ rbtree_impl(BOOST_RV_REF(rbtree_impl) x)
+ : data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
+ {
+ node_algorithms::init_header(&priv_header());
+ this->priv_size_traits().set_size(size_type(0));
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ rbtree_impl& operator=(BOOST_RV_REF(rbtree_impl) x)
+ { this->swap(x); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the set
//! are not deleted (i.e. no destructors are called), but the nodes according to
//! the value_traits template parameter are reinitialized and thus can be reused.
@@ -1613,6 +1633,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(rbtree)
public:
typedef typename Base::value_compare value_compare;
@@ -1636,6 +1657,13 @@
: Base(unique, b, e, cmp, v_traits)
{}
+ rbtree(BOOST_RV_REF(rbtree) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ rbtree& operator=(BOOST_RV_REF(rbtree) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static rbtree &container_from_end_iterator(iterator end_iterator)
{ return static_cast<rbtree &>(Base::container_from_end_iterator(end_iterator)); }
Modified: trunk/boost/intrusive/set.hpp
==============================================================================
--- trunk/boost/intrusive/set.hpp (original)
+++ trunk/boost/intrusive/set.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -18,6 +18,7 @@
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/rbtree.hpp>
#include <iterator>
+#include <boost/move/move.hpp>
namespace boost {
namespace intrusive {
@@ -42,13 +43,7 @@
{
/// @cond
typedef rbtree_impl<Config> tree_type;
- //! This class is
- //! non-copyable
- set_impl (const set_impl&);
-
- //! This class is
- //! non-assignable
- set_impl &operator =(const set_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(set_impl)
typedef tree_type implementation_defined;
/// @endcond
@@ -122,6 +117,17 @@
: tree_(true, b, e, cmp, v_traits)
{}
+ //! <b>Effects</b>: to-do
+ //!
+ set_impl(BOOST_RV_REF(set_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ set_impl& operator=(BOOST_RV_REF(set_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the set
//! are not deleted (i.e. no destructors are called).
//!
@@ -1190,6 +1196,7 @@
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(set)
public:
typedef typename Base::value_compare value_compare;
typedef typename Base::value_traits value_traits;
@@ -1211,6 +1218,13 @@
: Base(b, e, cmp, v_traits)
{}
+ set(BOOST_RV_REF(set) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ set& operator=(BOOST_RV_REF(set) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static set &container_from_end_iterator(iterator end_iterator)
{ return static_cast<set &>(Base::container_from_end_iterator(end_iterator)); }
@@ -1247,9 +1261,7 @@
/// @cond
typedef rbtree_impl<Config> tree_type;
- //Non-copyable and non-assignable
- multiset_impl (const multiset_impl&);
- multiset_impl &operator =(const multiset_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(multiset_impl)
typedef tree_type implementation_defined;
/// @endcond
@@ -1321,6 +1333,17 @@
: tree_(false, b, e, cmp, v_traits)
{}
+ //! <b>Effects</b>: to-do
+ //!
+ multiset_impl(BOOST_RV_REF(multiset_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ multiset_impl& operator=(BOOST_RV_REF(multiset_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the set
//! are not deleted (i.e. no destructors are called).
//!
@@ -2307,6 +2330,8 @@
Options...
#endif
>::type Base;
+
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(multiset)
public:
typedef typename Base::value_compare value_compare;
@@ -2329,6 +2354,13 @@
: Base(b, e, cmp, v_traits)
{}
+ multiset(BOOST_RV_REF(multiset) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ multiset& operator=(BOOST_RV_REF(multiset) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static multiset &container_from_end_iterator(iterator end_iterator)
{ return static_cast<multiset &>(Base::container_from_end_iterator(end_iterator)); }
Modified: trunk/boost/intrusive/sg_set.hpp
==============================================================================
--- trunk/boost/intrusive/sg_set.hpp (original)
+++ trunk/boost/intrusive/sg_set.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -16,6 +16,7 @@
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/sgtree.hpp>
#include <boost/intrusive/detail/mpl.hpp>
+#include <boost/move/move.hpp>
#include <iterator>
namespace boost {
@@ -42,12 +43,8 @@
/// @cond
typedef sgtree_impl<Config> tree_type;
//! This class is
- //! non-copyable
- sg_set_impl (const sg_set_impl&);
-
- //! This class is
- //! non-assignable
- sg_set_impl &operator =(const sg_set_impl&);
+ //! movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_set_impl)
typedef tree_type implementation_defined;
/// @endcond
@@ -111,6 +108,17 @@
: tree_(true, b, e, cmp, v_traits)
{}
+ //! <b>Effects</b>: to-do
+ //!
+ sg_set_impl(BOOST_RV_REF(sg_set_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ sg_set_impl& operator=(BOOST_RV_REF(sg_set_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the sg_set
//! are not deleted (i.e. no destructors are called).
//!
@@ -1218,6 +1226,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_set)
public:
typedef typename Base::value_compare value_compare;
@@ -1240,6 +1249,13 @@
: Base(b, e, cmp, v_traits)
{}
+ sg_set(BOOST_RV_REF(sg_set) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ sg_set& operator=(BOOST_RV_REF(sg_set) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static sg_set &container_from_end_iterator(iterator end_iterator)
{ return static_cast<sg_set &>(Base::container_from_end_iterator(end_iterator)); }
@@ -1277,8 +1293,7 @@
typedef sgtree_impl<Config> tree_type;
//Non-copyable and non-assignable
- sg_multiset_impl (const sg_multiset_impl&);
- sg_multiset_impl &operator =(const sg_multiset_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_multiset_impl)
typedef tree_type implementation_defined;
/// @endcond
@@ -1341,6 +1356,17 @@
: tree_(false, b, e, cmp, v_traits)
{}
+ //! <b>Effects</b>: to-do
+ //!
+ sg_multiset_impl(BOOST_RV_REF(sg_multiset_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ sg_multiset_impl& operator=(BOOST_RV_REF(sg_multiset_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the sg_multiset
//! are not deleted (i.e. no destructors are called).
//!
@@ -2352,6 +2378,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sg_multiset)
public:
typedef typename Base::value_compare value_compare;
@@ -2374,6 +2401,13 @@
: Base(b, e, cmp, v_traits)
{}
+ sg_multiset(BOOST_RV_REF(sg_multiset) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ sg_multiset& operator=(BOOST_RV_REF(sg_multiset) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static sg_multiset &container_from_end_iterator(iterator end_iterator)
{ return static_cast<sg_multiset &>(Base::container_from_end_iterator(end_iterator)); }
Modified: trunk/boost/intrusive/sgtree.hpp
==============================================================================
--- trunk/boost/intrusive/sgtree.hpp (original)
+++ trunk/boost/intrusive/sgtree.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -38,6 +38,7 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/sgtree_algorithms.hpp>
#include <boost/intrusive/link_mode.hpp>
+#include <boost/move/move.hpp>
namespace boost {
namespace intrusive {
@@ -254,8 +255,7 @@
typedef typename alpha_traits::multiply_by_alpha_t multiply_by_alpha_t;
//noncopyable
- sgtree_impl (const sgtree_impl&);
- sgtree_impl operator =(const sgtree_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sgtree_impl)
enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -303,6 +303,12 @@
value_compare &priv_comp()
{ return data_.node_plus_pred_.get(); }
+ const value_traits &priv_value_traits() const
+ { return data_; }
+
+ value_traits &priv_value_traits()
+ { return data_; }
+
const node &priv_header() const
{ return data_.node_plus_pred_.header_plus_alpha_.header_; }
@@ -395,6 +401,21 @@
this->insert_equal(b, e);
}
+ //! <b>Effects</b>: to-do
+ //!
+ sgtree_impl(BOOST_RV_REF(sgtree_impl) x)
+ : data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
+ {
+ node_algorithms::init_header(&priv_header());
+ this->priv_size_traits().set_size(size_type(0));
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ sgtree_impl& operator=(BOOST_RV_REF(sgtree_impl) x)
+ { this->swap(x); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the set
//! are not deleted (i.e. no destructors are called), but the nodes according to
//! the value_traits template parameter are reinitialized and thus can be reused.
@@ -1838,6 +1859,8 @@
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(sgtree)
+
public:
typedef typename Base::value_compare value_compare;
typedef typename Base::value_traits value_traits;
@@ -1860,6 +1883,13 @@
: Base(unique, b, e, cmp, v_traits)
{}
+ sgtree(BOOST_RV_REF(sgtree) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ sgtree& operator=(BOOST_RV_REF(sgtree) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static sgtree &container_from_end_iterator(iterator end_iterator)
{ return static_cast<sgtree &>(Base::container_from_end_iterator(end_iterator)); }
Modified: trunk/boost/intrusive/slist.hpp
==============================================================================
--- trunk/boost/intrusive/slist.hpp (original)
+++ trunk/boost/intrusive/slist.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -31,7 +31,7 @@
#include <algorithm>
#include <cstddef> //std::size_t
#include <utility> //std::pair
-//iG pending #include <boost/pointer_cast.hpp>
+#include <boost/move/move.hpp>
namespace boost {
namespace intrusive {
@@ -148,13 +148,8 @@
private:
typedef detail::size_holder<constant_time_size, size_type> size_traits;
- //! This class is
- //! non-copyable
- slist_impl (const slist_impl&);
-
- //! This class is
- //! non-asignable
- slist_impl &operator =(const slist_impl&);
+ //noncopyable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(slist_impl)
enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -252,10 +247,10 @@
real_value_traits &get_real_value_traits(detail::bool_<true>)
{ return data_.get_value_traits(*this); }
- const value_traits &get_value_traits() const
+ const value_traits &priv_value_traits() const
{ return data_; }
- value_traits &get_value_traits()
+ value_traits &priv_value_traits()
{ return data_; }
protected:
@@ -305,6 +300,21 @@
this->insert_after(this->cbefore_begin(), b, e);
}
+ //! <b>Effects</b>: to-do
+ //!
+ slist_impl(BOOST_RV_REF(slist_impl) x)
+ : data_(::boost::move(x.priv_value_traits()))
+ {
+ this->priv_size_traits().set_size(size_type(0));
+ node_algorithms::init_header(this->get_root_node());
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ slist_impl& operator=(BOOST_RV_REF(slist_impl) x)
+ { this->swap(x); return *this; }
+
//! <b>Effects</b>: If it's a safe-mode
//! or auto-unlink value, the destructor does nothing
//! (ie. no code is generated). Otherwise it detaches all elements from this.
@@ -1313,8 +1323,8 @@
if (node_traits::get_next(node_traits::get_next(this->get_root_node()))
!= this->get_root_node()) {
- slist_impl carry(this->get_value_traits());
- detail::array_initializer<slist_impl, 64> counter(this->get_value_traits());
+ slist_impl carry(this->priv_value_traits());
+ detail::array_initializer<slist_impl, 64> counter(this->priv_value_traits());
int fill = 0;
const_iterator last_inserted;
while(!this->empty()){
@@ -2084,6 +2094,8 @@
typedef typename Base::real_value_traits real_value_traits;
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename real_value_traits::value_type, T>::value));
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(slist)
+
public:
typedef typename Base::value_traits value_traits;
typedef typename Base::iterator iterator;
@@ -2098,6 +2110,13 @@
: Base(b, e, v_traits)
{}
+ slist(BOOST_RV_REF(slist) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ slist& operator=(BOOST_RV_REF(slist) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static slist &container_from_end_iterator(iterator end_iterator)
{ return static_cast<slist &>(Base::container_from_end_iterator(end_iterator)); }
Modified: trunk/boost/intrusive/splay_set.hpp
==============================================================================
--- trunk/boost/intrusive/splay_set.hpp (original)
+++ trunk/boost/intrusive/splay_set.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -16,6 +16,7 @@
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/splaytree.hpp>
#include <boost/intrusive/detail/mpl.hpp>
+#include <boost/move/move.hpp>
#include <iterator>
namespace boost {
@@ -42,12 +43,8 @@
/// @cond
typedef splaytree_impl<Config> tree_type;
//! This class is
- //! non-copyable
- splay_set_impl (const splay_set_impl&);
-
- //! This class is
- //! non-assignable
- splay_set_impl &operator =(const splay_set_impl&);
+ //! movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_set_impl)
typedef tree_type implementation_defined;
/// @endcond
@@ -113,6 +110,17 @@
: tree_(true, b, e, cmp, v_traits)
{}
+ //! <b>Effects</b>: to-do
+ //!
+ splay_set_impl(BOOST_RV_REF(splay_set_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ splay_set_impl& operator=(BOOST_RV_REF(splay_set_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the splay_set
//! are not deleted (i.e. no destructors are called).
//!
@@ -1202,6 +1210,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_set)
public:
typedef typename Base::value_compare value_compare;
@@ -1224,6 +1233,13 @@
: Base(b, e, cmp, v_traits)
{}
+ splay_set(BOOST_RV_REF(splay_set) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ splay_set& operator=(BOOST_RV_REF(splay_set) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static splay_set &container_from_end_iterator(iterator end_iterator)
{ return static_cast<splay_set &>(Base::container_from_end_iterator(end_iterator)); }
@@ -1260,9 +1276,8 @@
/// @cond
typedef splaytree_impl<Config> tree_type;
- //Non-copyable and non-assignable
- splay_multiset_impl (const splay_multiset_impl&);
- splay_multiset_impl &operator =(const splay_multiset_impl&);
+ //Movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_multiset_impl)
typedef tree_type implementation_defined;
/// @endcond
@@ -1327,6 +1342,17 @@
: tree_(false, b, e, cmp, v_traits)
{}
+ //! <b>Effects</b>: to-do
+ //!
+ splay_multiset_impl(BOOST_RV_REF(splay_multiset_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ splay_multiset_impl& operator=(BOOST_RV_REF(splay_multiset_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the set
//! are not deleted (i.e. no destructors are called).
//!
@@ -2324,6 +2350,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splay_multiset)
public:
typedef typename Base::value_compare value_compare;
@@ -2346,6 +2373,13 @@
: Base(b, e, cmp, v_traits)
{}
+ splay_multiset(BOOST_RV_REF(splay_multiset) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ splay_multiset& operator=(BOOST_RV_REF(splay_multiset) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static splay_multiset &container_from_end_iterator(iterator end_iterator)
{ return static_cast<splay_multiset &>(Base::container_from_end_iterator(end_iterator)); }
Modified: trunk/boost/intrusive/splaytree.hpp
==============================================================================
--- trunk/boost/intrusive/splaytree.hpp (original)
+++ trunk/boost/intrusive/splaytree.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -30,6 +30,7 @@
#include <boost/intrusive/options.hpp>
#include <boost/intrusive/splaytree_algorithms.hpp>
#include <boost/intrusive/link_mode.hpp>
+#include <boost/move/move.hpp>
namespace boost {
@@ -122,8 +123,7 @@
typedef detail::size_holder<constant_time_size, size_type> size_traits;
//noncopyable
- splaytree_impl (const splaytree_impl&);
- splaytree_impl operator =(const splaytree_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splaytree_impl)
enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -158,6 +158,12 @@
value_compare &priv_comp()
{ return data_.node_plus_pred_.get(); }
+ const value_traits &priv_value_traits() const
+ { return data_; }
+
+ value_traits &priv_value_traits()
+ { return data_; }
+
const node &priv_header() const
{ return data_.node_plus_pred_.header_plus_size_.header_; }
@@ -240,6 +246,21 @@
this->insert_equal(b, e);
}
+ //! <b>Effects</b>: to-do
+ //!
+ splaytree_impl(BOOST_RV_REF(splaytree_impl) x)
+ : data_(::boost::move(x.priv_comp()), ::boost::move(x.priv_value_traits()))
+ {
+ node_algorithms::init_header(&priv_header());
+ this->priv_size_traits().set_size(size_type(0));
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ splaytree_impl& operator=(BOOST_RV_REF(splaytree_impl) x)
+ { this->swap(x); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the set
//! are not deleted (i.e. no destructors are called), but the nodes according to
//! the value_traits template parameter are reinitialized and thus can be reused.
@@ -1614,6 +1635,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splaytree)
public:
typedef typename Base::value_compare value_compare;
@@ -1637,6 +1659,13 @@
: Base(unique, b, e, cmp, v_traits)
{}
+ splaytree(BOOST_RV_REF(splaytree) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ splaytree& operator=(BOOST_RV_REF(splaytree) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static splaytree &container_from_end_iterator(iterator end_iterator)
{ return static_cast<splaytree &>(Base::container_from_end_iterator(end_iterator)); }
Modified: trunk/boost/intrusive/treap.hpp
==============================================================================
--- trunk/boost/intrusive/treap.hpp (original)
+++ trunk/boost/intrusive/treap.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -31,6 +31,7 @@
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/treap_algorithms.hpp>
#include <boost/intrusive/link_mode.hpp>
+#include <boost/move/move.hpp>
#include <boost/intrusive/priority_compare.hpp>
namespace boost {
@@ -126,8 +127,7 @@
typedef detail::size_holder<constant_time_size, size_type> size_traits;
//noncopyable
- treap_impl (const treap_impl&);
- treap_impl operator =(const treap_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_impl)
enum { safemode_or_autounlink =
(int)real_value_traits::link_mode == (int)auto_unlink ||
@@ -176,6 +176,12 @@
priority_compare &priv_pcomp()
{ return data_.node_plus_pred_.header_plus_priority_size_.get(); }
+ const value_traits &priv_value_traits() const
+ { return data_; }
+
+ value_traits &priv_value_traits()
+ { return data_; }
+
const node &priv_header() const
{ return data_.node_plus_pred_.header_plus_priority_size_.header_plus_size_.header_; }
@@ -224,7 +230,7 @@
//! <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()
+ 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)
@@ -261,6 +267,23 @@
this->insert_equal(b, e);
}
+ //! <b>Effects</b>: to-do
+ //!
+ treap_impl(BOOST_RV_REF(treap_impl) x)
+ : data_( ::boost::move(x.priv_comp())
+ , ::boost::move(x.priv_pcomp())
+ , ::boost::move(x.priv_value_traits()))
+ {
+ node_algorithms::init_header(&priv_header());
+ this->priv_size_traits().set_size(size_type(0));
+ this->swap(x);
+ }
+
+ //! <b>Effects</b>: to-do
+ //!
+ treap_impl& operator=(BOOST_RV_REF(treap_impl) x)
+ { this->swap(x); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the set
//! are not deleted (i.e. no destructors are called), but the nodes according to
//! the value_traits template parameter are reinitialized and thus can be reused.
@@ -1701,6 +1724,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap)
public:
typedef typename Base::value_compare value_compare;
@@ -1727,6 +1751,13 @@
: Base(unique, b, e, cmp, pcmp, v_traits)
{}
+ treap(BOOST_RV_REF(treap) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ treap& operator=(BOOST_RV_REF(treap) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static treap &container_from_end_iterator(iterator end_iterator)
{ return static_cast<treap &>(Base::container_from_end_iterator(end_iterator)); }
Modified: trunk/boost/intrusive/treap_set.hpp
==============================================================================
--- trunk/boost/intrusive/treap_set.hpp (original)
+++ trunk/boost/intrusive/treap_set.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -16,6 +16,7 @@
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/treap.hpp>
#include <boost/intrusive/detail/mpl.hpp>
+#include <boost/move/move.hpp>
#include <iterator>
namespace boost {
@@ -42,12 +43,8 @@
/// @cond
typedef treap_impl<Config> tree_type;
//! This class is
- //! non-copyable
- treap_set_impl (const treap_set_impl&);
-
- //! This class is
- //! non-assignable
- treap_set_impl &operator =(const treap_set_impl&);
+ //! movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_set_impl)
typedef tree_type implementation_defined;
/// @endcond
@@ -116,6 +113,17 @@
: tree_(true, b, e, cmp, pcmp, v_traits)
{}
+ //! <b>Effects</b>: to-do
+ //!
+ treap_set_impl(BOOST_RV_REF(treap_set_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ treap_set_impl& operator=(BOOST_RV_REF(treap_set_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the treap_set
//! are not deleted (i.e. no destructors are called).
//!
@@ -1294,6 +1302,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_set)
public:
typedef typename Base::value_compare value_compare;
@@ -1319,6 +1328,13 @@
: Base(b, e, cmp, pcmp, v_traits)
{}
+ treap_set(BOOST_RV_REF(treap_set) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ treap_set& operator=(BOOST_RV_REF(treap_set) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static treap_set &container_from_end_iterator(iterator end_iterator)
{ return static_cast<treap_set &>(Base::container_from_end_iterator(end_iterator)); }
@@ -1355,9 +1371,7 @@
/// @cond
typedef treap_impl<Config> tree_type;
- //Non-copyable and non-assignable
- treap_multiset_impl (const treap_multiset_impl&);
- treap_multiset_impl &operator =(const treap_multiset_impl&);
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_multiset_impl)
typedef tree_type implementation_defined;
/// @endcond
@@ -1425,6 +1439,17 @@
: tree_(false, b, e, cmp, pcmp, v_traits)
{}
+ //! <b>Effects</b>: to-do
+ //!
+ treap_multiset_impl(BOOST_RV_REF(treap_multiset_impl) x)
+ : tree_(::boost::move(x.tree_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ treap_multiset_impl& operator=(BOOST_RV_REF(treap_multiset_impl) x)
+ { tree_ = ::boost::move(x.tree_); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the treap_multiset
//! are not deleted (i.e. no destructors are called).
//!
@@ -2499,6 +2524,8 @@
Options...
#endif
>::type Base;
+ //Movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap_multiset)
public:
typedef typename Base::value_compare value_compare;
@@ -2524,6 +2551,13 @@
: Base(b, e, cmp, pcmp, v_traits)
{}
+ treap_multiset(BOOST_RV_REF(treap_multiset) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ treap_multiset& operator=(BOOST_RV_REF(treap_multiset) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
+
static treap_multiset &container_from_end_iterator(iterator end_iterator)
{ return static_cast<treap_multiset &>(Base::container_from_end_iterator(end_iterator)); }
Modified: trunk/boost/intrusive/unordered_set.hpp
==============================================================================
--- trunk/boost/intrusive/unordered_set.hpp (original)
+++ trunk/boost/intrusive/unordered_set.hpp 2011-03-21 04:58:28 EDT (Mon, 21 Mar 2011)
@@ -16,8 +16,10 @@
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <boost/intrusive/hashtable.hpp>
+#include <boost/move/move.hpp>
#include <iterator>
+
namespace boost {
namespace intrusive {
@@ -68,12 +70,8 @@
typedef hashtable_impl<Config> table_type;
//! This class is
- //! non-copyable
- unordered_set_impl (const unordered_set_impl&);
-
- //! This class is
- //! non-assignable
- unordered_set_impl &operator =(const unordered_set_impl&);
+ //! movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_set_impl)
typedef table_type implementation_defined;
/// @endcond
@@ -156,6 +154,17 @@
: table_(b_traits, hash_func, equal_func, v_traits)
{ table_.insert_unique(b, e); }
+ //! <b>Effects</b>: to-do
+ //!
+ unordered_set_impl(BOOST_RV_REF(unordered_set_impl) x)
+ : table_(::boost::move(x.table_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ unordered_set_impl& operator=(BOOST_RV_REF(unordered_set_impl) x)
+ { table_ = ::boost::move(x.table_); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_set
//! are not deleted (i.e. no destructors are called).
//!
@@ -1046,6 +1055,7 @@
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value));
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_set)
public:
typedef typename Base::value_traits value_traits;
@@ -1073,6 +1083,13 @@
, const value_traits &v_traits = value_traits())
: Base(b, e, b_traits, hash_func, equal_func, v_traits)
{}
+
+ unordered_set(BOOST_RV_REF(unordered_set) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ unordered_set& operator=(BOOST_RV_REF(unordered_set) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
};
#endif
@@ -1125,13 +1142,8 @@
typedef hashtable_impl<Config> table_type;
/// @endcond
- //! This class is
- //! non-copyable
- unordered_multiset_impl (const unordered_multiset_impl&);
-
- //! This class is
- //! non-assignable
- unordered_multiset_impl &operator =(const unordered_multiset_impl&);
+ //Movable
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_multiset_impl)
typedef table_type implementation_defined;
@@ -1213,6 +1225,17 @@
: table_(b_traits, hash_func, equal_func, v_traits)
{ table_.insert_equal(b, e); }
+ //! <b>Effects</b>: to-do
+ //!
+ unordered_multiset_impl(BOOST_RV_REF(unordered_multiset_impl) x)
+ : table_(::boost::move(x.table_))
+ {}
+
+ //! <b>Effects</b>: to-do
+ //!
+ unordered_multiset_impl& operator=(BOOST_RV_REF(unordered_multiset_impl) x)
+ { table_ = ::boost::move(x.table_); return *this; }
+
//! <b>Effects</b>: Detaches all elements from this. The objects in the unordered_multiset
//! are not deleted (i.e. no destructors are called).
//!
@@ -2045,6 +2068,7 @@
>::type Base;
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename Base::value_traits::value_type, T>::value));
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(unordered_multiset)
public:
typedef typename Base::value_traits value_traits;
@@ -2072,6 +2096,13 @@
, const value_traits &v_traits = value_traits())
: Base(b, e, b_traits, hash_func, equal_func, v_traits)
{}
+
+ unordered_multiset(BOOST_RV_REF(unordered_multiset) x)
+ : Base(::boost::move(static_cast<Base&>(x)))
+ {}
+
+ unordered_multiset& operator=(BOOST_RV_REF(unordered_multiset) x)
+ { this->Base::operator=(::boost::move(static_cast<Base&>(x))); return *this; }
};
#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk