|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73291 - in sandbox/move/boost: container container/detail intrusive intrusive/detail move
From: igaztanaga_at_[hidden]
Date: 2011-07-21 19:05:24
Author: igaztanaga
Date: 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
New Revision: 73291
URL: http://svn.boost.org/trac/boost/changeset/73291
Log:
Updated Container to latest version
Added:
sandbox/move/boost/container/detail/stored_ref.hpp (contents, props changed)
sandbox/move/boost/intrusive/parent_from_member.hpp (contents, props changed)
sandbox/move/boost/move/move_helpers.hpp (contents, props changed)
Text files modified:
sandbox/move/boost/container/container_fwd.hpp | 11
sandbox/move/boost/container/deque.hpp | 637 ++++++++++++++++++++++++++++++--------
sandbox/move/boost/container/detail/adaptive_node_pool_impl.hpp | 222 +++++++------
sandbox/move/boost/container/detail/advanced_insert_int.hpp | 65 ++-
sandbox/move/boost/container/detail/algorithms.hpp | 4
sandbox/move/boost/container/detail/config_begin.hpp | 15
sandbox/move/boost/container/detail/destroyers.hpp | 2
sandbox/move/boost/container/detail/flat_tree.hpp | 76 ++--
sandbox/move/boost/container/detail/iterators.hpp | 84 ++++
sandbox/move/boost/container/detail/math_functions.hpp | 3
sandbox/move/boost/container/detail/mpl.hpp | 3
sandbox/move/boost/container/detail/multiallocation_chain.hpp | 43 +-
sandbox/move/boost/container/detail/node_alloc_holder.hpp | 36 +-
sandbox/move/boost/container/detail/node_pool_impl.hpp | 57 +-
sandbox/move/boost/container/detail/pair.hpp | 204 +++++++++--
sandbox/move/boost/container/detail/preprocessor.hpp | 46 ++
sandbox/move/boost/container/detail/transform_iterator.hpp | 4
sandbox/move/boost/container/detail/tree.hpp | 99 +++--
sandbox/move/boost/container/detail/type_traits.hpp | 41 ++
sandbox/move/boost/container/detail/utilities.hpp | 28
sandbox/move/boost/container/detail/version_type.hpp | 3
sandbox/move/boost/container/detail/workaround.hpp | 4
sandbox/move/boost/container/flat_map.hpp | 70 ++--
sandbox/move/boost/container/flat_set.hpp | 58 +-
sandbox/move/boost/container/list.hpp | 126 +++---
sandbox/move/boost/container/map.hpp | 134 ++++---
sandbox/move/boost/container/set.hpp | 60 +-
sandbox/move/boost/container/slist.hpp | 46 +-
sandbox/move/boost/container/stable_vector.hpp | 595 +++++++++++++++++++++++++++++------
sandbox/move/boost/container/string.hpp | 118 +++---
sandbox/move/boost/container/vector.hpp | 228 ++++++++-----
sandbox/move/boost/intrusive/avl_set.hpp | 52 ++
sandbox/move/boost/intrusive/avltree.hpp | 59 ++
sandbox/move/boost/intrusive/circular_slist_algorithms.hpp | 2
sandbox/move/boost/intrusive/derivation_value_traits.hpp | 12
sandbox/move/boost/intrusive/detail/hashtable_node.hpp | 28 +
sandbox/move/boost/intrusive/detail/mpl.hpp | 57 +--
sandbox/move/boost/intrusive/detail/parent_from_member.hpp | 12
sandbox/move/boost/intrusive/detail/transform_iterator.hpp | 2
sandbox/move/boost/intrusive/detail/tree_node.hpp | 2
sandbox/move/boost/intrusive/detail/utilities.hpp | 101 ++++-
sandbox/move/boost/intrusive/hashtable.hpp | 137 ++++++--
sandbox/move/boost/intrusive/intrusive_fwd.hpp | 83 ++--
sandbox/move/boost/intrusive/list.hpp | 39 +
sandbox/move/boost/intrusive/options.hpp | 20 +
sandbox/move/boost/intrusive/rbtree.hpp | 48 ++
sandbox/move/boost/intrusive/rbtree_algorithms.hpp | 1
sandbox/move/boost/intrusive/set.hpp | 52 ++
sandbox/move/boost/intrusive/sg_set.hpp | 50 ++
sandbox/move/boost/intrusive/sgtree.hpp | 48 ++
sandbox/move/boost/intrusive/slist.hpp | 43 +
sandbox/move/boost/intrusive/splay_set.hpp | 52 ++
sandbox/move/boost/intrusive/splaytree.hpp | 47 ++
sandbox/move/boost/intrusive/treap.hpp | 60 ++
sandbox/move/boost/intrusive/treap_set.hpp | 52 ++
sandbox/move/boost/intrusive/unordered_set.hpp | 61 ++
sandbox/move/boost/intrusive/unordered_set_hook.hpp | 6
sandbox/move/boost/move/move.hpp | 658 ++++++++++++++++++++-------------------
58 files changed, 3286 insertions(+), 1620 deletions(-)
Modified: sandbox/move/boost/container/container_fwd.hpp
==============================================================================
--- sandbox/move/boost/container/container_fwd.hpp (original)
+++ sandbox/move/boost/container/container_fwd.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -32,6 +32,8 @@
}}}
+#ifndef _LIBCPP_VERSION
+
namespace std {
template <class T>
@@ -48,6 +50,15 @@
} //namespace std {
+#else
+
+#include <utility>
+#include <memory>
+#include <functional>
+#include <iosfwd>
+
+#endif
+
/// @endcond
//////////////////////////////////////////////////////////////////////////////
Modified: sandbox/move/boost/container/deque.hpp
==============================================================================
--- sandbox/move/boost/container/deque.hpp (original)
+++ sandbox/move/boost/container/deque.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -25,7 +25,7 @@
#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP
#include <cstddef>
#include <iterator>
-#include <cassert>
+#include <boost/assert.hpp>
#include <memory>
#include <algorithm>
#include <stdexcept>
@@ -35,7 +35,8 @@
#include <boost/type_traits/has_trivial_assign.hpp>
#include <boost/type_traits/has_nothrow_copy.hpp>
#include <boost/type_traits/has_nothrow_assign.hpp>
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
+#include <boost/move/move_helpers.hpp>
#include INCLUDE_BOOST_CONTAINER_DETAIL_ADVANCED_INSERT_INT_HPP
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -82,7 +83,8 @@
typedef typename Alloc::const_pointer val_alloc_cptr;
typedef typename Alloc::reference val_alloc_ref;
typedef typename Alloc::const_reference val_alloc_cref;
- typedef typename Alloc::value_type val_alloc_diff;
+ typedef typename Alloc::difference_type val_alloc_diff;
+ typedef typename Alloc::size_type val_alloc_size;
typedef typename Alloc::template rebind
<typename Alloc::pointer>::other ptr_alloc_t;
typedef typename ptr_alloc_t::value_type ptr_alloc_val;
@@ -93,6 +95,7 @@
typedef typename Alloc::template
rebind<T>::other allocator_type;
typedef allocator_type stored_allocator_type;
+ typedef val_alloc_size size_type;
protected:
@@ -100,7 +103,7 @@
typedef typename Alloc::template
rebind<typename Alloc::pointer>::other map_allocator_type;
- static std::size_t s_buffer_size() { return deque_buf_size(sizeof(T)); }
+ static size_type s_buffer_size() { return deque_buf_size(sizeof(T)); }
val_alloc_ptr priv_allocate_node()
{ return this->alloc().allocate(s_buffer_size()); }
@@ -108,10 +111,10 @@
void priv_deallocate_node(val_alloc_ptr p)
{ this->alloc().deallocate(p, s_buffer_size()); }
- ptr_alloc_ptr priv_allocate_map(std::size_t n)
+ ptr_alloc_ptr priv_allocate_map(size_type n)
{ return this->ptr_alloc().allocate(n); }
- void priv_deallocate_map(ptr_alloc_ptr p, std::size_t n)
+ void priv_deallocate_map(ptr_alloc_ptr p, size_type n)
{ this->ptr_alloc().deallocate(p, n); }
public:
@@ -145,14 +148,13 @@
val_alloc_cptr, val_alloc_cref>
{
public:
- static std::size_t s_buffer_size() { return deque_base<T, Alloc>::s_buffer_size(); }
+ static size_type s_buffer_size() { return deque_base<T, Alloc>::s_buffer_size(); }
typedef std::random_access_iterator_tag iterator_category;
typedef val_alloc_val value_type;
typedef val_alloc_cptr pointer;
typedef val_alloc_cref reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef val_alloc_diff difference_type;
typedef ptr_alloc_ptr index_pointer;
typedef const_iterator self_t;
@@ -282,7 +284,7 @@
this->m_last = this->m_first + difference_type(this->s_buffer_size());
}
- friend const_iterator operator+(std::ptrdiff_t n, const const_iterator& x)
+ friend const_iterator operator+(difference_type n, const const_iterator& x)
{ return x + n; }
};
@@ -294,8 +296,7 @@
typedef val_alloc_val value_type;
typedef val_alloc_ptr pointer;
typedef val_alloc_ref reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
+ typedef val_alloc_diff difference_type;
typedef ptr_alloc_ptr index_pointer;
typedef const_iterator self_t;
@@ -351,7 +352,7 @@
{ return static_cast<const const_iterator&>(*this) - right; }
};
- deque_base(const allocator_type& a, std::size_t num_elements)
+ deque_base(const allocator_type& a, size_type num_elements)
: members_(a)
{ this->priv_initialize_map(num_elements); }
@@ -372,12 +373,12 @@
protected:
- void priv_initialize_map(std::size_t num_elements)
+ void priv_initialize_map(size_type num_elements)
{
// if(num_elements){
- std::size_t num_nodes = num_elements / s_buffer_size() + 1;
+ size_type num_nodes = num_elements / s_buffer_size() + 1;
- this->members_.m_map_size = containers_detail::max_value((std::size_t) InitialMapSize, num_nodes + 2);
+ this->members_.m_map_size = containers_detail::max_value((size_type) InitialMapSize, num_nodes + 2);
this->members_.m_map = this->priv_allocate_map(this->members_.m_map_size);
ptr_alloc_ptr nstart = this->members_.m_map + (this->members_.m_map_size - num_nodes) / 2;
@@ -422,6 +423,18 @@
this->priv_deallocate_node(*n);
}
+ void priv_clear_map()
+ {
+ if (this->members_.m_map) {
+ this->priv_destroy_nodes(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1);
+ this->priv_deallocate_map(this->members_.m_map, this->members_.m_map_size);
+ this->members_.m_map = 0;
+ this->members_.m_map_size = 0;
+ this->members_.m_start = iterator();
+ this->members_.m_finish = this->members_.m_start;
+ }
+ }
+
enum { InitialMapSize = 8 };
protected:
@@ -436,7 +449,7 @@
{}
ptr_alloc_ptr m_map;
- std::size_t m_map_size;
+ typename allocator_type::size_type m_map_size;
iterator m_start;
iterator m_finish;
} members_;
@@ -461,8 +474,6 @@
class deque : protected deque_base<T, Alloc>
{
/// @cond
- typedef typename containers_detail::
- move_const_ref_type<T>::type insert_const_ref_type;
typedef deque_base<T, Alloc> Base;
public: // Basic types
@@ -471,6 +482,9 @@
typedef typename Alloc::const_pointer val_alloc_cptr;
typedef typename Alloc::reference val_alloc_ref;
typedef typename Alloc::const_reference val_alloc_cref;
+ typedef typename Alloc::size_type val_alloc_size;
+ typedef typename Alloc::difference_type val_alloc_diff;
+
typedef typename Alloc::template
rebind<val_alloc_ptr>::other ptr_alloc_t;
typedef typename ptr_alloc_t::value_type ptr_alloc_val;
@@ -485,9 +499,8 @@
typedef val_alloc_cptr const_pointer;
typedef val_alloc_ref reference;
typedef val_alloc_cref const_reference;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
-
+ typedef val_alloc_size size_type;
+ typedef val_alloc_diff difference_type;
typedef typename Base::allocator_type allocator_type;
public: // Iterators
@@ -499,93 +512,271 @@
/// @cond
private: // Internal typedefs
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(deque)
+ BOOST_COPYABLE_AND_MOVABLE(deque)
typedef ptr_alloc_ptr index_pointer;
- static std::size_t s_buffer_size()
+ static size_type s_buffer_size()
{ return Base::s_buffer_size(); }
typedef containers_detail::advanced_insert_aux_int<value_type, iterator> advanced_insert_aux_int_t;
typedef repeat_iterator<T, difference_type> r_iterator;
- typedef BOOST_CONTAINER_MOVE_NAMESPACE::move_iterator<r_iterator> move_it;
+ typedef boost::move_iterator<r_iterator> move_it;
/// @endcond
+ //! <b>Effects</b>: Returns a copy of the internal allocator.
+ //!
+ //! <b>Throws</b>: If allocator's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant.
allocator_type get_allocator() const { return Base::alloc(); }
public: // Basic accessors
+ //! <b>Effects</b>: Returns an iterator to the first element contained in the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
iterator begin()
{ return this->members_.m_start; }
+ //! <b>Effects</b>: Returns an iterator to the end of the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
iterator end()
{ return this->members_.m_finish; }
+ //! <b>Effects</b>: Returns a const_iterator to the first element contained in the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_iterator begin() const
{ return this->members_.m_start; }
+ //! <b>Effects</b>: Returns a const_iterator to the end of the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_iterator end() const
{ return this->members_.m_finish; }
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
reverse_iterator rbegin()
{ return reverse_iterator(this->members_.m_finish); }
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
+ //! of the reversed deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
reverse_iterator rend()
{ return reverse_iterator(this->members_.m_start); }
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reverse_iterator rbegin() const
{ return const_reverse_iterator(this->members_.m_finish); }
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
+ //! of the reversed deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reverse_iterator rend() const
{ return const_reverse_iterator(this->members_.m_start); }
+ //! <b>Effects</b>: Returns a const_iterator to the first element contained in the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_iterator cbegin() const
{ return this->members_.m_start; }
+ //! <b>Effects</b>: Returns a const_iterator to the end of the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_iterator cend() const
{ return this->members_.m_finish; }
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reverse_iterator crbegin() const
{ return const_reverse_iterator(this->members_.m_finish); }
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
+ //! of the reversed deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reverse_iterator crend() const
{ return const_reverse_iterator(this->members_.m_start); }
+ //! <b>Requires</b>: size() < n.
+ //!
+ //! <b>Effects</b>: Returns a reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
reference operator[](size_type n)
{ return this->members_.m_start[difference_type(n)]; }
+ //! <b>Requires</b>: size() < n.
+ //!
+ //! <b>Effects</b>: Returns a const reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reference operator[](size_type n) const
{ return this->members_.m_start[difference_type(n)]; }
- void priv_range_check(size_type n) const
- { if (n >= this->size()) BOOST_RETHROW std::out_of_range("deque"); }
-
+ //! <b>Requires</b>: size() < n.
+ //!
+ //! <b>Effects</b>: Returns a reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: std::range_error if n >= size()
+ //!
+ //! <b>Complexity</b>: Constant.
reference at(size_type n)
{ this->priv_range_check(n); return (*this)[n]; }
+ //! <b>Requires</b>: size() < n.
+ //!
+ //! <b>Effects</b>: Returns a const reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: std::range_error if n >= size()
+ //!
+ //! <b>Complexity</b>: Constant.
const_reference at(size_type n) const
{ this->priv_range_check(n); return (*this)[n]; }
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a reference to the first
+ //! element of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
reference front() { return *this->members_.m_start; }
- reference back() { return *(end()-1); }
-
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a const reference to the first element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reference front() const
{ return *this->members_.m_start; }
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a reference to the last
+ //! element of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ reference back() { return *(end()-1); }
+
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a const reference to the last
+ //! element of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reference back() const { return *(cend()-1); }
+ //! <b>Effects</b>: Returns the number of the elements contained in the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
size_type size() const
{ return this->members_.m_finish - this->members_.m_start; }
+ //! <b>Effects</b>: Returns the largest possible size of the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
size_type max_size() const
{ return this->alloc().max_size(); }
+ //! <b>Effects</b>: Returns true if the deque contains no elements.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
bool empty() const
{ return this->members_.m_finish == this->members_.m_start; }
+ //! <b>Effects</b>: Constructs a deque taking the allocator as parameter.
+ //!
+ //! <b>Throws</b>: If allocator_type's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant.
explicit deque(const allocator_type& a = allocator_type())
: Base(a)
{}
+ //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a
+ //! and inserts n default contructed values.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor or copy constructor
+ //! throws or T's default or copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
+ explicit deque(size_type n) : Base(allocator_type(), n)
+ { this->resize(n); }
+
+ //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a
+ //! and inserts n copies of value.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor or copy constructor
+ //! throws or T's default or copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
+ deque(size_type n, const value_type& value,
+ const allocator_type& a = allocator_type()) : Base(a, n)
+ { this->priv_fill_initialize(value); }
+
+ //! <b>Effects</b>: Copy constructs a deque.
+ //!
+ //! <b>Postcondition</b>: x == *this.
+ //!
+ //! <b>Complexity</b>: Linear to the elements x contains.
deque(const deque& x)
: Base(x.alloc())
{
@@ -595,34 +786,52 @@
}
}
- deque(BOOST_MOVE_MACRO_RV_REF(deque) mx)
+ //! <b>Effects</b>: Move constructor. Moves mx's resources to *this.
+ //!
+ //! <b>Throws</b>: If allocator_type's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant.
+ deque(BOOST_RV_REF(deque) mx)
: Base(mx.alloc())
{ this->swap(mx); }
- deque(size_type n, const value_type& value,
- const allocator_type& a = allocator_type()) : Base(a, n)
- { this->priv_fill_initialize(value); }
-
- explicit deque(size_type n) : Base(allocator_type(), n)
- { this->resize(n); }
-
- // Check whether it's an integral type. If so, it's not an iterator.
+ //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a
+ //! and inserts a copy of the range [first, last) in the deque.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor or copy constructor
+ //! throws or T's constructor taking an dereferenced InIt throws.
+ //!
+ //! <b>Complexity</b>: Linear to the range [first, last).
template <class InpIt>
deque(InpIt first, InpIt last, const allocator_type& a = allocator_type())
: Base(a)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InpIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
this->priv_initialize_dispatch(first, last, Result());
}
+ //! <b>Effects</b>: Destroys the deque. All stored values are destroyed
+ //! and used memory is deallocated.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements.
~deque()
{
priv_destroy_range(this->members_.m_start, this->members_.m_finish);
}
- deque& operator= (BOOST_MOVE_MACRO_COPY_ASSIGN_REF(deque) x)
+ //! <b>Effects</b>: Makes *this contain the same elements as x.
+ //!
+ //! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
+ //! of each of x's elements.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in x.
+ deque& operator= (BOOST_COPY_ASSIGN_REF(deque) x)
{
const size_type len = size();
if (&x != this) {
@@ -635,15 +844,30 @@
}
}
return *this;
- }
+ }
- deque& operator= (BOOST_MOVE_MACRO_RV_REF(deque) x)
+ //! <b>Effects</b>: Move assignment. All mx's values are transferred to *this.
+ //!
+ //! <b>Postcondition</b>: x.empty(). *this contains a the elements x had
+ //! before the function.
+ //!
+ //! <b>Throws</b>: If allocator_type's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear.
+ deque& operator= (BOOST_RV_REF(deque) x)
{
this->clear();
this->swap(x);
return *this;
}
+ //! <b>Effects</b>: Swaps the contents of *this and x.
+ //! If this->allocator_type() != x.allocator_type()
+ //! allocators are also swapped.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
void swap(deque &x)
{
std::swap(this->members_.m_start, x.members_.m_start);
@@ -652,62 +876,74 @@
std::swap(this->members_.m_map_size, x.members_.m_map_size);
}
+ //! <b>Effects</b>: Assigns the n copies of val to *this.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
void assign(size_type n, const T& val)
{ this->priv_fill_assign(n, val); }
+ //! <b>Effects</b>: Assigns the the range [first, last) to *this.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's constructor from dereferencing InpIt throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
template <class InpIt>
void assign(InpIt first, InpIt last)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InpIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
this->priv_assign_dispatch(first, last, Result());
}
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- void push_back(T &x) { push_back(const_cast<const T &>(x)); }
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts a copy of x at the end of the deque.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_back(const T &x);
- template<class U>
- void push_back(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { return priv_push_back(u); }
+ //! <b>Effects</b>: Constructs a new element in the end of the deque
+ //! and moves the resources of mx to this new element.
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_back(T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
#endif
- void push_back(insert_const_ref_type t)
- { return priv_push_back(t); }
-
- void push_back(BOOST_MOVE_MACRO_RV_REF(value_type) t)
- {
- if(this->priv_push_back_simple_available()){
- new(this->priv_push_back_simple_pos())value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(t));
- this->priv_push_back_simple_commit();
- }
- else{
- this->priv_insert_aux(cend(), move_it(r_iterator(t, 1)), move_it(r_iterator()));
- }
- }
-
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- void push_front(T &x) { push_front(const_cast<const T &>(x)); }
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts a copy of x at the front of the deque.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_front(const T &x);
- template<class U>
- void push_front(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { return priv_push_front(u); }
+ //! <b>Effects</b>: Constructs a new element in the front of the deque
+ //! and moves the resources of mx to this new element.
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_front(T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
#endif
- void push_front(insert_const_ref_type t)
- { return priv_push_front(t); }
-
- void push_front(BOOST_MOVE_MACRO_RV_REF(value_type) t)
- {
- if(this->priv_push_front_simple_available()){
- new(this->priv_push_front_simple_pos())value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(t));
- this->priv_push_front_simple_commit();
- }
- else{
- this->priv_insert_aux(cbegin(), move_it(r_iterator(t, 1)), move_it(r_iterator()));
- }
- }
-
+ //! <b>Effects</b>: Removes the last element from the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant time.
void pop_back()
{
if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) {
@@ -718,6 +954,11 @@
this->priv_pop_back_aux();
}
+ //! <b>Effects</b>: Removes the first element from the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant time.
void pop_front()
{
if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) {
@@ -728,94 +969,124 @@
this->priv_pop_front_aux();
}
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- iterator insert(const_iterator position, T &x)
- { return this->insert(position, const_cast<const T &>(x)); }
-
- template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { return this->priv_insert(position, u); }
- #endif
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
- iterator insert(const_iterator position, insert_const_ref_type x)
- { return this->priv_insert(position, x); }
+ //! <b>Requires</b>: position must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert a copy of x before position.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or x's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: If position is end(), amortized constant time
+ //! Linear time otherwise.
+ iterator insert(const_iterator position, const T &x);
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) mx)
- {
- if (position == cbegin()) {
- this->push_front(BOOST_CONTAINER_MOVE_NAMESPACE::move(mx));
- return begin();
- }
- else if (position == cend()) {
- this->push_back(BOOST_CONTAINER_MOVE_NAMESPACE::move(mx));
- return(end()-1);
- }
- else {
- //Just call more general insert(pos, size, value) and return iterator
- size_type n = position - begin();
- this->priv_insert_aux(position, move_it(r_iterator(mx, 1)), move_it(r_iterator()));
- return iterator(this->begin() + n);
- }
- }
+ //! <b>Requires</b>: position must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert a new element before position with mx's resources.
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: If position is end(), amortized constant time
+ //! Linear time otherwise.
+ iterator insert(const_iterator position, T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+ #endif
+ //! <b>Requires</b>: pos must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert n copies of x before pos.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
void insert(const_iterator pos, size_type n, const value_type& x)
{ this->priv_fill_insert(pos, n, x); }
- // Check whether it's an integral type. If so, it's not an iterator.
+ //! <b>Requires</b>: pos must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert a copy of the [first, last) range before pos.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, T's constructor from a
+ //! dereferenced InpIt throws or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to std::distance [first, last).
template <class InpIt>
void insert(const_iterator pos, InpIt first, InpIt last)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InpIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
this->priv_insert_dispatch(pos, first, last, Result());
}
#if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts an object of type T constructed with
+ //! std::forward<Args>(args)... in the end of the deque.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time
template <class... Args>
void emplace_back(Args&&... args)
{
if(this->priv_push_back_simple_available()){
- new(this->priv_push_back_simple_pos())value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ new(this->priv_push_back_simple_pos())value_type(boost::forward<Args>(args)...);
this->priv_push_back_simple_commit();
}
else{
typedef containers_detail::advanced_insert_aux_emplace<T, iterator, Args...> type;
- type &&proxy = type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ type &&proxy = type(boost::forward<Args>(args)...);
this->priv_insert_aux_impl(this->cend(), 1, proxy);
}
}
+ //! <b>Effects</b>: Inserts an object of type T constructed with
+ //! std::forward<Args>(args)... in the beginning of the deque.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time
template <class... Args>
void emplace_front(Args&&... args)
{
if(this->priv_push_front_simple_available()){
- new(this->priv_push_front_simple_pos())value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ new(this->priv_push_front_simple_pos())value_type(boost::forward<Args>(args)...);
this->priv_push_front_simple_commit();
}
else{
typedef containers_detail::advanced_insert_aux_emplace<T, iterator, Args...> type;
- type &&proxy = type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ type &&proxy = type(boost::forward<Args>(args)...);
this->priv_insert_aux_impl(this->cbegin(), 1, proxy);
}
}
+ //! <b>Requires</b>: position must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Inserts an object of type T constructed with
+ //! std::forward<Args>(args)... before position
+ //!
+ //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
+ //!
+ //! <b>Complexity</b>: If position is end(), amortized constant time
+ //! Linear time otherwise.
template <class... Args>
iterator emplace(const_iterator p, Args&&... args)
{
if(p == this->cbegin()){
- this->emplace_front(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ this->emplace_front(boost::forward<Args>(args)...);
return this->begin();
}
else if(p == this->cend()){
- this->emplace_back(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ this->emplace_back(boost::forward<Args>(args)...);
return (this->end()-1);
}
else{
size_type n = p - this->cbegin();
typedef containers_detail::advanced_insert_aux_emplace<T, iterator, Args...> type;
- type &&proxy = type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ type &&proxy = type(boost::forward<Args>(args)...);
this->priv_insert_aux_impl(p, 1, proxy);
return iterator(this->begin() + n);
}
@@ -926,6 +1197,12 @@
#endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ //! <b>Effects</b>: Inserts or erases elements at the end such that
+ //! the size becomes n. New elements are copy constructed from x.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to the difference between size() and new_size.
void resize(size_type new_size, const value_type& x)
{
const size_type len = size();
@@ -935,6 +1212,12 @@
this->insert(this->members_.m_finish, new_size - len, x);
}
+ //! <b>Effects</b>: Inserts or erases elements at the end such that
+ //! the size becomes n. New elements are default constructed.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to the difference between size() and new_size.
void resize(size_type new_size)
{
const size_type len = size();
@@ -947,22 +1230,38 @@
}
}
+ //! <b>Effects</b>: Erases the element at position pos.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the elements between pos and the
+ //! last element (if pos is near the end) or the first element
+ //! if(pos is near the beginning).
+ //! Constant if pos is the first or the last element.
iterator erase(const_iterator pos)
{
const_iterator next = pos;
++next;
difference_type index = pos - this->members_.m_start;
if (size_type(index) < (this->size() >> 1)) {
- BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(begin(), iterator(pos), iterator(next));
+ boost::move_backward(begin(), iterator(pos), iterator(next));
pop_front();
}
else {
- BOOST_CONTAINER_MOVE_NAMESPACE::move(iterator(next), end(), iterator(pos));
+ boost::move(iterator(next), end(), iterator(pos));
pop_back();
}
return this->members_.m_start + index;
}
+ //! <b>Effects</b>: Erases the elements pointed by [first, last).
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the distance between first and
+ //! last plus the elements between pos and the
+ //! last element (if pos is near the end) or the first element
+ //! if(pos is near the beginning).
iterator erase(const_iterator first, const_iterator last)
{
if (first == this->members_.m_start && last == this->members_.m_finish) {
@@ -973,15 +1272,15 @@
difference_type n = last - first;
difference_type elems_before = first - this->members_.m_start;
if (elems_before < static_cast<difference_type>(this->size() - n) - elems_before) {
- BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(begin(), iterator(first), iterator(last));
+ boost::move_backward(begin(), iterator(first), iterator(last));
iterator new_start = this->members_.m_start + n;
if(!Base::traits_t::trivial_dctr_after_move)
this->priv_destroy_range(this->members_.m_start, new_start);
- this->priv_destroy_nodes(new_start.m_node, this->members_.m_start.m_node);
+ this->priv_destroy_nodes(this->members_.m_start.m_node, new_start.m_node);
this->members_.m_start = new_start;
}
else {
- BOOST_CONTAINER_MOVE_NAMESPACE::move(iterator(last), end(), iterator(first));
+ boost::move(iterator(last), end(), iterator(first));
iterator new_finish = this->members_.m_finish - n;
if(!Base::traits_t::trivial_dctr_after_move)
this->priv_destroy_range(new_finish, this->members_.m_finish);
@@ -992,6 +1291,11 @@
}
}
+ //! <b>Effects</b>: Erases all the elements of the deque.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the deque.
void clear()
{
for (index_pointer node = this->members_.m_start.m_node + 1;
@@ -1012,9 +1316,29 @@
this->members_.m_finish = this->members_.m_start;
}
+ //! <b>Effects</b>: Tries to deallocate the excess of memory created
+ //! with previous allocations. The size of the deque is unchanged
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: Constant.
+ void shrink_to_fit()
+ {
+ //This deque implementation already
+ //deallocates excess nodes when erasing
+ //so there is nothing to do except for
+ //empty deque
+ if(this->empty()){
+ this->priv_clear_map();
+ }
+ }
+
/// @cond
private:
+ void priv_range_check(size_type n) const
+ { if (n >= this->size()) BOOST_RETHROW std::out_of_range("deque"); }
+
iterator priv_insert(const_iterator position, const value_type &x)
{
if (position == cbegin()){
@@ -1032,6 +1356,24 @@
}
}
+ iterator priv_insert(const_iterator position, BOOST_RV_REF(value_type) mx)
+ {
+ if (position == cbegin()) {
+ this->push_front(boost::move(mx));
+ return begin();
+ }
+ else if (position == cend()) {
+ this->push_back(boost::move(mx));
+ return(end()-1);
+ }
+ else {
+ //Just call more general insert(pos, size, value) and return iterator
+ size_type n = position - begin();
+ this->priv_insert_aux(position, move_it(r_iterator(mx, 1)), move_it(r_iterator()));
+ return iterator(this->begin() + n);
+ }
+ }
+
void priv_push_front(const value_type &t)
{
if(this->priv_push_front_simple_available()){
@@ -1043,6 +1385,17 @@
}
}
+ void priv_push_front(BOOST_RV_REF(value_type) t)
+ {
+ if(this->priv_push_front_simple_available()){
+ new(this->priv_push_front_simple_pos())value_type(boost::move(t));
+ this->priv_push_front_simple_commit();
+ }
+ else{
+ this->priv_insert_aux(cbegin(), move_it(r_iterator(t, 1)), move_it(r_iterator()));
+ }
+ }
+
void priv_push_back(const value_type &t)
{
if(this->priv_push_back_simple_available()){
@@ -1054,6 +1407,16 @@
}
}
+ void priv_push_back(BOOST_RV_REF(T) t)
+ {
+ if(this->priv_push_back_simple_available()){
+ new(this->priv_push_back_simple_pos())value_type(boost::move(t));
+ this->priv_push_back_simple_commit();
+ }
+ else{
+ this->priv_insert_aux(cend(), move_it(r_iterator(t, 1)), move_it(r_iterator()));
+ }
+ }
bool priv_push_back_simple_available() const
{
@@ -1087,7 +1450,7 @@
void priv_insert_aux(const_iterator pos, InpIt first, InpIt last, std::input_iterator_tag)
{
for(;first != last; ++first){
- this->insert(pos, BOOST_CONTAINER_MOVE_NAMESPACE::move(value_type(*first)));
+ this->insert(pos, boost::move(value_type(*first)));
}
}
@@ -1139,7 +1502,7 @@
template <class Integer>
void priv_assign_dispatch(Integer n, Integer val, containers_detail::true_)
- { this->priv_fill_assign((size_type) n, val); }
+ { this->priv_fill_assign((size_type) n, (value_type)val); }
template <class InpIt>
void priv_assign_dispatch(InpIt first, InpIt last, containers_detail::false_)
@@ -1176,7 +1539,7 @@
template <class Integer>
void priv_insert_dispatch(const_iterator pos, Integer n, Integer x, containers_detail::true_)
- { this->priv_fill_insert(pos, (size_type) n, x); }
+ { this->priv_fill_insert(pos, (size_type) n, (value_type)x); }
template <class InpIt>
void priv_insert_dispatch(const_iterator pos,InpIt first, InpIt last, containers_detail::false_)
@@ -1215,9 +1578,9 @@
pos = this->members_.m_start + elemsbefore;
if (elemsbefore >= difference_type(n)) {
iterator start_n = this->members_.m_start + difference_type(n);
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(this->members_.m_start, start_n, new_start);
+ ::boost::uninitialized_move(this->members_.m_start, start_n, new_start);
this->members_.m_start = new_start;
- BOOST_CONTAINER_MOVE_NAMESPACE::move(start_n, pos, old_start);
+ boost::move(start_n, pos, old_start);
interf.copy_all_to(pos - difference_type(n));
}
else {
@@ -1225,7 +1588,7 @@
iterator mid_start = old_start - mid_count;
interf.uninitialized_copy_some_and_update(mid_start, mid_count, true);
this->members_.m_start = mid_start;
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_start, pos, new_start);
+ ::boost::uninitialized_move(old_start, pos, new_start);
this->members_.m_start = new_start;
interf.copy_all_to(old_start);
}
@@ -1238,15 +1601,15 @@
pos = this->members_.m_finish - elemsafter;
if (elemsafter >= difference_type(n)) {
iterator finish_n = this->members_.m_finish - difference_type(n);
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(finish_n, this->members_.m_finish, this->members_.m_finish);
+ ::boost::uninitialized_move(finish_n, this->members_.m_finish, this->members_.m_finish);
this->members_.m_finish = new_finish;
- BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(pos, finish_n, old_finish);
+ boost::move_backward(pos, finish_n, old_finish);
interf.copy_all_to(pos);
}
else {
interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
this->members_.m_finish += n-elemsafter;
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(pos, old_finish, this->members_.m_finish);
+ ::boost::uninitialized_move(pos, old_finish, this->members_.m_finish);
this->members_.m_finish = new_finish;
interf.copy_all_to(pos);
}
@@ -1306,10 +1669,10 @@
++cur_node) {
FwdIt mid = first;
std::advance(mid, this->s_buffer_size());
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first, mid, *cur_node);
+ ::boost::uninitialized_copy_or_move(first, mid, *cur_node);
first = mid;
}
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first, last, this->members_.m_finish.m_first);
+ ::boost::uninitialized_copy_or_move(first, last, this->members_.m_finish.m_first);
}
BOOST_CATCH(...){
this->priv_destroy_range(this->members_.m_start, iterator(*cur_node, cur_node));
@@ -1400,9 +1763,9 @@
new_nstart = this->members_.m_map + (this->members_.m_map_size - new_num_nodes) / 2
+ (add_at_front ? nodes_to_add : 0);
if (new_nstart < this->members_.m_start.m_node)
- BOOST_CONTAINER_MOVE_NAMESPACE::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart);
+ boost::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart);
else
- BOOST_CONTAINER_MOVE_NAMESPACE::move_backward
+ boost::move_backward
(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart + old_num_nodes);
}
else {
@@ -1412,7 +1775,7 @@
index_pointer new_map = this->priv_allocate_map(new_map_size);
new_nstart = new_map + (new_map_size - new_num_nodes) / 2
+ (add_at_front ? nodes_to_add : 0);
- BOOST_CONTAINER_MOVE_NAMESPACE::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart);
+ boost::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart);
this->priv_deallocate_map(this->members_.m_map, this->members_.m_map_size);
this->members_.m_map = new_map;
Modified: sandbox/move/boost/container/detail/adaptive_node_pool_impl.hpp
==============================================================================
--- sandbox/move/boost/container/detail/adaptive_node_pool_impl.hpp (original)
+++ sandbox/move/boost/container/detail/adaptive_node_pool_impl.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -26,22 +26,23 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_POOL_COMMON_HPP
-#include <cassert>
+#include <boost/assert.hpp>
#include <cstddef>
namespace boost {
namespace container {
namespace containers_detail {
-struct hdr_offset_holder
+template<class size_type>
+struct hdr_offset_holder_t
{
- hdr_offset_holder(std::size_t offset = 0)
+ hdr_offset_holder_t(size_type offset = 0)
: hdr_offset(offset)
{}
- std::size_t hdr_offset;
+ size_type hdr_offset;
};
-template<class VoidPointer>
+template<class VoidPointer, class SizeType>
struct adaptive_pool_types
{
typedef VoidPointer void_pointer;
@@ -50,6 +51,8 @@
, bi::optimize_size<true>
, bi::constant_time_size<false>
, bi::link_mode<bi::normal_link> >::type multiset_hook_t;
+
+ typedef hdr_offset_holder_t<SizeType> hdr_offset_holder;
struct block_info_t
:
@@ -69,28 +72,31 @@
const bool is_equal = l.free_nodes.size() == r.free_nodes.size();
return is_less || (is_equal && (&l < &r));
}
+
+ friend bool operator ==(const block_info_t &l, const block_info_t &r)
+ { return &l == &r; }
};
typedef typename bi::make_multiset
<block_info_t, bi::base_hook<multiset_hook_t> >::type block_multiset_t;
};
-
-inline std::size_t calculate_alignment
- ( std::size_t overhead_percent, std::size_t real_node_size
- , std::size_t hdr_size, std::size_t hdr_offset_size, std::size_t payload_per_allocation)
+template<class size_type>
+inline size_type calculate_alignment
+ ( size_type overhead_percent, size_type real_node_size
+ , size_type hdr_size, size_type hdr_offset_size, size_type payload_per_allocation)
{
//to-do: handle real_node_size != node_size
- const std::size_t divisor = overhead_percent*real_node_size;
- const std::size_t dividend = hdr_offset_size*100;
- std::size_t elements_per_subblock = (dividend - 1)/divisor + 1;
- std::size_t candidate_power_of_2 =
+ const size_type divisor = overhead_percent*real_node_size;
+ const size_type dividend = hdr_offset_size*100;
+ size_type elements_per_subblock = (dividend - 1)/divisor + 1;
+ size_type candidate_power_of_2 =
upper_power_of_2(elements_per_subblock*real_node_size + hdr_offset_size);
bool overhead_satisfied = false;
//Now calculate the wors-case overhead for a subblock
- const std::size_t max_subblock_overhead = hdr_size + payload_per_allocation;
+ const size_type max_subblock_overhead = hdr_size + payload_per_allocation;
while(!overhead_satisfied){
elements_per_subblock = (candidate_power_of_2 - max_subblock_overhead)/real_node_size;
- const std::size_t overhead_size = candidate_power_of_2 - elements_per_subblock*real_node_size;
+ const size_type overhead_size = candidate_power_of_2 - elements_per_subblock*real_node_size;
if(overhead_size*100/candidate_power_of_2 < overhead_percent){
overhead_satisfied = true;
}
@@ -101,22 +107,23 @@
return candidate_power_of_2;
}
+template<class size_type>
inline void calculate_num_subblocks
- (std::size_t alignment, std::size_t real_node_size, std::size_t elements_per_block
- , std::size_t &num_subblocks, std::size_t &real_num_node, std::size_t overhead_percent
- , std::size_t hdr_size, std::size_t hdr_offset_size, std::size_t payload_per_allocation)
+ (size_type alignment, size_type real_node_size, size_type elements_per_block
+ , size_type &num_subblocks, size_type &real_num_node, size_type overhead_percent
+ , size_type hdr_size, size_type hdr_offset_size, size_type payload_per_allocation)
{
- std::size_t elements_per_subblock = (alignment - hdr_offset_size)/real_node_size;
- std::size_t possible_num_subblock = (elements_per_block - 1)/elements_per_subblock + 1;
- std::size_t hdr_subblock_elements = (alignment - hdr_size - payload_per_allocation)/real_node_size;
+ size_type elements_per_subblock = (alignment - hdr_offset_size)/real_node_size;
+ size_type possible_num_subblock = (elements_per_block - 1)/elements_per_subblock + 1;
+ size_type hdr_subblock_elements = (alignment - hdr_size - payload_per_allocation)/real_node_size;
while(((possible_num_subblock-1)*elements_per_subblock + hdr_subblock_elements) < elements_per_block){
++possible_num_subblock;
}
elements_per_subblock = (alignment - hdr_offset_size)/real_node_size;
bool overhead_satisfied = false;
while(!overhead_satisfied){
- const std::size_t total_data = (elements_per_subblock*(possible_num_subblock-1) + hdr_subblock_elements)*real_node_size;
- const std::size_t total_size = alignment*possible_num_subblock;
+ const size_type total_data = (elements_per_subblock*(possible_num_subblock-1) + hdr_subblock_elements)*real_node_size;
+ const size_type total_size = alignment*possible_num_subblock;
if((total_size - total_data)*100/total_size < overhead_percent){
overhead_satisfied = true;
}
@@ -138,7 +145,8 @@
typedef private_adaptive_node_pool_impl this_type;
typedef typename SegmentManagerBase::void_pointer void_pointer;
- static const std::size_t PayloadPerAllocation = SegmentManagerBase::PayloadPerAllocation;
+ static const typename SegmentManagerBase::
+ size_type PayloadPerAllocation = SegmentManagerBase::PayloadPerAllocation;
typedef bool_<AlignOnly> IsAlignOnly;
typedef true_ AlignOnlyTrue;
typedef false_ AlignOnlyFalse;
@@ -147,15 +155,17 @@
typedef typename node_slist<void_pointer>::node_t node_t;
typedef typename node_slist<void_pointer>::node_slist_t free_nodes_t;
typedef typename SegmentManagerBase::multiallocation_chain multiallocation_chain;
+ typedef typename SegmentManagerBase::size_type size_type;
private:
- typedef typename adaptive_pool_types<void_pointer>::block_info_t block_info_t;
- typedef typename adaptive_pool_types<void_pointer>::block_multiset_t block_multiset_t;
- typedef typename block_multiset_t::iterator block_iterator;
-
- static const std::size_t MaxAlign = alignment_of<node_t>::value;
- static const std::size_t HdrSize = ((sizeof(block_info_t)-1)/MaxAlign+1)*MaxAlign;
- static const std::size_t HdrOffsetSize = ((sizeof(hdr_offset_holder)-1)/MaxAlign+1)*MaxAlign;
+ typedef typename adaptive_pool_types<void_pointer, size_type>::block_info_t block_info_t;
+ typedef typename adaptive_pool_types<void_pointer, size_type>::block_multiset_t block_multiset_t;
+ typedef typename block_multiset_t::iterator block_iterator;
+ typedef typename adaptive_pool_types<void_pointer, size_type>::hdr_offset_holder hdr_offset_holder;
+
+ static const size_type MaxAlign = alignment_of<node_t>::value;
+ static const size_type HdrSize = ((sizeof(block_info_t)-1)/MaxAlign+1)*MaxAlign;
+ static const size_type HdrOffsetSize = ((sizeof(hdr_offset_holder)-1)/MaxAlign+1)*MaxAlign;
public:
@@ -165,20 +175,20 @@
//!Constructor from a segment manager. Never throws
private_adaptive_node_pool_impl
( segment_manager_base_type *segment_mngr_base
- , std::size_t node_size
- , std::size_t nodes_per_block
- , std::size_t max_free_blocks
+ , size_type node_size
+ , size_type nodes_per_block
+ , size_type max_free_blocks
, unsigned char overhead_percent
)
: m_max_free_blocks(max_free_blocks)
- , m_real_node_size(lcm(node_size, std::size_t(alignment_of<node_t>::value)))
+ , m_real_node_size(lcm(node_size, size_type(alignment_of<node_t>::value)))
//Round the size to a power of two value.
//This is the total memory size (including payload) that we want to
//allocate from the general-purpose allocator
, m_real_block_alignment
(AlignOnly ?
upper_power_of_2(HdrSize + m_real_node_size*nodes_per_block) :
- calculate_alignment( overhead_percent, m_real_node_size
+ calculate_alignment( (size_type)overhead_percent, m_real_node_size
, HdrSize, HdrOffsetSize, PayloadPerAllocation))
//This is the real number of nodes per block
, m_num_subblocks(0)
@@ -195,7 +205,7 @@
, nodes_per_block
, m_num_subblocks
, m_real_num_node
- , overhead_percent
+ , (size_type)overhead_percent
, HdrSize
, HdrOffsetSize
, PayloadPerAllocation);
@@ -206,7 +216,7 @@
~private_adaptive_node_pool_impl()
{ priv_clear(); }
- std::size_t get_real_num_node() const
+ size_type get_real_num_node() const
{ return m_real_num_node; }
//!Returns the segment manager. Never throws
@@ -240,10 +250,10 @@
//!Allocates n nodes.
//!Can throw
- multiallocation_chain allocate_nodes(const std::size_t n)
+ multiallocation_chain allocate_nodes(const size_type n)
{
multiallocation_chain chain;
- std::size_t i = 0;
+ size_type i = 0;
try{
priv_invariants();
while(i != n){
@@ -252,12 +262,12 @@
priv_alloc_block(((n - i) - 1)/m_real_num_node + 1);
}
free_nodes_t &free_nodes = m_block_multiset.begin()->free_nodes;
- const std::size_t free_nodes_count_before = free_nodes.size();
+ const size_type free_nodes_count_before = free_nodes.size();
if(free_nodes_count_before == m_real_num_node){
--m_totally_free_blocks;
}
- const std::size_t num_elems = ((n-i) < free_nodes_count_before) ? (n-i) : free_nodes_count_before;
- for(std::size_t j = 0; j != num_elems; ++j){
+ const size_type num_elems = ((n-i) < free_nodes_count_before) ? (n-i) : free_nodes_count_before;
+ for(size_type j = 0; j != num_elems; ++j){
void *new_node = &free_nodes.front();
free_nodes.pop_front();
chain.push_back(new_node);
@@ -270,11 +280,11 @@
}
}
catch(...){
- this->deallocate_nodes(BOOST_CONTAINER_MOVE_NAMESPACE::move(chain));
+ this->deallocate_nodes(boost::move(chain));
throw;
}
priv_invariants();
- return BOOST_CONTAINER_MOVE_NAMESPACE::move(chain);
+ return boost::move(chain);
}
//!Deallocates a linked list of nodes. Never throws
@@ -289,10 +299,10 @@
void deallocate_free_blocks()
{ this->priv_deallocate_free_blocks(0); }
- std::size_t num_free_nodes()
+ size_type num_free_nodes()
{
typedef typename block_multiset_t::const_iterator citerator;
- std::size_t count = 0;
+ size_type count = 0;
citerator it (m_block_multiset.begin()), itend(m_block_multiset.end());
for(; it != itend; ++it){
count += it->free_nodes.size();
@@ -302,10 +312,10 @@
void swap(private_adaptive_node_pool_impl &other)
{
- assert(m_max_free_blocks == other.m_max_free_blocks);
- assert(m_real_node_size == other.m_real_node_size);
- assert(m_real_block_alignment == other.m_real_block_alignment);
- assert(m_real_num_node == other.m_real_num_node);
+ BOOST_ASSERT(m_max_free_blocks == other.m_max_free_blocks);
+ BOOST_ASSERT(m_real_node_size == other.m_real_node_size);
+ BOOST_ASSERT(m_real_block_alignment == other.m_real_block_alignment);
+ BOOST_ASSERT(m_real_num_node == other.m_real_num_node);
std::swap(mp_segment_mngr_base, other.mp_segment_mngr_base);
std::swap(m_totally_free_blocks, other.m_totally_free_blocks);
m_block_multiset.swap(other.m_block_multiset);
@@ -316,7 +326,7 @@
{ this->priv_deallocate_free_blocks(0); }
private:
- void priv_deallocate_free_blocks(std::size_t max_free_blocks)
+ void priv_deallocate_free_blocks(size_type max_free_blocks)
{
priv_invariants();
//Now check if we've reached the free nodes limit
@@ -326,15 +336,15 @@
; m_totally_free_blocks > max_free_blocks
; --m_totally_free_blocks
){
- assert(!m_block_multiset.empty());
+ BOOST_ASSERT(!m_block_multiset.empty());
block_iterator it = itend;
--it;
- assert(it->free_nodes.size() == m_real_num_node);
+ BOOST_ASSERT(it->free_nodes.size() == m_real_num_node);
m_block_multiset.erase_and_dispose(it, block_destroyer(this));
}
}
- void priv_reinsert_nodes_in_block(multiallocation_chain &chain, std::size_t n)
+ void priv_reinsert_nodes_in_block(multiallocation_chain &chain, size_type n)
{
block_iterator block_it(m_block_multiset.end());
while(n--){
@@ -342,7 +352,7 @@
chain.pop_front();
priv_invariants();
block_info_t *block_info = this->priv_block_from_node(pElem);
- assert(block_info->free_nodes.size() < m_real_num_node);
+ BOOST_ASSERT(block_info->free_nodes.size() < m_real_num_node);
//We put the node at the beginning of the free node list
node_t * to_deallocate = static_cast<node_t*>(pElem);
block_info->free_nodes.push_front(*to_deallocate);
@@ -352,7 +362,7 @@
++next_block;
//Cache the free nodes from the block
- std::size_t this_block_free_nodes = this_block->free_nodes.size();
+ size_type this_block_free_nodes = this_block->free_nodes.size();
if(this_block_free_nodes == 1){
m_block_multiset.insert(m_block_multiset.begin(), *block_info);
@@ -361,7 +371,7 @@
block_iterator next_block(this_block);
++next_block;
if(next_block != block_it){
- std::size_t next_free_nodes = next_block->free_nodes.size();
+ size_type next_free_nodes = next_block->free_nodes.size();
if(this_block_free_nodes > next_free_nodes){
//Now move the block to the new position
m_block_multiset.erase(this_block);
@@ -379,12 +389,12 @@
node_t *priv_take_first_node()
{
- assert(m_block_multiset.begin() != m_block_multiset.end());
+ BOOST_ASSERT(m_block_multiset.begin() != m_block_multiset.end());
//We take the first free node the multiset can't be empty
free_nodes_t &free_nodes = m_block_multiset.begin()->free_nodes;
node_t *first_node = &free_nodes.front();
- const std::size_t free_nodes_count = free_nodes.size();
- assert(0 != free_nodes_count);
+ const size_type free_nodes_count = free_nodes.size();
+ BOOST_ASSERT(0 != free_nodes_count);
free_nodes.pop_front();
if(free_nodes_count == 1){
m_block_multiset.erase(m_block_multiset.begin());
@@ -412,18 +422,18 @@
private:
void do_destroy(typename block_multiset_t::pointer to_deallocate, AlignOnlyTrue)
{
- std::size_t free_nodes = to_deallocate->free_nodes.size();
+ size_type free_nodes = to_deallocate->free_nodes.size();
(void)free_nodes;
- assert(free_nodes == mp_impl->m_real_num_node);
+ BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node);
mp_impl->mp_segment_mngr_base->deallocate(to_deallocate);
}
void do_destroy(typename block_multiset_t::pointer to_deallocate, AlignOnlyFalse)
{
- std::size_t free_nodes = to_deallocate->free_nodes.size();
+ size_type free_nodes = to_deallocate->free_nodes.size();
(void)free_nodes;
- assert(free_nodes == mp_impl->m_real_num_node);
- assert(0 == to_deallocate->hdr_offset);
+ BOOST_ASSERT(free_nodes == mp_impl->m_real_num_node);
+ BOOST_ASSERT(0 == to_deallocate->hdr_offset);
hdr_offset_holder *hdr_off_holder = mp_impl->priv_first_subblock_from_block(containers_detail::get_pointer(to_deallocate));
mp_impl->mp_segment_mngr_base->deallocate(hdr_off_holder);
}
@@ -444,20 +454,20 @@
for(++it; it != itend; ++it){
block_iterator prev(it);
--prev;
- std::size_t sp = prev->free_nodes.size(),
+ size_type sp = prev->free_nodes.size(),
si = it->free_nodes.size();
- assert(sp <= si);
+ BOOST_ASSERT(sp <= si);
(void)sp; (void)si;
}
}
//Check that the total free nodes are correct
it = m_block_multiset.begin();
itend = m_block_multiset.end();
- std::size_t total_free_nodes = 0;
+ size_type total_free_nodes = 0;
for(; it != itend; ++it){
total_free_nodes += it->free_nodes.size();
}
- assert(total_free_nodes >= m_totally_free_blocks*m_real_num_node);
+ BOOST_ASSERT(total_free_nodes >= m_totally_free_blocks*m_real_num_node);
//Check that the total totally free blocks are correct
it = m_block_multiset.begin();
@@ -466,17 +476,17 @@
for(; it != itend; ++it){
total_free += it->free_nodes.size() == m_real_num_node;
}
- assert(total_free >= m_totally_free_blocks);
+ BOOST_ASSERT(total_free >= m_totally_free_blocks);
if(!AlignOnly){
//Check that header offsets are correct
it = m_block_multiset.begin();
for(; it != itend; ++it){
hdr_offset_holder *hdr_off_holder = priv_first_subblock_from_block(&*it);
- for(std::size_t i = 0, max = m_num_subblocks; i < max; ++i){
- assert(hdr_off_holder->hdr_offset == std::size_t(reinterpret_cast<char*>(&*it)- reinterpret_cast<char*>(hdr_off_holder)));
- assert(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
- assert(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
+ for(size_type i = 0, max = m_num_subblocks; i < max; ++i){
+ BOOST_ASSERT(hdr_off_holder->hdr_offset == size_type(reinterpret_cast<char*>(&*it)- reinterpret_cast<char*>(hdr_off_holder)));
+ BOOST_ASSERT(0 == ((size_type)hdr_off_holder & (m_real_block_alignment - 1)));
+ BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
hdr_off_holder = reinterpret_cast<hdr_offset_holder *>(reinterpret_cast<char*>(hdr_off_holder) + m_real_block_alignment);
}
}
@@ -492,13 +502,13 @@
#ifndef NDEBUG
block_iterator it = m_block_multiset.begin();
block_iterator itend = m_block_multiset.end();
- std::size_t num_free_nodes = 0;
+ size_type num_free_nodes = 0;
for(; it != itend; ++it){
//Check for memory leak
- assert(it->free_nodes.size() == m_real_num_node);
+ BOOST_ASSERT(it->free_nodes.size() == m_real_num_node);
++num_free_nodes;
}
- assert(num_free_nodes == m_totally_free_blocks);
+ BOOST_ASSERT(num_free_nodes == m_totally_free_blocks);
#endif
//Check for memory leaks
priv_invariants();
@@ -509,12 +519,12 @@
block_info_t *priv_block_from_node(void *node, AlignOnlyFalse) const
{
hdr_offset_holder *hdr_off_holder =
- reinterpret_cast<hdr_offset_holder*>((std::size_t)node & std::size_t(~(m_real_block_alignment - 1)));
- assert(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
- assert(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
+ reinterpret_cast<hdr_offset_holder*>((std::size_t)node & size_type(~(m_real_block_alignment - 1)));
+ BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
+ BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
block_info_t *block = reinterpret_cast<block_info_t *>
(reinterpret_cast<char*>(hdr_off_holder) + hdr_off_holder->hdr_offset);
- assert(block->hdr_offset == 0);
+ BOOST_ASSERT(block->hdr_offset == 0);
return block;
}
@@ -530,17 +540,17 @@
{
hdr_offset_holder *hdr_off_holder = reinterpret_cast<hdr_offset_holder*>
(reinterpret_cast<char*>(block) - (m_num_subblocks-1)*m_real_block_alignment);
- assert(hdr_off_holder->hdr_offset == std::size_t(reinterpret_cast<char*>(block) - reinterpret_cast<char*>(hdr_off_holder)));
- assert(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
- assert(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
+ BOOST_ASSERT(hdr_off_holder->hdr_offset == size_type(reinterpret_cast<char*>(block) - reinterpret_cast<char*>(hdr_off_holder)));
+ BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1)));
+ BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1)));
return hdr_off_holder;
}
//!Allocates a several blocks of nodes. Can throw
- void priv_alloc_block(std::size_t n, AlignOnlyTrue)
+ void priv_alloc_block(size_type n, AlignOnlyTrue)
{
- std::size_t real_block_size = m_real_block_alignment - PayloadPerAllocation;
- for(std::size_t i = 0; i != n; ++i){
+ size_type real_block_size = m_real_block_alignment - PayloadPerAllocation;
+ for(size_type i = 0; i != n; ++i){
//We allocate a new NodeBlock and put it the last
//element of the tree
char *mem_address = static_cast<char*>
@@ -554,20 +564,20 @@
//We initialize all Nodes in Node Block to insert
//them in the free Node list
typename free_nodes_t::iterator prev_insert_pos = c_info->free_nodes.before_begin();
- for(std::size_t i = 0; i < m_real_num_node; ++i){
+ for(size_type i = 0; i < m_real_num_node; ++i){
prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *(node_t*)mem_address);
mem_address += m_real_node_size;
}
}
}
- void priv_alloc_block(std::size_t n, AlignOnlyFalse)
+ void priv_alloc_block(size_type n, AlignOnlyFalse)
{
- std::size_t real_block_size = m_real_block_alignment*m_num_subblocks - PayloadPerAllocation;
- std::size_t elements_per_subblock = (m_real_block_alignment - HdrOffsetSize)/m_real_node_size;
- std::size_t hdr_subblock_elements = (m_real_block_alignment - HdrSize - PayloadPerAllocation)/m_real_node_size;
+ size_type real_block_size = m_real_block_alignment*m_num_subblocks - PayloadPerAllocation;
+ size_type elements_per_subblock = (m_real_block_alignment - HdrOffsetSize)/m_real_node_size;
+ size_type hdr_subblock_elements = (m_real_block_alignment - HdrSize - PayloadPerAllocation)/m_real_node_size;
- for(std::size_t i = 0; i != n; ++i){
+ for(size_type i = 0; i != n; ++i){
//We allocate a new NodeBlock and put it the last
//element of the tree
char *mem_address = static_cast<char*>
@@ -579,16 +589,16 @@
char *hdr_addr = mem_address + m_real_block_alignment*(m_num_subblocks-1);
block_info_t *c_info = new(hdr_addr)block_info_t;
//Some structural checks
- assert(static_cast<void*>(&static_cast<hdr_offset_holder*>(c_info)->hdr_offset) ==
+ BOOST_ASSERT(static_cast<void*>(&static_cast<hdr_offset_holder*>(c_info)->hdr_offset) ==
static_cast<void*>(c_info));
typename free_nodes_t::iterator prev_insert_pos = c_info->free_nodes.before_begin();
- for( std::size_t subblock = 0, maxsubblock = m_num_subblocks - 1
+ for( size_type subblock = 0, maxsubblock = m_num_subblocks - 1
; subblock < maxsubblock
; ++subblock, mem_address += m_real_block_alignment){
//Initialize header offset mark
- new(mem_address) hdr_offset_holder(std::size_t(hdr_addr - mem_address));
+ new(mem_address) hdr_offset_holder(size_type(hdr_addr - mem_address));
char *pNode = mem_address + HdrOffsetSize;
- for(std::size_t i = 0; i < elements_per_subblock; ++i){
+ for(size_type i = 0; i < elements_per_subblock; ++i){
prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *new (pNode) node_t);
pNode += m_real_node_size;
}
@@ -597,7 +607,7 @@
char *pNode = hdr_addr + HdrSize;
//We initialize all Nodes in Node Block to insert
//them in the free Node list
- for(std::size_t i = 0; i < hdr_subblock_elements; ++i){
+ for(size_type i = 0; i < hdr_subblock_elements; ++i){
prev_insert_pos = c_info->free_nodes.insert_after(prev_insert_pos, *new (pNode) node_t);
pNode += m_real_node_size;
}
@@ -608,25 +618,25 @@
}
//!Allocates a block of nodes. Can throw std::bad_alloc
- void priv_alloc_block(std::size_t n)
+ void priv_alloc_block(size_type n)
{ return priv_alloc_block(n, IsAlignOnly()); }
private:
typedef typename boost::pointer_to_other
<void_pointer, segment_manager_base_type>::type segment_mngr_base_ptr_t;
- const std::size_t m_max_free_blocks;
- const std::size_t m_real_node_size;
+ const size_type m_max_free_blocks;
+ const size_type m_real_node_size;
//Round the size to a power of two value.
//This is the total memory size (including payload) that we want to
//allocate from the general-purpose allocator
- const std::size_t m_real_block_alignment;
- std::size_t m_num_subblocks;
+ const size_type m_real_block_alignment;
+ size_type m_num_subblocks;
//This is the real number of nodes per block
//const
- std::size_t m_real_num_node;
+ size_type m_real_num_node;
segment_mngr_base_ptr_t mp_segment_mngr_base; //Segment manager
block_multiset_t m_block_multiset; //Intrusive block list
- std::size_t m_totally_free_blocks; //Free blocks
+ size_type m_totally_free_blocks; //Free blocks
};
} //namespace containers_detail {
Modified: sandbox/move/boost/container/detail/advanced_insert_int.hpp
==============================================================================
--- sandbox/move/boost/container/detail/advanced_insert_int.hpp (original)
+++ sandbox/move/boost/container/detail/advanced_insert_int.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -17,11 +17,10 @@
#include "config_begin.hpp"
#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
#include <iterator> //std::iterator_traits
-#include <algorithm> //std::copy, std::uninitialized_copy
#include <new> //placement new
-#include <cassert>
+#include <boost/assert.hpp>
namespace boost { namespace container { namespace containers_detail {
@@ -51,21 +50,21 @@
{}
virtual void copy_all_to(Iterator p)
- { std::copy(first_, last_, p); }
+ { ::boost::copy_or_move(first_, last_, p); }
virtual void uninitialized_copy_all_to(Iterator p)
- { ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first_, last_, p); }
+ { ::boost::uninitialized_copy_or_move(first_, last_, p); }
virtual void uninitialized_copy_some_and_update(Iterator pos, difference_type division_count, bool first_n)
{
FwdIt mid = first_;
std::advance(mid, division_count);
if(first_n){
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first_, mid, pos);
+ ::boost::uninitialized_copy_or_move(first_, mid, pos);
first_ = mid;
}
else{
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(mid, last_, pos);
+ ::boost::uninitialized_copy_or_move(mid, last_, pos);
last_ = mid;
}
}
@@ -75,11 +74,11 @@
FwdIt mid = first_;
std::advance(mid, division_count);
if(first_n){
- std::copy(first_, mid, pos);
+ ::boost::copy_or_move(first_, mid, pos);
first_ = mid;
}
else{
- std::copy(mid, last_, pos);
+ ::boost::copy_or_move(mid, last_, pos);
last_ = mid;
}
}
@@ -99,7 +98,7 @@
void uninitialized_copy_impl(Iterator p, const SizeType n)
{
- assert(n <= count_);
+ BOOST_ASSERT(n <= count_);
Iterator orig_p = p;
SizeType i = 0;
try{
@@ -121,7 +120,7 @@
virtual void copy_all_to(Iterator)
{ //This should never be called with any count
- assert(count_ == 0);
+ BOOST_ASSERT(count_ == 0);
}
virtual void uninitialized_copy_all_to(Iterator p)
@@ -134,7 +133,7 @@
new_count = division_count;
}
else{
- assert(difference_type(count_)>= division_count);
+ BOOST_ASSERT(difference_type(count_)>= division_count);
new_count = count_ - division_count;
}
this->uninitialized_copy_impl(pos, new_count);
@@ -142,17 +141,17 @@
virtual void copy_some_and_update(Iterator , difference_type division_count, bool first_n)
{
- assert(count_ == 0);
+ BOOST_ASSERT(count_ == 0);
SizeType new_count;
if(first_n){
new_count = division_count;
}
else{
- assert(difference_type(count_)>= division_count);
+ BOOST_ASSERT(difference_type(count_)>= division_count);
new_count = count_ - division_count;
}
//This function should never called with a count different to zero
- assert(new_count == 0);
+ BOOST_ASSERT(new_count == 0);
(void)new_count;
}
@@ -164,7 +163,8 @@
#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
#include INCLUDE_BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include INCLUDE_BOOST_CONTAINER_DETAIL_STORED_REF_HPP
+#include <boost/move/move.hpp>
#include <typeinfo>
//#include <iostream> //For debugging purposes
@@ -181,7 +181,8 @@
typedef typename build_number_seq<sizeof...(Args)>::type index_tuple_t;
explicit advanced_insert_aux_emplace(Args&&... args)
- : args_(args...), used_(false)
+ : args_(args...)
+ , used_(false)
{}
~advanced_insert_aux_emplace()
@@ -204,7 +205,7 @@
void priv_copy_all_to(const index_tuple<IdxPack...>&, Iterator p)
{
if(!used_){
- *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(T (BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(get<IdxPack>(args_))...));
+ *p = boost::move(T (::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...));
used_ = true;
}
}
@@ -213,7 +214,7 @@
void priv_uninitialized_copy_all_to(const index_tuple<IdxPack...>&, Iterator p)
{
if(!used_){
- new(containers_detail::get_pointer(&*p))T(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(get<IdxPack>(args_))...);
+ new(containers_detail::get_pointer(&*p))T(::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...);
used_ = true;
}
}
@@ -221,10 +222,10 @@
template<int ...IdxPack>
void priv_uninitialized_copy_some_and_update(const index_tuple<IdxPack...>&, Iterator p, difference_type division_count, bool first_n)
{
- assert(division_count <=1);
+ BOOST_ASSERT(division_count <=1);
if((first_n && division_count == 1) || (!first_n && division_count == 0)){
if(!used_){
- new(containers_detail::get_pointer(&*p))T(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(get<IdxPack>(args_))...);
+ new(containers_detail::get_pointer(&*p))T(::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...);
used_ = true;
}
}
@@ -233,15 +234,15 @@
template<int ...IdxPack>
void priv_copy_some_and_update(const index_tuple<IdxPack...>&, Iterator p, difference_type division_count, bool first_n)
{
- assert(division_count <=1);
+ BOOST_ASSERT(division_count <=1);
if((first_n && division_count == 1) || (!first_n && division_count == 0)){
if(!used_){
- *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(T(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(get<IdxPack>(args_))...));
+ *p = boost::move(T(::boost::container::containers_detail::stored_ref<Args>::forward(get<IdxPack>(args_))...));
used_ = true;
}
}
}
- tuple<Args&&...> args_;
+ tuple<Args&...> args_;
bool used_;
};
@@ -273,7 +274,7 @@
{
if(!used_){
value_init<T>v;
- *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(v.m_t);
+ *p = boost::move(v.m_t);
used_ = true;
}
}
@@ -288,7 +289,7 @@
virtual void uninitialized_copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
{
- assert(division_count <=1);
+ BOOST_ASSERT(division_count <=1);
if((first_n && division_count == 1) || (!first_n && division_count == 0)){
if(!used_){
new(containers_detail::get_pointer(&*p))T();
@@ -299,11 +300,11 @@
virtual void copy_some_and_update(Iterator p, difference_type division_count, bool first_n)
{
- assert(division_count <=1);
+ BOOST_ASSERT(division_count <=1);
if((first_n && division_count == 1) || (!first_n && division_count == 0)){
if(!used_){
value_init<T>v;
- *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(v.m_t);
+ *p = boost::move(v.m_t);
used_ = true;
}
}
@@ -327,7 +328,7 @@
{ \
if(!used_){ \
T v(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _)); \
- *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(v); \
+ *p = boost::move(v); \
used_ = true; \
} \
} \
@@ -344,7 +345,7 @@
virtual void uninitialized_copy_some_and_update \
(Iterator p, difference_type division_count, bool first_n) \
{ \
- assert(division_count <=1); \
+ BOOST_ASSERT(division_count <=1); \
if((first_n && division_count == 1) || (!first_n && division_count == 0)){ \
if(!used_){ \
new(containers_detail::get_pointer(&*p))T \
@@ -357,11 +358,11 @@
virtual void copy_some_and_update \
(Iterator p, difference_type division_count, bool first_n) \
{ \
- assert(division_count <=1); \
+ BOOST_ASSERT(division_count <=1); \
if((first_n && division_count == 1) || (!first_n && division_count == 0)){ \
if(!used_){ \
T v(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_MEMBER_FORWARD, _)); \
- *p = BOOST_CONTAINER_MOVE_NAMESPACE::move(v); \
+ *p = boost::move(v); \
used_ = true; \
} \
} \
Modified: sandbox/move/boost/container/detail/algorithms.hpp
==============================================================================
--- sandbox/move/boost/container/detail/algorithms.hpp (original)
+++ sandbox/move/boost/container/detail/algorithms.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -77,8 +77,8 @@
::new((void*)dest)T();
}
-template<class T, class U, class E>
-inline void construct_in_place(T *dest, emplace_iterator<U, E> ei)
+template<class T, class U, class E, class D>
+inline void construct_in_place(T *dest, emplace_iterator<U, E, D> ei)
{
ei.construct_in_place(dest);
}
Modified: sandbox/move/boost/container/detail/config_begin.hpp
==============================================================================
--- sandbox/move/boost/container/detail/config_begin.hpp (original)
+++ sandbox/move/boost/container/detail/config_begin.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -12,19 +12,6 @@
#include <boost/config.hpp>
//#define BOOST_CONTAINER_IN_INTERPROCESS
-//#define BOOST_MOVE_IN_INTERPROCESS
-
-#ifdef BOOST_MOVE_IN_INTERPROCESS
-
-#define INCLUDE_BOOST_CONTAINER_MOVE_HPP <boost/interprocess/detail/move.hpp >
-#define BOOST_CONTAINER_MOVE_NAMESPACE boost::interprocess
-
-#else
-
-#define INCLUDE_BOOST_CONTAINER_MOVE_HPP <boost/move/move.hpp >
-#define BOOST_CONTAINER_MOVE_NAMESPACE boost
-
-#endif
#ifdef BOOST_CONTAINER_IN_INTERPROCESS
@@ -62,6 +49,7 @@
#define INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP <boost/interprocess/containers/container/detail/utilities.hpp>
#define INCLUDE_BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP <boost/interprocess/containers/container/detail/value_init.hpp>
#define INCLUDE_BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP <boost/interprocess/containers/container/detail/variadic_templates_tools.hpp>
+#define INCLUDE_BOOST_CONTAINER_DETAIL_STORED_REF_HPP <boost/interprocess/containers/container/detail/stored_ref.hpp>
#define INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP <boost/interprocess/containers/container/detail/version_type.hpp>
#define INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP <boost/interprocess/containers/container/detail/workaround.hpp>
@@ -102,6 +90,7 @@
#define INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP <boost/container/detail/utilities.hpp>
#define INCLUDE_BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP <boost/container/detail/value_init.hpp>
#define INCLUDE_BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP <boost/container/detail/variadic_templates_tools.hpp>
+#define INCLUDE_BOOST_CONTAINER_DETAIL_STORED_REF_HPP <boost/container/detail/stored_ref.hpp>
#define INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP <boost/container/detail/version_type.hpp>
#define INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP <boost/container/detail/workaround.hpp>
Modified: sandbox/move/boost/container/detail/destroyers.hpp
==============================================================================
--- sandbox/move/boost/container/detail/destroyers.hpp (original)
+++ sandbox/move/boost/container/detail/destroyers.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -89,7 +89,7 @@
{
if(!m_p) return;
value_type *raw_ptr = containers_detail::get_pointer(m_p);
- for(std::size_t i = 0; i < m_n; ++i, ++raw_ptr)
+ for(size_type i = 0; i < m_n; ++i, ++raw_ptr)
raw_ptr->~value_type();
}
};
Modified: sandbox/move/boost/container/detail/flat_tree.hpp
==============================================================================
--- sandbox/move/boost/container/detail/flat_tree.hpp (original)
+++ sandbox/move/boost/container/detail/flat_tree.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -42,7 +42,7 @@
#include <utility>
#include <boost/type_traits/has_trivial_destructor.hpp>
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_PAIR_HPP
@@ -108,7 +108,7 @@
: public value_compare
{
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(Data)
+ BOOST_COPYABLE_AND_MOVABLE(Data)
public:
Data(const Data &d)
: value_compare(d), m_vect(d.m_vect)
@@ -125,17 +125,17 @@
const allocator_t &alloc)
: value_compare(comp), m_vect(alloc){}
- Data& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(Data) d)
+ Data& operator=(BOOST_COPY_ASSIGN_REF(Data) d)
{
this->value_compare::operator=(d);
m_vect = d.m_vect;
return *this;
}
- Data& operator=(BOOST_MOVE_MACRO_RV_REF(Data) d)
+ Data& operator=(BOOST_RV_REF(Data) d)
{
- this->value_compare::operator=(BOOST_CONTAINER_MOVE_NAMESPACE::move(static_cast<value_compare &>(d)));
- m_vect = BOOST_CONTAINER_MOVE_NAMESPACE::move(d.m_vect);
+ this->value_compare::operator=(boost::move(static_cast<value_compare &>(d)));
+ m_vect = boost::move(d.m_vect);
return *this;
}
@@ -143,7 +143,7 @@
};
Data m_data;
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_tree)
+ BOOST_COPYABLE_AND_MOVABLE(flat_tree)
public:
@@ -174,8 +174,8 @@
: m_data(x.m_data, x.m_data.m_vect)
{ }
- flat_tree(BOOST_MOVE_MACRO_RV_REF(flat_tree) x)
- : m_data(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_data))
+ flat_tree(BOOST_RV_REF(flat_tree) x)
+ : m_data(boost::move(x.m_data))
{ }
template <class InputIterator>
@@ -188,11 +188,11 @@
~flat_tree()
{ }
- flat_tree& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_tree) x)
+ flat_tree& operator=(BOOST_COPY_ASSIGN_REF(flat_tree) x)
{ m_data = x.m_data; return *this; }
- flat_tree& operator=(BOOST_MOVE_MACRO_RV_REF(flat_tree) mx)
- { m_data = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_data); return *this; }
+ flat_tree& operator=(BOOST_RV_REF(flat_tree) mx)
+ { m_data = boost::move(mx.m_data); return *this; }
public:
// accessors:
@@ -275,12 +275,12 @@
return ret;
}
- std::pair<iterator,bool> insert_unique(BOOST_MOVE_MACRO_RV_REF(value_type) val)
+ std::pair<iterator,bool> insert_unique(BOOST_RV_REF(value_type) val)
{
insert_commit_data data;
std::pair<iterator,bool> ret = priv_insert_unique_prepare(val, data);
if(ret.second){
- ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(val));
+ ret.first = priv_insert_commit(data, boost::move(val));
}
return ret;
}
@@ -293,10 +293,10 @@
return i;
}
- iterator insert_equal(BOOST_MOVE_MACRO_RV_REF(value_type) mval)
+ iterator insert_equal(BOOST_RV_REF(value_type) mval)
{
iterator i = this->upper_bound(KeyOfValue()(mval));
- i = this->m_data.m_vect.insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(mval));
+ i = this->m_data.m_vect.insert(i, boost::move(mval));
return i;
}
@@ -310,12 +310,12 @@
return ret.first;
}
- iterator insert_unique(const_iterator pos, BOOST_MOVE_MACRO_RV_REF(value_type) mval)
+ iterator insert_unique(const_iterator pos, BOOST_RV_REF(value_type) mval)
{
insert_commit_data data;
std::pair<iterator,bool> ret = priv_insert_unique_prepare(pos, mval, data);
if(ret.second){
- ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(mval));
+ ret.first = priv_insert_commit(data, boost::move(mval));
}
return ret.first;
}
@@ -327,11 +327,11 @@
return priv_insert_commit(data, val);
}
- iterator insert_equal(const_iterator pos, BOOST_MOVE_MACRO_RV_REF(value_type) mval)
+ iterator insert_equal(const_iterator pos, BOOST_RV_REF(value_type) mval)
{
insert_commit_data data;
priv_insert_equal_prepare(pos, mval, data);
- return priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move(mval));
+ return priv_insert_commit(data, boost::move(mval));
}
template <class InIt>
@@ -354,12 +354,12 @@
template <class... Args>
iterator emplace_unique(Args&&... args)
{
- value_type && val = value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ value_type && val = value_type(boost::forward<Args>(args)...);
insert_commit_data data;
std::pair<iterator,bool> ret =
priv_insert_unique_prepare(val, data);
if(ret.second){
- ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move<value_type>(val));
+ ret.first = priv_insert_commit(data, boost::move(val));
}
return ret.first;
}
@@ -367,11 +367,11 @@
template <class... Args>
iterator emplace_hint_unique(const_iterator hint, Args&&... args)
{
- value_type && val = value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ value_type && val = value_type(boost::forward<Args>(args)...);
insert_commit_data data;
std::pair<iterator,bool> ret = priv_insert_unique_prepare(hint, val, data);
if(ret.second){
- ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move<value_type>(val));
+ ret.first = priv_insert_commit(data, boost::move(val));
}
return ret.first;
}
@@ -379,19 +379,19 @@
template <class... Args>
iterator emplace_equal(Args&&... args)
{
- value_type &&val = value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ value_type &&val = value_type(boost::forward<Args>(args)...);
iterator i = this->upper_bound(KeyOfValue()(val));
- i = this->m_data.m_vect.insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move<value_type>(val));
+ i = this->m_data.m_vect.insert(i, boost::move(val));
return i;
}
template <class... Args>
iterator emplace_hint_equal(const_iterator hint, Args&&... args)
{
- value_type &&val = value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ value_type &&val = value_type(boost::forward<Args>(args)...);
insert_commit_data data;
priv_insert_equal_prepare(hint, val, data);
- return priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move<value_type>(val));
+ return priv_insert_commit(data, boost::move(val));
}
#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -404,7 +404,7 @@
std::pair<iterator,bool> ret =
priv_insert_unique_prepare(val, data);
if(ret.second){
- ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move<value_type>(val));
+ ret.first = priv_insert_commit(data, boost::move(val));
}
return ret.first;
}
@@ -416,7 +416,7 @@
insert_commit_data data;
std::pair<iterator,bool> ret = priv_insert_unique_prepare(hint, val, data);
if(ret.second){
- ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move<value_type>(val));
+ ret.first = priv_insert_commit(data, boost::move(val));
}
return ret.first;
}
@@ -426,7 +426,7 @@
containers_detail::value_init<value_type> vval;
value_type &val = vval.m_t;
iterator i = this->upper_bound(KeyOfValue()(val));
- i = this->m_data.m_vect.insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move<value_type>(val));
+ i = this->m_data.m_vect.insert(i, boost::move(val));
return i;
}
@@ -436,7 +436,7 @@
value_type &val = vval.m_t;
insert_commit_data data;
priv_insert_equal_prepare(hint, val, data);
- return priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move<value_type>(val));
+ return priv_insert_commit(data, boost::move(val));
}
#define BOOST_PP_LOCAL_MACRO(n) \
@@ -447,7 +447,7 @@
insert_commit_data data; \
std::pair<iterator,bool> ret = priv_insert_unique_prepare(val, data); \
if(ret.second){ \
- ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move<value_type>(val)); \
+ ret.first = priv_insert_commit(data, boost::move(val)); \
} \
return ret.first; \
} \
@@ -460,7 +460,7 @@
insert_commit_data data; \
std::pair<iterator,bool> ret = priv_insert_unique_prepare(hint, val, data); \
if(ret.second){ \
- ret.first = priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move<value_type>(val)); \
+ ret.first = priv_insert_commit(data, boost::move(val)); \
} \
return ret.first; \
} \
@@ -470,7 +470,7 @@
{ \
value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
iterator i = this->upper_bound(KeyOfValue()(val)); \
- i = this->m_data.m_vect.insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move<value_type>(val)); \
+ i = this->m_data.m_vect.insert(i, boost::move(val)); \
return i; \
} \
\
@@ -481,7 +481,7 @@
value_type val(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
insert_commit_data data; \
priv_insert_equal_prepare(hint, val, data); \
- return priv_insert_commit(data, BOOST_CONTAINER_MOVE_NAMESPACE::move<value_type>(val)); \
+ return priv_insert_commit(data, boost::move(val)); \
} \
//!
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
@@ -677,11 +677,11 @@
template<class Convertible>
iterator priv_insert_commit
- (insert_commit_data &commit_data, BOOST_MOVE_MACRO_FWD_REF(Convertible) convertible)
+ (insert_commit_data &commit_data, BOOST_FWD_REF(Convertible) convertible)
{
return this->m_data.m_vect.insert
( commit_data.position
- , BOOST_CONTAINER_MOVE_NAMESPACE::forward<Convertible>(convertible));
+ , boost::forward<Convertible>(convertible));
}
template <class RanIt>
Modified: sandbox/move/boost/container/detail/iterators.hpp
==============================================================================
--- sandbox/move/boost/container/detail/iterators.hpp (original)
+++ sandbox/move/boost/container/detail/iterators.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -20,10 +20,11 @@
#include "config_begin.hpp"
#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
#include INCLUDE_BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
+#include INCLUDE_BOOST_CONTAINER_DETAIL_STORED_REF_HPP
#else
#include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
#endif
@@ -58,6 +59,16 @@
return result;
}
+ constant_iterator& operator--()
+ { decrement(); return *this; }
+
+ constant_iterator operator--(int)
+ {
+ constant_iterator result (*this);
+ decrement();
+ return result;
+ }
+
friend bool operator== (const constant_iterator& i, const constant_iterator& i2)
{ return i.equal(i2); }
@@ -102,6 +113,9 @@
const T& operator*() const
{ return dereference(); }
+ const T& operator[] (Difference n) const
+ { return dereference(); }
+
const T* operator->() const
{ return &(dereference()); }
@@ -156,6 +170,16 @@
return result;
}
+ default_construct_iterator& operator--()
+ { decrement(); return *this; }
+
+ default_construct_iterator operator--(int)
+ {
+ default_construct_iterator result (*this);
+ decrement();
+ return result;
+ }
+
friend bool operator== (const default_construct_iterator& i, const default_construct_iterator& i2)
{ return i.equal(i2); }
@@ -203,6 +227,9 @@
const T* operator->() const
{ return &(dereference()); }
+ const T& operator[] (Difference n) const
+ { return dereference(); }
+
private:
Difference m_num;
@@ -255,6 +282,16 @@
return result;
}
+ this_type& operator--()
+ { increment(); return *this; }
+
+ this_type operator--(int)
+ {
+ this_type result (*this);
+ increment();
+ return result;
+ }
+
friend bool operator== (const this_type& i, const this_type& i2)
{ return i.equal(i2); }
@@ -299,6 +336,9 @@
T& operator*() const
{ return dereference(); }
+ T& operator[] (Difference n) const
+ { return dereference(); }
+
T *operator->() const
{ return &(dereference()); }
@@ -328,14 +368,15 @@
{ return m_num - other.m_num; }
};
-template <class T, class E>
+template <class T, class E, class Difference /*= std::ptrdiff_t*/>
class emplace_iterator
: public std::iterator
- <std::random_access_iterator_tag, T, std::ptrdiff_t, const T*, const T &>
+ <std::random_access_iterator_tag, T, Difference, const T*, const T &>
{
typedef emplace_iterator this_type;
public:
+ typedef Difference difference_type;
explicit emplace_iterator(E&e)
: m_num(1), m_pe(&e){}
@@ -352,6 +393,16 @@
return result;
}
+ this_type& operator--()
+ { decrement(); return *this; }
+
+ this_type operator--(int)
+ {
+ this_type result (*this);
+ decrement();
+ return result;
+ }
+
friend bool operator== (const this_type& i, const this_type& i2)
{ return i.equal(i2); }
@@ -370,32 +421,35 @@
friend bool operator>= (const this_type& i, const this_type& i2)
{ return !(i < i2); }
- friend std::ptrdiff_t operator- (const this_type& i, const this_type& i2)
+ friend difference_type operator- (const this_type& i, const this_type& i2)
{ return i2.distance_to(i); }
//Arithmetic
- this_type& operator+=(std::ptrdiff_t off)
+ this_type& operator+=(difference_type off)
{ this->advance(off); return *this; }
- this_type operator+(std::ptrdiff_t off) const
+ this_type operator+(difference_type off) const
{
this_type other(*this);
other.advance(off);
return other;
}
- friend this_type operator+(std::ptrdiff_t off, const this_type& right)
+ friend this_type operator+(difference_type off, const this_type& right)
{ return right + off; }
- this_type& operator-=(std::ptrdiff_t off)
+ this_type& operator-=(difference_type off)
{ this->advance(-off); return *this; }
- this_type operator-(std::ptrdiff_t off) const
+ this_type operator-(difference_type off) const
{ return *this + (-off); }
const T& operator*() const
{ return dereference(); }
+ const T& operator[](difference_type) const
+ { return dereference(); }
+
const T* operator->() const
{ return &(dereference()); }
@@ -403,7 +457,7 @@
{ (*m_pe)(ptr); }
private:
- std::ptrdiff_t m_num;
+ difference_type m_num;
E * m_pe;
void increment()
@@ -424,11 +478,11 @@
return dummy;
}
- void advance(std::ptrdiff_t n)
+ void advance(difference_type n)
{ m_num -= n; }
- std::ptrdiff_t distance_to(const this_type &other)const
- { return m_num - other.m_num; }
+ difference_type distance_to(const this_type &other)const
+ { return difference_type(m_num - other.m_num); }
};
#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -447,9 +501,9 @@
template<int ...IdxPack>
void inplace_impl(T* ptr, const containers_detail::index_tuple<IdxPack...>&)
- { ::new(ptr) T(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(containers_detail::get<IdxPack>(args_))...); }
+ { ::new(ptr) T(containers_detail::stored_ref<Args>::forward(containers_detail::get<IdxPack>(args_))...); }
- containers_detail::tuple<Args&&...> args_;
+ containers_detail::tuple<Args&...> args_;
};
#else
Modified: sandbox/move/boost/container/detail/math_functions.hpp
==============================================================================
--- sandbox/move/boost/container/detail/math_functions.hpp (original)
+++ sandbox/move/boost/container/detail/math_functions.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -16,6 +16,7 @@
#ifndef BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP
#define BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP
+#include "config_begin.hpp"
#include <climits>
#include <boost/static_assert.hpp>
@@ -107,4 +108,6 @@
} // namespace container
} // namespace boost
+#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP
+
#endif
Modified: sandbox/move/boost/container/detail/mpl.hpp
==============================================================================
--- sandbox/move/boost/container/detail/mpl.hpp (original)
+++ sandbox/move/boost/container/detail/mpl.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -62,6 +62,9 @@
template <class Cond, class T = void>
struct disable_if : public enable_if_c<!Cond::value, T> {};
+template <bool B, class T = void>
+struct disable_if_c : public enable_if_c<!B, T> {};
+
template <class T, class U>
class is_convertible
{
Modified: sandbox/move/boost/container/detail/multiallocation_chain.hpp
==============================================================================
--- sandbox/move/boost/container/detail/multiallocation_chain.hpp (original)
+++ sandbox/move/boost/container/detail/multiallocation_chain.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -18,7 +18,8 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATOR_HPP
#include <boost/intrusive/slist.hpp>
#include <boost/pointer_to_other.hpp>
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/type_traits/make_unsigned.hpp>
+#include <boost/move/move.hpp>
namespace boost {
namespace container {
@@ -32,34 +33,39 @@
,bi::link_mode<bi::normal_link>
> node;
+ typedef typename boost::pointer_to_other<VoidPointer, char>::type char_ptr;
+ typedef typename std::iterator_traits<char_ptr>::difference_type difference_type;
+
typedef bi::slist< node
, bi::linear<true>
, bi::cache_last<true>
+ , bi::size_type<typename boost::make_unsigned<difference_type>::type>
> slist_impl_t;
slist_impl_t slist_impl_;
static node & to_node(VoidPointer p)
{ return *static_cast<node*>(static_cast<void*>(containers_detail::get_pointer(p))); }
- BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
public:
typedef VoidPointer void_pointer;
typedef typename slist_impl_t::iterator iterator;
+ typedef typename slist_impl_t::size_type size_type;
basic_multiallocation_chain()
: slist_impl_()
{}
- basic_multiallocation_chain(BOOST_MOVE_MACRO_RV_REF(basic_multiallocation_chain) other)
+ basic_multiallocation_chain(BOOST_RV_REF(basic_multiallocation_chain) other)
: slist_impl_()
{ slist_impl_.swap(other.slist_impl_); }
- basic_multiallocation_chain& operator=(BOOST_MOVE_MACRO_RV_REF(basic_multiallocation_chain) other)
+ basic_multiallocation_chain& operator=(BOOST_RV_REF(basic_multiallocation_chain) other)
{
- basic_multiallocation_chain tmp(BOOST_CONTAINER_MOVE_NAMESPACE::move(other));
+ basic_multiallocation_chain tmp(boost::move(other));
this->swap(tmp);
return *this;
}
@@ -67,7 +73,7 @@
bool empty() const
{ return slist_impl_.empty(); }
- std::size_t size() const
+ size_type size() const
{ return slist_impl_.size(); }
iterator before_begin()
@@ -103,7 +109,7 @@
void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator before_end)
{ slist_impl_.splice_after(after_this, x.slist_impl_, before_begin, before_end); }
- void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator before_end, std::size_t n)
+ void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_begin, iterator before_end, size_type n)
{ slist_impl_.splice_after(after_this, x.slist_impl_, before_begin, before_end, n); }
void splice_after(iterator after_this, basic_multiallocation_chain &x)
@@ -112,7 +118,7 @@
void incorporate_after(iterator after_this, void_pointer begin , iterator before_end)
{ slist_impl_.incorporate_after(after_this, &to_node(begin), &to_node(before_end)); }
- void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, std::size_t n)
+ void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, size_type n)
{ slist_impl_.incorporate_after(after_this, &to_node(begin), &to_node(before_end), n); }
void swap(basic_multiallocation_chain &x)
@@ -144,7 +150,7 @@
class transform_multiallocation_chain
{
private:
- BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(transform_multiallocation_chain)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(transform_multiallocation_chain)
MultiallocationChain holder_;
typedef typename MultiallocationChain::void_pointer void_pointer;
@@ -160,22 +166,23 @@
typedef transform_iterator
< typename MultiallocationChain::iterator
, containers_detail::cast_functor <T> > iterator;
+ typedef typename MultiallocationChain::size_type size_type;
transform_multiallocation_chain()
: holder_()
{}
- transform_multiallocation_chain(BOOST_MOVE_MACRO_RV_REF(transform_multiallocation_chain) other)
+ transform_multiallocation_chain(BOOST_RV_REF(transform_multiallocation_chain) other)
: holder_()
{ this->swap(other); }
- transform_multiallocation_chain(BOOST_MOVE_MACRO_RV_REF(MultiallocationChain) other)
- : holder_(BOOST_CONTAINER_MOVE_NAMESPACE::move(other))
+ transform_multiallocation_chain(BOOST_RV_REF(MultiallocationChain) other)
+ : holder_(boost::move(other))
{}
- transform_multiallocation_chain& operator=(BOOST_MOVE_MACRO_RV_REF(transform_multiallocation_chain) other)
+ transform_multiallocation_chain& operator=(BOOST_RV_REF(transform_multiallocation_chain) other)
{
- transform_multiallocation_chain tmp(BOOST_CONTAINER_MOVE_NAMESPACE::move(other));
+ transform_multiallocation_chain tmp(boost::move(other));
this->swap(tmp);
return *this;
}
@@ -186,10 +193,10 @@
void swap(transform_multiallocation_chain &other_chain)
{ holder_.swap(other_chain.holder_); }
- void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_begin, iterator before_end, std::size_t n)
+ void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_begin, iterator before_end, size_type n)
{ holder_.splice_after(after_this.base(), x.holder_, before_begin.base(), before_end.base(), n); }
- void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, std::size_t n)
+ void incorporate_after(iterator after_this, void_pointer begin, void_pointer before_end, size_type n)
{ holder_.incorporate_after(after_this.base(), begin, before_end, n); }
void pop_front()
@@ -213,7 +220,7 @@
iterator last()
{ return iterator(holder_.last()); }
- std::size_t size() const
+ size_type size() const
{ return holder_.size(); }
void clear()
@@ -230,7 +237,7 @@
MultiallocationChain extract_multiallocation_chain()
{
- return MultiallocationChain(BOOST_CONTAINER_MOVE_NAMESPACE::move(holder_));
+ return MultiallocationChain(boost::move(holder_));
}
};
Modified: sandbox/move/boost/container/detail/node_alloc_holder.hpp
==============================================================================
--- sandbox/move/boost/container/detail/node_alloc_holder.hpp (original)
+++ sandbox/move/boost/container/detail/node_alloc_holder.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -21,7 +21,7 @@
#include <utility>
#include <functional>
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
#include <boost/intrusive/options.hpp>
#include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
@@ -60,7 +60,7 @@
void priv_deallocate(allocator_v2)
{ m_alloc.deallocate_one(m_ptr); }
- BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator)
public:
@@ -74,7 +74,7 @@
~scoped_deallocator()
{ if (m_ptr)priv_deallocate(alloc_version()); }
- scoped_deallocator(BOOST_MOVE_MACRO_RV_REF(scoped_deallocator) o)
+ scoped_deallocator(BOOST_RV_REF(scoped_deallocator) o)
: m_ptr(o.m_ptr), m_alloc(o.m_alloc)
{ o.release(); }
@@ -128,7 +128,7 @@
~allocator_multialloc_chain_node_deallocator()
{
if(!c_.empty())
- a_.deallocate_individual(BOOST_CONTAINER_MOVE_NAMESPACE::move(c_));
+ a_.deallocate_individual(boost::move(c_));
}
};
@@ -177,7 +177,7 @@
typedef allocator_destroyer<NodeAlloc> Destroyer;
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(node_alloc_holder)
+ BOOST_COPYABLE_AND_MOVABLE(node_alloc_holder)
public:
@@ -189,14 +189,14 @@
: members_(other.node_alloc())
{}
- node_alloc_holder(BOOST_MOVE_MACRO_RV_REF(node_alloc_holder) other)
- : members_(BOOST_CONTAINER_MOVE_NAMESPACE::move(other.node_alloc()))
+ node_alloc_holder(BOOST_RV_REF(node_alloc_holder) other)
+ : members_(boost::move(other.node_alloc()))
{ this->swap(other); }
- node_alloc_holder & operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(node_alloc_holder) other)
+ node_alloc_holder & operator=(BOOST_COPY_ASSIGN_REF(node_alloc_holder) other)
{ members_.assign(other.node_alloc()); }
- node_alloc_holder & operator=(BOOST_MOVE_MACRO_RV_REF(node_alloc_holder) other)
+ node_alloc_holder & operator=(BOOST_RV_REF(node_alloc_holder) other)
{ members_.assign(other.node_alloc()); }
template<class Pred>
@@ -205,7 +205,7 @@
{}
template<class Pred>
- node_alloc_holder(BOOST_MOVE_MACRO_RV_REF(ValAlloc) a, const Pred &c)
+ node_alloc_holder(BOOST_RV_REF(ValAlloc) a, const Pred &c)
: members_(a, typename ICont::value_compare(c))
{}
@@ -240,7 +240,7 @@
template<class Convertible1, class Convertible2>
static void construct(const NodePtr &ptr,
- BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(std::pair, Convertible1, Convertible2) value)
+ BOOST_RV_REF_2_TEMPL_ARGS(std::pair, Convertible1, Convertible2) value)
{
typedef typename Node::hook_type hook_type;
typedef typename Node::value_type::first_type first_type;
@@ -251,9 +251,9 @@
new(static_cast<hook_type*>(nodeptr))hook_type();
//Now construct pair members_holder
value_type *valueptr = &nodeptr->get_data();
- new((void*)&valueptr->first) first_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(value.first));
+ new((void*)&valueptr->first) first_type(boost::move(value.first));
BOOST_TRY{
- new((void*)&valueptr->second) second_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(value.second));
+ new((void*)&valueptr->second) second_type(boost::move(value.second));
}
BOOST_CATCH(...){
valueptr->first.~first_type();
@@ -275,14 +275,14 @@
template<class ...Args>
static void construct(const NodePtr &ptr, Args &&...args)
- { new((void*)containers_detail::get_pointer(ptr)) Node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { new((void*)containers_detail::get_pointer(ptr)) Node(boost::forward<Args>(args)...); }
template<class ...Args>
NodePtr create_node(Args &&...args)
{
NodePtr p = this->allocate_one();
Deallocator node_deallocator(p, this->node_alloc());
- self_t::construct(p, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ self_t::construct(p, boost::forward<Args>(args)...);
node_deallocator.release();
return (p);
}
@@ -383,7 +383,7 @@
if(constructed){
this->destroy(p);
}
- this->node_alloc().deallocate_individual(BOOST_CONTAINER_MOVE_NAMESPACE::move(mem));
+ this->node_alloc().deallocate_individual(boost::move(mem));
BOOST_RETHROW
}
BOOST_CATCH_END
@@ -399,9 +399,9 @@
typename NodeAlloc::multiallocation_chain chain;
allocator_destroyer_and_chain_builder<NodeAlloc> builder(this->node_alloc(), chain);
this->icont().clear_and_dispose(builder);
- BOOST_STATIC_ASSERT((::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<typename NodeAlloc::multiallocation_chain>::value == true));
+ //BOOST_STATIC_ASSERT((::boost::has_move_emulation_enabled<typename NodeAlloc::multiallocation_chain>::value == true));
if(!chain.empty())
- this->node_alloc().deallocate_individual(BOOST_CONTAINER_MOVE_NAMESPACE::move(chain));
+ this->node_alloc().deallocate_individual(boost::move(chain));
}
icont_iterator erase_range(icont_iterator first, icont_iterator last, allocator_v1)
Modified: sandbox/move/boost/container/detail/node_pool_impl.hpp
==============================================================================
--- sandbox/move/boost/container/detail/node_pool_impl.hpp (original)
+++ sandbox/move/boost/container/detail/node_pool_impl.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -26,7 +26,7 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_POOL_COMMON_HPP
-#include <cassert>
+#include <boost/assert.hpp>
#include <cstddef>
#include <functional> //std::unary_function
@@ -49,6 +49,7 @@
typedef typename node_slist<void_pointer>::node_t node_t;
typedef typename node_slist<void_pointer>::node_slist_t free_nodes_t;
typedef typename SegmentManagerBase::multiallocation_chain multiallocation_chain;
+ typedef typename SegmentManagerBase::size_type size_type;
private:
typedef typename bi::make_slist
@@ -61,9 +62,9 @@
typedef SegmentManagerBase segment_manager_base_type;
//!Constructor from a segment manager. Never throws
- private_node_pool_impl(segment_manager_base_type *segment_mngr_base, std::size_t node_size, std::size_t nodes_per_block)
+ private_node_pool_impl(segment_manager_base_type *segment_mngr_base, size_type node_size, size_type nodes_per_block)
: m_nodes_per_block(nodes_per_block)
- , m_real_node_size(lcm(node_size, std::size_t(alignment_of<node_t>::value)))
+ , m_real_node_size(lcm(node_size, size_type(alignment_of<node_t>::value)))
//General purpose allocator
, mp_segment_mngr_base(segment_mngr_base)
, m_blocklist()
@@ -76,7 +77,7 @@
~private_node_pool_impl()
{ this->purge_blocks(); }
- std::size_t get_real_num_node() const
+ size_type get_real_num_node() const
{ return m_nodes_per_block; }
//!Returns the segment manager. Never throws
@@ -91,10 +92,10 @@
{ priv_dealloc_node(ptr); }
//!Allocates a singly linked list of n nodes ending in null pointer.
- multiallocation_chain allocate_nodes(const std::size_t n)
+ multiallocation_chain allocate_nodes(const size_type n)
{
//Preallocate all needed blocks to fulfill the request
- std::size_t cur_nodes = m_freelist.size();
+ size_type cur_nodes = m_freelist.size();
if(cur_nodes < n){
priv_alloc_block(((n - cur_nodes) - 1)/m_nodes_per_block + 1);
}
@@ -102,7 +103,7 @@
//We just iterate the needed nodes to get the last we'll erase
typedef typename free_nodes_t::iterator free_iterator;
free_iterator before_last_new_it = m_freelist.before_begin();
- for(std::size_t j = 0; j != n; ++j){
+ for(size_type j = 0; j != n; ++j){
++before_last_new_it;
}
@@ -120,7 +121,7 @@
multiallocation_chain chain;
chain.incorporate_after(chain.before_begin(), &*first_node, &*last_node, n);
m_allocated += n;
- return BOOST_CONTAINER_MOVE_NAMESPACE::move(chain);
+ return boost::move(chain);
}
void deallocate_nodes(multiallocation_chain chain)
@@ -145,8 +146,8 @@
nodelist_iterator backup_list_last = backup_list.before_begin();
//Execute the algorithm and get an iterator to the last value
- std::size_t blocksize = get_rounded_size
- (m_real_node_size*m_nodes_per_block, alignment_of<node_t>::value);
+ size_type blocksize = get_rounded_size
+ (m_real_node_size*m_nodes_per_block, (size_type) alignment_of<node_t>::value);
while(it != itend){
//Collect all the nodes from the block pointed by it
@@ -185,7 +186,7 @@
}
}
//We should have removed all the nodes from the free list
- assert(m_freelist.empty());
+ BOOST_ASSERT(m_freelist.empty());
//Now pass all the node to the free list again
m_freelist.splice_after
@@ -196,7 +197,7 @@
, backup_list.size());
}
- std::size_t num_free_nodes()
+ size_type num_free_nodes()
{ return m_freelist.size(); }
//!Deallocates all used memory. Precondition: all nodes allocated from this pool should
@@ -204,9 +205,9 @@
void purge_blocks()
{
//check for memory leaks
- assert(m_allocated==0);
- std::size_t blocksize = get_rounded_size
- (m_real_node_size*m_nodes_per_block, alignment_of<node_t>::value);
+ BOOST_ASSERT(m_allocated==0);
+ size_type blocksize = get_rounded_size
+ (m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value);
typename blockslist_t::iterator
it(m_blocklist.begin()), itend(m_blocklist.end()), aux;
@@ -222,8 +223,8 @@
void swap(private_node_pool_impl &other)
{
- assert(m_nodes_per_block == other.m_nodes_per_block);
- assert(m_real_node_size == other.m_real_node_size);
+ BOOST_ASSERT(m_nodes_per_block == other.m_nodes_per_block);
+ BOOST_ASSERT(m_real_node_size == other.m_real_node_size);
std::swap(mp_segment_mngr_base, other.mp_segment_mngr_base);
m_blocklist.swap(other.m_blocklist);
m_freelist.swap(other.m_freelist);
@@ -289,20 +290,20 @@
//We put the node at the beginning of the free node list
node_t * to_deallocate = static_cast<node_t*>(pElem);
m_freelist.push_front(*to_deallocate);
- assert(m_allocated>0);
+ BOOST_ASSERT(m_allocated>0);
--m_allocated;
}
//!Allocates several blocks of nodes. Can throw
- void priv_alloc_block(std::size_t num_blocks = 1)
+ void priv_alloc_block(size_type num_blocks = 1)
{
if(!num_blocks)
return;
- std::size_t blocksize =
- get_rounded_size(m_real_node_size*m_nodes_per_block, alignment_of<node_t>::value);
+ size_type blocksize =
+ get_rounded_size(m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value);
try{
- for(std::size_t i = 0; i != num_blocks; ++i){
+ for(size_type i = 0; i != num_blocks; ++i){
//We allocate a new NodeBlock and put it as first
//element in the free Node list
char *pNode = reinterpret_cast<char*>
@@ -312,7 +313,7 @@
//We initialize all Nodes in Node Block to insert
//them in the free Node list
- for(std::size_t i = 0; i < m_nodes_per_block; ++i, pNode += m_real_node_size){
+ for(size_type i = 0; i < m_nodes_per_block; ++i, pNode += m_real_node_size){
m_freelist.push_front(*new (pNode) node_t);
}
}
@@ -333,13 +334,13 @@
private:
//!Returns a reference to the block hook placed in the end of the block
- static node_t & get_block_hook (void *block, std::size_t blocksize)
+ static node_t & get_block_hook (void *block, size_type blocksize)
{
return *reinterpret_cast<node_t*>(reinterpret_cast<char*>(block) + blocksize);
}
//!Returns the starting address of the block reference to the block hook placed in the end of the block
- void *get_block_from_hook (node_t *hook, std::size_t blocksize)
+ void *get_block_from_hook (node_t *hook, size_type blocksize)
{
return (reinterpret_cast<char*>(hook) - blocksize);
}
@@ -348,12 +349,12 @@
typedef typename boost::pointer_to_other
<void_pointer, segment_manager_base_type>::type segment_mngr_base_ptr_t;
- const std::size_t m_nodes_per_block;
- const std::size_t m_real_node_size;
+ const size_type m_nodes_per_block;
+ const size_type m_real_node_size;
segment_mngr_base_ptr_t mp_segment_mngr_base; //Segment manager
blockslist_t m_blocklist; //Intrusive container of blocks
free_nodes_t m_freelist; //Intrusive container of free nods
- std::size_t m_allocated; //Used nodes for debugging
+ size_type m_allocated; //Used nodes for debugging
};
Modified: sandbox/move/boost/container/detail/pair.hpp
==============================================================================
--- sandbox/move/boost/container/detail/pair.hpp (original)
+++ sandbox/move/boost/container/detail/pair.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -25,7 +25,8 @@
#include <utility> //std::pair
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
+#include <boost/type_traits/is_class.hpp>
#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
#include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
@@ -36,10 +37,36 @@
namespace containers_detail {
template <class T1, class T2>
+struct pair;
+
+template <class T>
+struct is_pair
+{
+ static const bool value = false;
+};
+
+template <class T1, class T2>
+struct is_pair< pair<T1, T2> >
+{
+ static const bool value = true;
+};
+
+template <class T1, class T2>
+struct is_pair< std::pair<T1, T2> >
+{
+ static const bool value = true;
+};
+
+struct pair_nat;
+
+struct piecewise_construct_t { };
+static const piecewise_construct_t piecewise_construct = piecewise_construct_t();
+
+template <class T1, class T2>
struct pair
{
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(pair)
+ BOOST_COPYABLE_AND_MOVABLE(pair)
public:
typedef T1 first_type;
@@ -48,109 +75,173 @@
T1 first;
T2 second;
- //std::pair compatibility
- template <class D, class S>
- pair(const std::pair<D, S>& p)
- : first(p.first), second(p.second)
+ //Default constructor
+ pair()
+ : first(), second()
{}
+/*
+ //pair from two values
+ pair(const T1 &t1, const T2 &t2)
+ : first(t1)
+ , second(t2)
+ {}
+
- //To resolve ambiguity with the variadic constructor of 1 argument
- //and the previous constructor
- pair(std::pair<T1, T2>& x)
+ //pair from two values
+ pair(BOOST_RV_REF(T1) t1, BOOST_RV_REF(T2) t2)
+ : first(::boost::move(t1))
+ , second(::boost::move(t2))
+ {}
+*/
+ template<class U, class V>
+ pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v)
+ : first(::boost::forward<U>(u))
+ , second(::boost::forward<V>(v))
+ {}
+
+ //pair copy assignment
+ pair(const pair& x)
: first(x.first), second(x.second)
{}
template <class D, class S>
- pair(BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
- : first(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first)), second(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second))
+ pair(const pair<D, S> &p)
+ : first(p.first), second(p.second)
{}
- pair()
- : first(), second()
+ //pair move constructor
+ pair(BOOST_RV_REF(pair) p)
+ : first(::boost::move(p.first)), second(::boost::move(p.second))
{}
- pair(const pair<T1, T2>& x)
- : first(x.first), second(x.second)
+ template <class D, class S>
+ pair(BOOST_RV_REF_2_TEMPL_ARGS(pair, D, S) p)
+ : first(::boost::move(p.first)), second(::boost::move(p.second))
{}
- //To resolve ambiguity with the variadic constructor of 1 argument
- //and the copy constructor
- pair(pair<T1, T2>& x)
+ //std::pair copy constructor
+ pair(const std::pair<T1, T2>& x)
: first(x.first), second(x.second)
{}
- pair(BOOST_MOVE_MACRO_RV_REF(pair) p)
- : first(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first)), second(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second))
+ template <class D, class S>
+ pair(const std::pair<D, S>& p)
+ : first(p.first), second(p.second)
{}
+ //std::pair move constructor
template <class D, class S>
- pair(BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(pair, D, S) p)
- : first(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first)), second(BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second))
+ pair(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
+ : first(::boost::move(p.first)), second(::boost::move(p.second))
{}
- #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ pair(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p)
+ : first(::boost::move(p.first)), second(::boost::move(p.second))
+ {}
- template<class U, class ...Args>
- pair(U &&u, Args &&... args)
- : first(BOOST_CONTAINER_MOVE_NAMESPACE::forward<U>(u))
- , second(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)
+ //piecewise_construct missing
+/*
+ //Variadic versions
+ template<class U>
+ pair(BOOST_CONTAINERS_PARAM(U, u), typename containers_detail::disable_if
+ < containers_detail::is_pair< typename containers_detail::remove_ref_const<U>::type >, pair_nat>::type* = 0)
+ : first(::boost::forward<U>(u))
+ , second()
{}
- #else
+ #ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
- template<class U>
- pair( BOOST_CONTAINERS_PARAM(U, u)
- #ifdef BOOST_NO_RVALUE_REFERENCES
- , typename containers_detail::disable_if
- < containers_detail::is_same<U, ::BOOST_CONTAINER_MOVE_NAMESPACE::rv<pair> > >::type* = 0
- #endif
- )
- : first(BOOST_CONTAINER_MOVE_NAMESPACE::forward<U>(const_cast<U&>(u)))
+ template<class U, class V, class ...Args>
+ pair(U &&u, V &&v)
+ : first(::boost::forward<U>(u))
+ , second(::boost::forward<V>(v), ::boost::forward<Args>(args)...)
{}
+ #else
+
#define BOOST_PP_LOCAL_MACRO(n) \
template<class U, BOOST_PP_ENUM_PARAMS(n, class P)> \
pair(BOOST_CONTAINERS_PARAM(U, u) \
,BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
- : first(BOOST_CONTAINER_MOVE_NAMESPACE::forward<U>(const_cast<U&>(u))) \
+ : first(::boost::forward<U>(u)) \
, second(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)) \
{} \
//!
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE()
#endif
+*/
+ //pair copy assignment
+ pair& operator=(BOOST_COPY_ASSIGN_REF(pair) p)
+ {
+ first = p.first;
+ second = p.second;
+ return *this;
+ }
- pair& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(pair) p)
+ template <class D, class S>
+ pair& operator=(const pair<D, S>&p)
{
first = p.first;
second = p.second;
return *this;
}
- pair& operator=(BOOST_MOVE_MACRO_RV_REF(pair) p)
+ //pair move assignment
+ pair& operator=(BOOST_RV_REF(pair) p)
{
- first = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first);
- second = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second);
+ first = ::boost::move(p.first);
+ second = ::boost::move(p.second);
return *this;
}
- pair& operator=(BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p)
+ template <class D, class S>
+ pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(pair, D, S) p)
{
- first = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first);
- second = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second);
+ first = ::boost::move(p.first);
+ second = ::boost::move(p.second);
+ return *this;
+ }
+
+ //std::pair copy assignment
+ pair& operator=(const std::pair<T1, T2> &p)
+ {
+ first = p.first;
+ second = p.second;
return *this;
}
template <class D, class S>
- pair& operator=(BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
+ pair& operator=(const std::pair<D, S> &p)
+ {
+ first = ::boost::move(p.first);
+ second = ::boost::move(p.second);
+ return *this;
+ }
+
+ //std::pair move assignment
+ pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, T1, T2) p)
{
- first = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.first);
- second = BOOST_CONTAINER_MOVE_NAMESPACE::move(p.second);
+ first = ::boost::move(p.first);
+ second = ::boost::move(p.second);
return *this;
}
+ template <class D, class S>
+ pair& operator=(BOOST_RV_REF_2_TEMPL_ARGS(std::pair, D, S) p)
+ {
+ first = ::boost::move(p.first);
+ second = ::boost::move(p.second);
+ return *this;
+ }
+
+ //swap
void swap(pair& p)
- { std::swap(*this, p); }
+ {
+ using std::swap;
+ swap(this->first, p.first);
+ swap(this->second, p.second);
+ }
};
template <class T1, class T2>
@@ -205,6 +296,23 @@
static const bool value = false;
};
+//This specialization is needed to avoid instantiation of pair in
+//is_class, and allow recursive maps.
+template <class T1, class T2>
+struct is_class< ::boost::container::containers_detail::pair<T1, T2> >
+ : public ::boost::true_type
+{};
+
+#ifdef BOOST_NO_RVALUE_REFERENCES
+
+template<class T1, class T2>
+struct has_move_emulation_enabled< ::boost::container::containers_detail::pair<T1, T2> >
+ : ::boost::true_type
+{};
+
+#endif
+
+
} //namespace boost {
#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP
Modified: sandbox/move/boost/container/detail/preprocessor.hpp
==============================================================================
--- sandbox/move/boost/container/detail/preprocessor.hpp (original)
+++ sandbox/move/boost/container/detail/preprocessor.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -16,6 +16,11 @@
#endif
#include "config_begin.hpp"
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+#include INCLUDE_BOOST_CONTAINER_DETAIL_STORED_REF_HPP
+#endif
+
#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -57,9 +62,21 @@
#endif
#ifndef BOOST_NO_RVALUE_REFERENCES
+
+#ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
+
+#define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \
+ BOOST_PP_CAT(m_p, n) (boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \
+//!
+
+#else
+
#define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \
- BOOST_PP_CAT(m_p, n) (BOOST_PP_CAT(p, n)) \
+ BOOST_PP_CAT(m_p, n) (static_cast<BOOST_PP_CAT(P, n)>( BOOST_PP_CAT(p, n) )) \
//!
+
+#endif
+
#else
#define BOOST_CONTAINERS_AUX_PARAM_INIT(z, n, data) \
BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \
@@ -71,9 +88,22 @@
//!
#ifndef BOOST_NO_RVALUE_REFERENCES
+
+#if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+
+#define BOOST_CONTAINERS_AUX_PARAM_DEFINE(z, n, data) \
+ BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
+//!
+
+#else
+
#define BOOST_CONTAINERS_AUX_PARAM_DEFINE(z, n, data) \
BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \
//!
+
+#endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+
+
#else
#define BOOST_CONTAINERS_AUX_PARAM_DEFINE(z, n, data) \
BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
@@ -81,13 +111,23 @@
#endif
#define BOOST_CONTAINERS_PP_PARAM_FORWARD(z, n, data) \
-BOOST_CONTAINER_MOVE_NAMESPACE::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
+boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
//!
+#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+
#define BOOST_CONTAINERS_PP_MEMBER_FORWARD(z, n, data) \
-BOOST_CONTAINER_MOVE_NAMESPACE::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \
+::boost::container::containers_detail::stored_ref< BOOST_PP_CAT(P, n) >::forward( BOOST_PP_CAT(m_p, n) ) \
//!
+#else
+
+#define BOOST_CONTAINERS_PP_MEMBER_FORWARD(z, n, data) \
+boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \
+//!
+
+#endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+
#define BOOST_CONTAINERS_PP_MEMBER_IT_FORWARD(z, n, data) \
BOOST_PP_CAT(*m_p, n) \
//!
Added: sandbox/move/boost/container/detail/stored_ref.hpp
==============================================================================
--- (empty file)
+++ sandbox/move/boost/container/detail/stored_ref.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -0,0 +1,92 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2008-2009. 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/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINERS_DETAIL_STORED_REF_HPP
+#define BOOST_CONTAINERS_DETAIL_STORED_REF_HPP
+
+#include "config_begin.hpp"
+#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
+
+#ifndef BOOST_NO_RVALUE_REFERENCES
+
+namespace boost{
+namespace container{
+namespace containers_detail{
+
+template<class T>
+struct stored_ref
+{
+
+ static T && forward(T &t)
+ #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
+ { return t; }
+ #else
+ { return boost::move(t); }
+ #endif
+};
+
+template<class T>
+struct stored_ref<const T>
+{
+ static const T && forward(const T &t)
+ #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
+ { return t; }
+ #else
+ { return static_cast<const T&&>(t); }
+ #endif
+};
+
+template<class T>
+struct stored_ref<T&&>
+{
+ static T && forward(T &t)
+ #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
+ { return t; }
+ #else
+ { return boost::move(t); }
+ #endif
+};
+
+template<class T>
+struct stored_ref<const T&&>
+{
+ static const T && forward(const T &t)
+ #ifdef BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
+ { return t; }
+ #else
+ { return static_cast<const T &&>(t); }
+ #endif
+};
+
+template<class T>
+struct stored_ref<const T&>
+{
+ static const T & forward(const T &t)
+ { return t; }
+};
+
+template<class T>
+struct stored_ref<T&>
+{
+ static T & forward(T &t)
+ { return t; }
+};
+
+} //namespace containers_detail{
+} //namespace container{
+} //namespace boost{
+
+#else
+#error "This header can be included only for compiler with rvalue references"
+#endif //BOOST_NO_RVALUE_REFERENCES
+
+#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP
+
+#endif //BOOST_CONTAINERS_DETAIL_STORED_REF_HPP
Modified: sandbox/move/boost/container/detail/transform_iterator.hpp
==============================================================================
--- sandbox/move/boost/container/detail/transform_iterator.hpp (original)
+++ sandbox/move/boost/container/detail/transform_iterator.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -47,11 +47,11 @@
: m_value(px)
{}
- T* operator->() const { return &m_value; }
+ T* operator->() const { return const_cast<T*>(&m_value); }
// This function is needed for MWCW and BCC, which won't call operator->
// again automatically per 13.3.1.2 para 8
// operator T*() const { return &m_value; }
- mutable T &m_value;
+ T &m_value;
};
template <class Iterator, class UnaryFunction>
Modified: sandbox/move/boost/container/detail/tree.hpp
==============================================================================
--- sandbox/move/boost/container/detail/tree.hpp (original)
+++ sandbox/move/boost/container/detail/tree.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -15,7 +15,7 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
#include <boost/pointer_to_other.hpp>
#include <boost/type_traits/has_trivial_destructor.hpp>
#include <boost/detail/no_exceptions_support.hpp>
@@ -26,6 +26,7 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_NODE_ALLOC_HOLDER_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_DESTROYERS_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_PAIR_HPP
+#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP
#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
#include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
#endif
@@ -47,7 +48,7 @@
typedef KeyOfValue key_of_value;
typedef Key key_type;
- value_compare_impl(key_compare kcomp)
+ value_compare_impl(const key_compare &kcomp)
: key_compare(kcomp)
{}
@@ -57,9 +58,25 @@
key_compare &key_comp()
{ return static_cast<key_compare &>(*this); }
- template<class A, class B>
- bool operator()(const A &a, const B &b) const
- { return key_compare::operator()(KeyOfValue()(a), KeyOfValue()(b)); }
+ template<class T>
+ struct is_key
+ {
+ static const bool value = is_same<const T, const key_type>::value;
+ };
+
+ template<class T>
+ typename enable_if_c<is_key<T>::value, const key_type &>::type
+ key_forward(const T &key) const
+ { return key; }
+
+ template<class T>
+ typename enable_if_c<!is_key<T>::value, const key_type &>::type
+ key_forward(const T &key) const
+ { return KeyOfValue()(key); }
+
+ template<class KeyType, class KeyType2>
+ bool operator()(const KeyType &key1, const KeyType2 &key2) const
+ { return key_compare::operator()(this->key_forward(key1), this->key_forward(key2)); }
};
template<class VoidPointer>
@@ -122,7 +139,7 @@
template<class ...Args>
rbtree_node(Args &&...args)
- : m_data(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)
+ : m_data(boost::forward<Args>(args)...)
{}
#endif//#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -164,8 +181,8 @@
public:
template<class Convertible>
- static void construct(node_type *ptr, BOOST_MOVE_MACRO_FWD_REF(Convertible) convertible)
- { new(ptr) node_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Convertible>(convertible)); }
+ static void construct(node_type *ptr, BOOST_FWD_REF(Convertible) convertible)
+ { new(ptr) node_type(boost::forward<Convertible>(convertible)); }
};
}//namespace containers_detail {
@@ -267,7 +284,7 @@
AllocHolder &m_holder;
Icont &m_icont;
};
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(rbtree)
+ BOOST_COPYABLE_AND_MOVABLE(rbtree)
public:
@@ -296,17 +313,29 @@
struct key_node_compare
: private KeyValueCompare
{
- key_node_compare(KeyValueCompare comp)
+ key_node_compare(const KeyValueCompare &comp)
: KeyValueCompare(comp)
{}
-
- template<class KeyType>
- bool operator()(const Node &n, const KeyType &k) const
- { return KeyValueCompare::operator()(n.get_data(), k); }
-
- template<class KeyType>
- bool operator()(const KeyType &k, const Node &n) const
- { return KeyValueCompare::operator()(k, n.get_data()); }
+
+ template<class T>
+ struct is_node
+ {
+ static const bool value = is_same<T, Node>::value;
+ };
+
+ template<class T>
+ typename enable_if_c<is_node<T>::value, const value_type &>::type
+ key_forward(const T &node) const
+ { return node.get_data(); }
+
+ template<class T>
+ typename enable_if_c<!is_node<T>::value, const T &>::type
+ key_forward(const T &key) const
+ { return key; }
+
+ template<class KeyType, class KeyType2>
+ bool operator()(const KeyType &key1, const KeyType2 &key2) const
+ { return KeyValueCompare::operator()(this->key_forward(key1), this->key_forward(key2)); }
};
typedef key_node_compare<value_compare> KeyNodeCompare;
@@ -437,14 +466,14 @@
(x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
}
- rbtree(BOOST_MOVE_MACRO_RV_REF(rbtree) x)
+ rbtree(BOOST_RV_REF(rbtree) x)
: AllocHolder(x, x.key_comp())
{ this->swap(x); }
~rbtree()
{} //AllocHolder clears the tree
- rbtree& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(rbtree) x)
+ rbtree& operator=(BOOST_COPY_ASSIGN_REF(rbtree) x)
{
if (this != &x) {
//Transfer all the nodes to a temporary tree
@@ -469,7 +498,7 @@
return *this;
}
- rbtree& operator=(BOOST_MOVE_MACRO_RV_REF(rbtree) mx)
+ rbtree& operator=(BOOST_RV_REF(rbtree) mx)
{ this->clear(); this->swap(mx); return *this; }
public:
@@ -589,9 +618,9 @@
template<class MovableConvertible>
iterator insert_unique_commit
- (BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv, insert_commit_data &data)
+ (BOOST_FWD_REF(MovableConvertible) mv, insert_commit_data &data)
{
- NodePtr tmp = AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<MovableConvertible>(mv));
+ NodePtr tmp = AllocHolder::create_node(boost::forward<MovableConvertible>(mv));
iiterator it(this->icont().insert_unique_commit(*tmp, data));
return iterator(it);
}
@@ -608,7 +637,7 @@
}
template<class MovableConvertible>
- std::pair<iterator,bool> insert_unique(BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv)
+ std::pair<iterator,bool> insert_unique(BOOST_FWD_REF(MovableConvertible) mv)
{
insert_commit_data data;
std::pair<iterator,bool> ret =
@@ -616,7 +645,7 @@
if(!ret.second)
return ret;
return std::pair<iterator,bool>
- (this->insert_unique_commit(BOOST_CONTAINER_MOVE_NAMESPACE::forward<MovableConvertible>(mv), data), true);
+ (this->insert_unique_commit(boost::forward<MovableConvertible>(mv), data), true);
}
private:
@@ -652,23 +681,23 @@
template <class... Args>
iterator emplace_unique(Args&&... args)
- { return this->emplace_unique_impl(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)); }
+ { return this->emplace_unique_impl(AllocHolder::create_node(boost::forward<Args>(args)...)); }
template <class... Args>
iterator emplace_hint_unique(const_iterator hint, Args&&... args)
- { return this->emplace_unique_hint_impl(hint, AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)); }
+ { return this->emplace_unique_hint_impl(hint, AllocHolder::create_node(boost::forward<Args>(args)...)); }
template <class... Args>
iterator emplace_equal(Args&&... args)
{
- NodePtr p(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...));
+ NodePtr p(AllocHolder::create_node(boost::forward<Args>(args)...));
return iterator(this->icont().insert_equal(this->icont().end(), *p));
}
template <class... Args>
iterator emplace_hint_equal(const_iterator hint, Args&&... args)
{
- NodePtr p(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...));
+ NodePtr p(AllocHolder::create_node(boost::forward<Args>(args)...));
return iterator(this->icont().insert_equal(hint.get(), *p));
}
@@ -737,14 +766,14 @@
}
template<class MovableConvertible>
- iterator insert_unique(const_iterator hint, BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv)
+ iterator insert_unique(const_iterator hint, BOOST_FWD_REF(MovableConvertible) mv)
{
insert_commit_data data;
std::pair<iterator,bool> ret =
this->insert_unique_check(hint, KeyOfValue()(mv), data);
if(!ret.second)
return ret.first;
- return this->insert_unique_commit(BOOST_CONTAINER_MOVE_NAMESPACE::forward<MovableConvertible>(mv), data);
+ return this->insert_unique_commit(boost::forward<MovableConvertible>(mv), data);
}
template <class InputIterator>
@@ -770,9 +799,9 @@
}
template<class MovableConvertible>
- iterator insert_equal(BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv)
+ iterator insert_equal(BOOST_FWD_REF(MovableConvertible) mv)
{
- NodePtr p(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<MovableConvertible>(mv)));
+ NodePtr p(AllocHolder::create_node(boost::forward<MovableConvertible>(mv)));
return iterator(this->icont().insert_equal(this->icont().end(), *p));
}
@@ -783,9 +812,9 @@
}
template<class MovableConvertible>
- iterator insert_equal(const_iterator hint, BOOST_MOVE_MACRO_FWD_REF(MovableConvertible) mv)
+ iterator insert_equal(const_iterator hint, BOOST_FWD_REF(MovableConvertible) mv)
{
- NodePtr p(AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<MovableConvertible>(mv)));
+ NodePtr p(AllocHolder::create_node(boost::forward<MovableConvertible>(mv)));
return iterator(this->icont().insert_equal(hint.get(), *p));
}
Modified: sandbox/move/boost/container/detail/type_traits.hpp
==============================================================================
--- sandbox/move/boost/container/detail/type_traits.hpp (original)
+++ sandbox/move/boost/container/detail/type_traits.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -21,6 +21,8 @@
#include "config_begin.hpp"
+#include <boost/move/move.hpp>
+
namespace boost {
namespace container {
namespace containers_detail {
@@ -81,6 +83,24 @@
typedef T type;
};
+#ifndef BOOST_NO_RVALUE_REFERENCES
+
+template<class T>
+struct remove_reference<T&&>
+{
+ typedef T type;
+};
+
+#else
+
+template<class T>
+struct remove_reference< ::boost::rv<T> >
+{
+ typedef T type;
+};
+
+#endif
+
template<class T>
struct is_reference
{
@@ -156,11 +176,28 @@
static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u));
};
+template<class T>
+struct remove_const
+{
+ typedef T type;
+};
+
+template<class T>
+struct remove_const< const T>
+{
+ typedef T type;
+};
+
+template<class T>
+struct remove_ref_const
+{
+ typedef typename remove_const< typename remove_reference<T>::type >::type type;
+};
+
} // namespace containers_detail
} //namespace container {
} //namespace boost {
-#endif //#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_TYPE_TRAITS_HPP
-
#include INCLUDE_BOOST_CONTAINER_DETAIL_CONFIG_END_HPP
+#endif //#ifndef BOOST_CONTAINERS_CONTAINER_DETAIL_TYPE_TRAITS_HPP
Modified: sandbox/move/boost/container/detail/utilities.hpp
==============================================================================
--- sandbox/move/boost/container/detail/utilities.hpp (original)
+++ sandbox/move/boost/container/detail/utilities.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -17,7 +17,8 @@
#include <boost/type_traits/is_pointer.hpp>
#include <boost/type_traits/is_enum.hpp>
#include <boost/type_traits/is_member_pointer.hpp>
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/type_traits/is_class.hpp>
+#include <boost/move/move.hpp>
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP
#include <algorithm>
@@ -26,6 +27,14 @@
namespace container {
namespace containers_detail {
+template<class T>
+const T &max_value(const T &a, const T &b)
+{ return a > b ? a : b; }
+
+template<class T>
+const T &min_value(const T &a, const T &b)
+{ return a < b ? a : b; }
+
template <class SizeType>
SizeType
get_next_capacity(const SizeType max_size
@@ -46,14 +55,6 @@
return max_size;
}
-template<class T>
-const T &max_value(const T &a, const T &b)
-{ return a > b ? a : b; }
-
-template<class T>
-const T &min_value(const T &a, const T &b)
-{ return a < b ? a : b; }
-
template<class SmartPtr>
struct smart_ptr_type
{
@@ -87,7 +88,8 @@
}
//Rounds "orig_size" by excess to round_to bytes
-inline std::size_t get_rounded_size(std::size_t orig_size, std::size_t round_to)
+template<class SizeType>
+inline SizeType get_rounded_size(SizeType orig_size, SizeType round_to)
{
return ((orig_size-1)/round_to+1)*round_to;
}
@@ -131,10 +133,10 @@
template<class T>
struct move_const_ref_type
: if_c
- < ::boost::is_fundamental<T>::value || ::boost::is_pointer<T>::value ||
- ::boost::is_member_pointer<T>::value || ::boost::is_enum<T>::value
+// < ::boost::is_fundamental<T>::value || ::boost::is_pointer<T>::value || ::boost::is_member_pointer<T>::value || ::boost::is_enum<T>::value
+ < !::boost::is_class<T>::value
,const T &
- ,BOOST_MOVE_MACRO_CATCH_CONST_RLVALUE(T)
+ ,BOOST_CATCH_CONST_RLVALUE(T)
>
{};
Modified: sandbox/move/boost/container/detail/version_type.hpp
==============================================================================
--- sandbox/move/boost/container/detail/version_type.hpp (original)
+++ sandbox/move/boost/container/detail/version_type.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -21,7 +21,6 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP
-
namespace boost{
namespace container {
namespace containers_detail {
@@ -88,4 +87,6 @@
} //namespace container {
} //namespace boost{
+#include "config_end.hpp"
+
#endif //#define BOOST_CONTAINERS_DETAIL_VERSION_TYPE_HPP
Modified: sandbox/move/boost/container/detail/workaround.hpp
==============================================================================
--- sandbox/move/boost/container/detail/workaround.hpp (original)
+++ sandbox/move/boost/container/detail/workaround.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2011. 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)
//
@@ -14,7 +14,7 @@
#include "config_begin.hpp"
#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\
- && !defined(BOOST_MOVE_MACRO_DISABLE_VARIADIC_TMPL)
+ && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL)
#define BOOST_CONTAINERS_PERFECT_FORWARDING
#endif
Modified: sandbox/move/boost/container/flat_map.hpp
==============================================================================
--- sandbox/move/boost/container/flat_map.hpp (original)
+++ sandbox/move/boost/container/flat_map.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -26,7 +26,7 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_FLAT_TREE_HPP
#include <boost/type_traits/has_trivial_destructor.hpp>
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost {
@@ -76,7 +76,7 @@
{
/// @cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_map)
+ BOOST_COPYABLE_AND_MOVABLE(flat_map)
//This is the tree that we should store if pair was movable
typedef containers_detail::flat_tree<Key,
std::pair<Key, T>,
@@ -192,14 +192,14 @@
//! <b>Complexity</b>: Construct.
//!
//! <b>Postcondition</b>: x is emptied.
- flat_map(BOOST_MOVE_MACRO_RV_REF(flat_map) x)
- : m_flat_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_flat_tree))
+ flat_map(BOOST_RV_REF(flat_map) x)
+ : m_flat_tree(boost::move(x.m_flat_tree))
{}
//! <b>Effects</b>: Makes *this a copy of x.
//!
//! <b>Complexity</b>: Linear in x.size().
- flat_map<Key,T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_map) x)
+ flat_map<Key,T,Pred,Alloc>& operator=(BOOST_COPY_ASSIGN_REF(flat_map) x)
{ m_flat_tree = x.m_flat_tree; return *this; }
//! <b>Effects</b>: Move constructs a flat_map.
@@ -208,8 +208,8 @@
//! <b>Complexity</b>: Construct.
//!
//! <b>Postcondition</b>: x is emptied.
- flat_map<Key,T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_RV_REF(flat_map) mx)
- { m_flat_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree); return *this; }
+ flat_map<Key,T,Pred,Alloc>& operator=(BOOST_RV_REF(flat_map) mx)
+ { m_flat_tree = boost::move(mx.m_flat_tree); return *this; }
//! <b>Effects</b>: Returns the comparison object out
//! of which a was constructed.
@@ -385,13 +385,13 @@
//! Returns: A reference to the mapped_type corresponding to x in *this.
//!
//! Complexity: Logarithmic.
- T &operator[](BOOST_MOVE_MACRO_RV_REF(key_type) mk)
+ T &operator[](BOOST_RV_REF(key_type) mk)
{
key_type &k = mk;
iterator i = lower_bound(k);
// i->first is greater than or equivalent to k.
if (i == end() || key_comp()(k, (*i).first))
- i = insert(i, value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(k), BOOST_CONTAINER_MOVE_NAMESPACE::move(T())));
+ i = insert(i, value_type(boost::move(k), boost::move(T())));
return (*i).second;
}
@@ -454,9 +454,9 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
+ std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
{ return force<std::pair<iterator,bool> >(
- m_flat_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(force<impl_value_type>(x)))); }
+ m_flat_tree.insert_unique(boost::move(force<impl_value_type>(x)))); }
//! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
//! only if there is no element in the container with key equivalent to the key of x.
@@ -469,10 +469,10 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(impl_value_type) x)
+ std::pair<iterator,bool> insert(BOOST_RV_REF(impl_value_type) x)
{
return force<std::pair<iterator,bool> >
- (m_flat_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)));
+ (m_flat_tree.insert_unique(boost::move(x)));
}
//! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
@@ -499,9 +499,9 @@
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x)
+ iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
{ return force_copy<iterator>(
- m_flat_tree.insert_unique(force<impl_const_iterator>(position), BOOST_CONTAINER_MOVE_NAMESPACE::move(force<impl_value_type>(x)))); }
+ m_flat_tree.insert_unique(force<impl_const_iterator>(position), boost::move(force<impl_value_type>(x)))); }
//! <b>Effects</b>: Inserts an element move constructed from x in the container.
//! p is a hint pointing to where the insert should start to search.
@@ -512,10 +512,10 @@
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(impl_value_type) x)
+ iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x)
{
return force_copy<iterator>(
- m_flat_tree.insert_unique(force<impl_const_iterator>(position), BOOST_CONTAINER_MOVE_NAMESPACE::move(x)));
+ m_flat_tree.insert_unique(force<impl_const_iterator>(position), boost::move(x)));
}
//! <b>Requires</b>: i, j are not iterators into *this.
@@ -547,7 +547,7 @@
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
template <class... Args>
iterator emplace(Args&&... args)
- { return force_copy<iterator>(m_flat_tree.emplace_unique(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)); }
+ { return force_copy<iterator>(m_flat_tree.emplace_unique(boost::forward<Args>(args)...)); }
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the container if and only if there is
@@ -563,7 +563,7 @@
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
template <class... Args>
iterator emplace_hint(const_iterator hint, Args&&... args)
- { return force_copy<iterator>(m_flat_tree.emplace_hint_unique(force<impl_const_iterator>(hint), BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)); }
+ { return force_copy<iterator>(m_flat_tree.emplace_hint_unique(force<impl_const_iterator>(hint), boost::forward<Args>(args)...)); }
#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -818,7 +818,7 @@
{
/// @cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_multimap)
+ BOOST_COPYABLE_AND_MOVABLE(flat_multimap)
typedef containers_detail::flat_tree<Key,
std::pair<Key, T>,
containers_detail::select1st< std::pair<Key, T> >,
@@ -932,21 +932,21 @@
//! <b>Complexity</b>: Construct.
//!
//! <b>Postcondition</b>: x is emptied.
- flat_multimap(BOOST_MOVE_MACRO_RV_REF(flat_multimap) x)
- : m_flat_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_flat_tree))
+ flat_multimap(BOOST_RV_REF(flat_multimap) x)
+ : m_flat_tree(boost::move(x.m_flat_tree))
{ }
//! <b>Effects</b>: Makes *this a copy of x.
//!
//! <b>Complexity</b>: Linear in x.size().
- flat_multimap<Key,T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_multimap) x)
+ flat_multimap<Key,T,Pred,Alloc>& operator=(BOOST_COPY_ASSIGN_REF(flat_multimap) x)
{ m_flat_tree = x.m_flat_tree; return *this; }
//! <b>Effects</b>: this->swap(x.get()).
//!
//! <b>Complexity</b>: Constant.
- flat_multimap<Key,T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_RV_REF(flat_multimap) mx)
- { m_flat_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree); return *this; }
+ flat_multimap<Key,T,Pred,Alloc>& operator=(BOOST_RV_REF(flat_multimap) mx)
+ { m_flat_tree = boost::move(mx.m_flat_tree); return *this; }
//! <b>Effects</b>: Returns the comparison object out
//! of which a was constructed.
@@ -1093,8 +1093,8 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return force_copy<iterator>(m_flat_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); }
+ iterator insert(BOOST_RV_REF(value_type) x)
+ { return force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); }
//! <b>Effects</b>: Inserts a new value move-constructed from x and returns
//! the iterator pointing to the newly inserted element.
@@ -1103,8 +1103,8 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(BOOST_MOVE_MACRO_RV_REF(impl_value_type) x)
- { return force_copy<iterator>(m_flat_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); }
+ iterator insert(BOOST_RV_REF(impl_value_type) x)
+ { return force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); }
//! <b>Effects</b>: Inserts a copy of x in the container.
//! p is a hint pointing to where the insert should start to search.
@@ -1131,11 +1131,11 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x)
+ iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
{
return force_copy<iterator>
(m_flat_tree.insert_equal(force<impl_const_iterator>(position)
- , BOOST_CONTAINER_MOVE_NAMESPACE::move(x)));
+ , boost::move(x)));
}
//! <b>Effects</b>: Inserts a value move constructed from x in the container.
@@ -1149,10 +1149,10 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(impl_value_type) x)
+ iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x)
{
return force_copy<iterator>(
- m_flat_tree.insert_equal(force<impl_const_iterator>(position), BOOST_CONTAINER_MOVE_NAMESPACE::move(x)));
+ m_flat_tree.insert_equal(force<impl_const_iterator>(position), boost::move(x)));
}
//! <b>Requires</b>: i, j are not iterators into *this.
@@ -1179,7 +1179,7 @@
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
template <class... Args>
iterator emplace(Args&&... args)
- { return force_copy<iterator>(m_flat_tree.emplace_equal(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)); }
+ { return force_copy<iterator>(m_flat_tree.emplace_equal(boost::forward<Args>(args)...)); }
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the container.
@@ -1197,7 +1197,7 @@
iterator emplace_hint(const_iterator hint, Args&&... args)
{
return force_copy<iterator>(m_flat_tree.emplace_hint_equal
- (force<impl_const_iterator>(hint), BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...));
+ (force<impl_const_iterator>(hint), boost::forward<Args>(args)...));
}
#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
Modified: sandbox/move/boost/container/flat_set.hpp
==============================================================================
--- sandbox/move/boost/container/flat_set.hpp (original)
+++ sandbox/move/boost/container/flat_set.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -24,7 +24,7 @@
#include <memory>
#include INCLUDE_BOOST_CONTAINER_DETAIL_FLAT_TREE_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost {
@@ -65,7 +65,7 @@
{
/// @cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_set)
+ BOOST_COPYABLE_AND_MOVABLE(flat_set)
typedef containers_detail::flat_tree<T, T, containers_detail::identity<T>, Pred, Alloc> tree_t;
tree_t m_flat_tree; // flat tree representing flat_set
typedef typename containers_detail::
@@ -139,21 +139,21 @@
//! <b>Complexity</b>: Construct.
//!
//! <b>Postcondition</b>: x is emptied.
- flat_set(BOOST_MOVE_MACRO_RV_REF(flat_set) mx)
- : m_flat_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree))
+ flat_set(BOOST_RV_REF(flat_set) mx)
+ : m_flat_tree(boost::move(mx.m_flat_tree))
{}
//! <b>Effects</b>: Makes *this a copy of x.
//!
//! <b>Complexity</b>: Linear in x.size().
- flat_set<T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_set) x)
+ flat_set<T,Pred,Alloc>& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x)
{ m_flat_tree = x.m_flat_tree; return *this; }
//! <b>Effects</b>: Makes *this a copy of x.
//!
//! <b>Complexity</b>: Linear in x.size().
- flat_set<T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_RV_REF(flat_set) mx)
- { m_flat_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree); return *this; }
+ flat_set<T,Pred,Alloc>& operator=(BOOST_RV_REF(flat_set) mx)
+ { m_flat_tree = boost::move(mx.m_flat_tree); return *this; }
//! <b>Effects</b>: Returns the comparison object out
//! of which a was constructed.
@@ -336,7 +336,7 @@
{ return this->insert(const_cast<const T &>(x)); }
template<class U>
- std::pair<iterator, bool> insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ std::pair<iterator, bool> insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_insert(u); }
#endif
@@ -351,8 +351,8 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_flat_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
+ { return m_flat_tree.insert_unique(boost::move(x)); }
//! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
//! no element in the container with key equivalent to the key of x.
@@ -373,7 +373,7 @@
{ return this->insert(position, const_cast<const T &>(x)); }
template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_insert(position, u); }
#endif
@@ -386,8 +386,8 @@
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_flat_tree.insert_unique(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
+ { return m_flat_tree.insert_unique(position, boost::move(x)); }
//! <b>Requires</b>: i, j are not iterators into *this.
//!
@@ -418,7 +418,7 @@
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
template <class... Args>
iterator emplace(Args&&... args)
- { return m_flat_tree.emplace_unique(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_flat_tree.emplace_unique(boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the container if and only if there is
@@ -434,7 +434,7 @@
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
template <class... Args>
iterator emplace_hint(const_iterator hint, Args&&... args)
- { return m_flat_tree.emplace_hint_unique(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_flat_tree.emplace_hint_unique(hint, boost::forward<Args>(args)...); }
#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -685,7 +685,7 @@
{
/// @cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(flat_multiset)
+ BOOST_COPYABLE_AND_MOVABLE(flat_multiset)
typedef containers_detail::flat_tree<T, T, containers_detail::identity<T>, Pred, Alloc> tree_t;
tree_t m_flat_tree; // flat tree representing flat_multiset
typedef typename containers_detail::
@@ -740,15 +740,15 @@
flat_multiset(const flat_multiset<T,Pred,Alloc>& x)
: m_flat_tree(x.m_flat_tree) {}
- flat_multiset(BOOST_MOVE_MACRO_RV_REF(flat_multiset) x)
- : m_flat_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_flat_tree))
+ flat_multiset(BOOST_RV_REF(flat_multiset) x)
+ : m_flat_tree(boost::move(x.m_flat_tree))
{}
- flat_multiset<T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(flat_multiset) x)
+ flat_multiset<T,Pred,Alloc>& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x)
{ m_flat_tree = x.m_flat_tree; return *this; }
- flat_multiset<T,Pred,Alloc>& operator=(BOOST_MOVE_MACRO_RV_REF(flat_multiset) mx)
- { m_flat_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(mx.m_flat_tree); return *this; }
+ flat_multiset<T,Pred,Alloc>& operator=(BOOST_RV_REF(flat_multiset) mx)
+ { m_flat_tree = boost::move(mx.m_flat_tree); return *this; }
//! <b>Effects</b>: Returns the comparison object out
//! of which a was constructed.
@@ -927,7 +927,7 @@
{ return this->insert(const_cast<const T &>(x)); }
template<class U>
- iterator insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ iterator insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_insert(u); }
#endif
@@ -938,8 +938,8 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_flat_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(BOOST_RV_REF(value_type) x)
+ { return m_flat_tree.insert_equal(boost::move(x)); }
//! <b>Effects</b>: Inserts a copy of x in the container.
//! p is a hint pointing to where the insert should start to search.
@@ -959,7 +959,7 @@
{ return this->insert(position, const_cast<const T &>(x)); }
template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_insert(position, u); }
#endif
@@ -973,8 +973,8 @@
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_flat_tree.insert_equal(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
+ { return m_flat_tree.insert_equal(position, boost::move(x)); }
//! <b>Requires</b>: i, j are not iterators into *this.
//!
@@ -1000,7 +1000,7 @@
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
template <class... Args>
iterator emplace(Args&&... args)
- { return m_flat_tree.emplace_equal(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_flat_tree.emplace_equal(boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the container.
@@ -1015,7 +1015,7 @@
//! <b>Note</b>: If an element it's inserted it might invalidate elements.
template <class... Args>
iterator emplace_hint(const_iterator hint, Args&&... args)
- { return m_flat_tree.emplace_hint_equal(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_flat_tree.emplace_hint_equal(hint, boost::forward<Args>(args)...); }
#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
Modified: sandbox/move/boost/container/list.hpp
==============================================================================
--- sandbox/move/boost/container/list.hpp (original)
+++ sandbox/move/boost/container/list.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -18,7 +18,8 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
+#include <boost/move/move_helpers.hpp>
#include <boost/pointer_to_other.hpp>
#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
@@ -72,7 +73,7 @@
template<class ...Args>
list_node(Args &&...args)
- : m_data(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)
+ : m_data(boost::forward<Args>(args)...)
{}
#else //#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -131,8 +132,6 @@
<A, typename containers_detail::intrusive_list_type<A>::type>
{
/// @cond
- typedef typename containers_detail::
- move_const_ref_type<T>::type insert_const_ref_type;
typedef typename
containers_detail::intrusive_list_type<A>::type Icont;
typedef list <T, A> ThisType;
@@ -198,7 +197,7 @@
/// @cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(list)
+ BOOST_COPYABLE_AND_MOVABLE(list)
typedef difference_type list_difference_type;
typedef pointer list_pointer;
typedef const_pointer list_const_pointer;
@@ -357,8 +356,8 @@
//! <b>Throws</b>: If allocator_type's copy constructor throws.
//!
//! <b>Complexity</b>: Constant.
- list(BOOST_MOVE_MACRO_RV_REF(list) x)
- : AllocHolder(BOOST_CONTAINER_MOVE_NAMESPACE::move(static_cast<AllocHolder&>(x)))
+ list(BOOST_RV_REF(list) x)
+ : AllocHolder(boost::move(static_cast<AllocHolder&>(x)))
{}
//! <b>Effects</b>: Constructs a list that will use a copy of allocator a
@@ -530,56 +529,46 @@
size_type max_size() const
{ return AllocHolder::max_size(); }
- //! <b>Effects</b>: Inserts a copy of t in the beginning of the list.
+
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts a copy of x at the beginning of the list.
//!
//! <b>Throws</b>: If memory allocation throws or
//! T's copy constructor throws.
//!
//! <b>Complexity</b>: Amortized constant time.
- void push_front(insert_const_ref_type x)
- { this->insert(this->cbegin(), x); }
-
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- void push_front(T &x) { push_front(const_cast<const T &>(x)); }
-
- template<class U>
- void push_front(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { this->insert(this->cbegin(), u); }
- #endif
+ void push_front(const T &x);
//! <b>Effects</b>: Constructs a new element in the beginning of the list
- //! and moves the resources of t to this new element.
+ //! and moves the resources of mx to this new element.
//!
//! <b>Throws</b>: If memory allocation throws.
//!
//! <b>Complexity</b>: Amortized constant time.
- void push_front(BOOST_MOVE_MACRO_RV_REF(T) x)
- { this->insert(this->cbegin(), BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ void push_front(T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front)
+ #endif
- //! <b>Effects</b>: Removes the last element from the list.
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts a copy of x at the end of the list.
//!
- //! <b>Throws</b>: Nothing.
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy constructor throws.
//!
//! <b>Complexity</b>: Amortized constant time.
- void push_back (insert_const_ref_type x)
- { this->insert(this->cend(), x); }
-
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- void push_back(T &x) { push_back(const_cast<const T &>(x)); }
-
- template<class U>
- void push_back(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { this->insert(this->cend(), u); }
-
- #endif
+ void push_back(const T &x);
- //! <b>Effects</b>: Removes the first element from the list.
+ //! <b>Effects</b>: Constructs a new element in the end of the list
+ //! and moves the resources of mx to this new element.
//!
- //! <b>Throws</b>: Nothing.
+ //! <b>Throws</b>: If memory allocation throws.
//!
//! <b>Complexity</b>: Amortized constant time.
- void push_back (BOOST_MOVE_MACRO_RV_REF(T) x)
- { this->insert(this->cend(), BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ void push_back(T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
+ #endif
//! <b>Effects</b>: Removes the first element from the list.
//!
@@ -716,7 +705,7 @@
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to the number of elements in x.
- ThisType& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(ThisType) x)
+ ThisType& operator=(BOOST_COPY_ASSIGN_REF(ThisType) x)
{
if (this != &x) {
this->assign(x.begin(), x.end());
@@ -732,7 +721,7 @@
//! <b>Throws</b>: If allocator_type's copy constructor throws.
//!
//! <b>Complexity</b>: Constant.
- ThisType& operator=(BOOST_MOVE_MACRO_RV_REF(ThisType) mx)
+ ThisType& operator=(BOOST_RV_REF(ThisType) mx)
{
this->clear();
this->swap(mx);
@@ -760,41 +749,32 @@
template <class InpIt>
void insert(const_iterator p, InpIt first, InpIt last)
{
- const bool aux_boolean = containers_detail::is_convertible<InpIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
this->priv_insert_dispatch(p, first, last, Result());
}
- //! <b>Requires</b>: p must be a valid iterator of *this.
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
+ //! <b>Requires</b>: position must be a valid iterator of *this.
//!
- //! <b>Effects</b>: Insert a copy of x before p.
+ //! <b>Effects</b>: Insert a copy of x before position.
//!
//! <b>Throws</b>: If memory allocation throws or x's copy constructor throws.
//!
//! <b>Complexity</b>: Amortized constant time.
- iterator insert(const_iterator position, insert_const_ref_type x)
- { return this->priv_insert(position, x); }
-
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast<const T &>(x)); }
+ iterator insert(const_iterator position, const T &x);
- template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { return this->priv_insert(position, u); }
- #endif
-
- //! <b>Requires</b>: p must be a valid iterator of *this.
+ //! <b>Requires</b>: position must be a valid iterator of *this.
//!
- //! <b>Effects</b>: Insert a new element before p with mx's resources.
+ //! <b>Effects</b>: Insert a new element before position with mx's resources.
//!
//! <b>Throws</b>: If memory allocation throws.
//!
//! <b>Complexity</b>: Amortized constant time.
- iterator insert(const_iterator p, BOOST_MOVE_MACRO_RV_REF(T) x)
- {
- NodePtr tmp = AllocHolder::create_node(BOOST_CONTAINER_MOVE_NAMESPACE::move(x));
- return iterator(this->icont().insert(p.get(), *tmp));
- }
+ iterator insert(const_iterator position, T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+ #endif
#if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -808,7 +788,7 @@
template <class... Args>
void emplace_back(Args&&... args)
{
- this->emplace(this->cend(), BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ this->emplace(this->cend(), boost::forward<Args>(args)...);
}
//! <b>Effects</b>: Inserts an object of type T constructed with
@@ -821,7 +801,7 @@
template <class... Args>
void emplace_front(Args&&... args)
{
- this->emplace(this->cbegin(), BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ this->emplace(this->cbegin(), boost::forward<Args>(args)...);
}
//! <b>Effects</b>: Inserts an object of type T constructed with
@@ -835,7 +815,7 @@
iterator emplace(const_iterator p, Args&&... args)
{
typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator());
- new ((void*)containers_detail::get_pointer(d.get())) Node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ new ((void*)containers_detail::get_pointer(d.get())) Node(boost::forward<Args>(args)...);
NodePtr node = d.get();
d.release();
return iterator(this->icont().insert(p.get(), *node));
@@ -923,7 +903,7 @@
template <class InpIt>
void assign(InpIt first, InpIt last)
{
- const bool aux_boolean = containers_detail::is_convertible<InpIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
this->priv_assign_dispatch(first, last, Result());
}
@@ -1166,6 +1146,24 @@
return iterator(this->icont().insert(p.get(), *tmp));
}
+ iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x)
+ {
+ NodePtr tmp = AllocHolder::create_node(boost::move(x));
+ return iterator(this->icont().insert(p.get(), *tmp));
+ }
+
+ void priv_push_back (const T &x)
+ { this->insert(this->cend(), x); }
+
+ void priv_push_back (BOOST_RV_REF(T) x)
+ { this->insert(this->cend(), boost::move(x)); }
+
+ void priv_push_front (const T &x)
+ { this->insert(this->cbegin(), x); }
+
+ void priv_push_front (BOOST_RV_REF(T) x)
+ { this->insert(this->cbegin(), boost::move(x)); }
+
//Iterator range version
template<class InpIterator>
void priv_create_and_insert_nodes
Modified: sandbox/move/boost/container/map.hpp
==============================================================================
--- sandbox/move/boost/container/map.hpp (original)
+++ sandbox/move/boost/container/map.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -61,7 +61,9 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_PAIR_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP
+#include <boost/move/move.hpp>
+#include <boost/static_assert.hpp>
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost {
@@ -99,13 +101,14 @@
{
/// @cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(map)
+ BOOST_COPYABLE_AND_MOVABLE(map)
typedef containers_detail::rbtree<Key,
std::pair<const Key, T>,
containers_detail::select1st< std::pair<const Key, T> >,
Pred,
Alloc> tree_t;
tree_t m_tree; // red-black tree representing map
+
/// @endcond
public:
@@ -154,7 +157,10 @@
explicit map(const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
: m_tree(comp, a)
- {}
+ {
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename Alloc::value_type>::value));
+ }
//! <b>Effects</b>: Constructs an empty map using the specified comparison object and
//! allocator, and inserts elements from the range [first ,last ).
@@ -165,7 +171,10 @@
map(InputIterator first, InputIterator last, const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
: m_tree(first, last, comp, a, true)
- {}
+ {
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename Alloc::value_type>::value));
+ }
//! <b>Effects</b>: Constructs an empty map using the specified comparison object and
//! allocator, and inserts elements from the ordered unique range [first ,last). This function
@@ -179,35 +188,44 @@
map( ordered_unique_range_t, InputIterator first, InputIterator last
, const Pred& comp = Pred(), const allocator_type& a = allocator_type())
: m_tree(ordered_range, first, last, comp, a)
- {}
+ {
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename Alloc::value_type>::value));
+ }
//! <b>Effects</b>: Copy constructs a map.
//!
//! <b>Complexity</b>: Linear in x.size().
map(const map<Key,T,Pred,Alloc>& x)
: m_tree(x.m_tree)
- {}
+ {
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename Alloc::value_type>::value));
+ }
//! <b>Effects</b>: Move constructs a map. Constructs *this using x's resources.
//!
//! <b>Complexity</b>: Construct.
//!
//! <b>Postcondition</b>: x is emptied.
- map(BOOST_MOVE_MACRO_RV_REF(map) x)
- : m_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree))
- {}
+ map(BOOST_RV_REF(map) x)
+ : m_tree(boost::move(x.m_tree))
+ {
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename Alloc::value_type>::value));
+ }
//! <b>Effects</b>: Makes *this a copy of x.
//!
//! <b>Complexity</b>: Linear in x.size().
- map& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(map) x)
+ map& operator=(BOOST_COPY_ASSIGN_REF(map) x)
{ m_tree = x.m_tree; return *this; }
//! <b>Effects</b>: this->swap(x.get()).
//!
//! <b>Complexity</b>: Constant.
- map& operator=(BOOST_MOVE_MACRO_RV_REF(map) x)
- { m_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree); return *this; }
+ map& operator=(BOOST_RV_REF(map) x)
+ { m_tree = boost::move(x.m_tree); return *this; }
//! <b>Effects</b>: Returns the comparison object out
//! of which a was constructed.
@@ -341,27 +359,27 @@
// i->first is greater than or equivalent to k.
if (i == end() || key_comp()(k, (*i).first)){
containers_detail::value_init<T> v;
- value_type val(k, BOOST_CONTAINER_MOVE_NAMESPACE::move(v.m_t));
- i = insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(val));
+ value_type val(k, boost::move(v.m_t));
+ i = insert(i, boost::move(val));
}
return (*i).second;
}
//! Effects: If there is no key equivalent to x in the map, inserts
- //! value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(x), T()) into the map (the key is move-constructed)
+ //! value_type(boost::move(x), T()) into the map (the key is move-constructed)
//!
//! Returns: A reference to the mapped_type corresponding to x in *this.
//!
//! Complexity: Logarithmic.
- T& operator[](BOOST_MOVE_MACRO_RV_REF(key_type) mk)
+ T& operator[](BOOST_RV_REF(key_type) mk)
{
key_type &k = mk;
//we can optimize this
iterator i = lower_bound(k);
// i->first is greater than or equivalent to k.
if (i == end() || key_comp()(k, (*i).first)){
- value_type val(BOOST_CONTAINER_MOVE_NAMESPACE::move(k), BOOST_CONTAINER_MOVE_NAMESPACE::move(T()));
- i = insert(i, BOOST_CONTAINER_MOVE_NAMESPACE::move(val));
+ value_type val(boost::move(k), boost::move(T()));
+ i = insert(i, boost::move(val));
}
return (*i).second;
}
@@ -429,8 +447,8 @@
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(nonconst_value_type) x)
- { return m_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ std::pair<iterator,bool> insert(BOOST_RV_REF(nonconst_value_type) x)
+ { return m_tree.insert_unique(boost::move(x)); }
//! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and
//! only if there is no element in the container with key equivalent to the key of x.
@@ -440,8 +458,8 @@
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(nonconst_impl_value_type) x)
- { return m_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ std::pair<iterator,bool> insert(BOOST_RV_REF(nonconst_impl_value_type) x)
+ { return m_tree.insert_unique(boost::move(x)); }
//! <b>Effects</b>: Move constructs a new value from x if and only if there is
//! no element in the container with key equivalent to the key of x.
@@ -451,8 +469,8 @@
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
+ { return m_tree.insert_unique(boost::move(x)); }
//! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
//! no element in the container with key equivalent to the key of x.
@@ -475,8 +493,8 @@
//!
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p.
- iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(nonconst_value_type) x)
- { return m_tree.insert_unique(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(iterator position, BOOST_RV_REF(nonconst_value_type) x)
+ { return m_tree.insert_unique(position, boost::move(x)); }
//! <b>Effects</b>: Move constructs a new value from x if and only if there is
//! no element in the container with key equivalent to the key of x.
@@ -487,8 +505,8 @@
//!
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p.
- iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(nonconst_impl_value_type) x)
- { return m_tree.insert_unique(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(iterator position, BOOST_RV_REF(nonconst_impl_value_type) x)
+ { return m_tree.insert_unique(position, boost::move(x)); }
//! <b>Effects</b>: Inserts a copy of x in the container.
//! p is a hint pointing to where the insert should start to search.
@@ -505,8 +523,8 @@
//! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_tree.insert_unique(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(iterator position, BOOST_RV_REF(value_type) x)
+ { return m_tree.insert_unique(position, boost::move(x)); }
//! <b>Requires</b>: i, j are not iterators into *this.
//!
@@ -532,7 +550,7 @@
//! is inserted right before p.
template <class... Args>
iterator emplace(Args&&... args)
- { return m_tree.emplace_unique(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_unique(boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the container if and only if there is
@@ -546,7 +564,7 @@
//! is inserted right before p.
template <class... Args>
iterator emplace_hint(const_iterator hint, Args&&... args)
- { return m_tree.emplace_hint_unique(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_hint_unique(hint, boost::forward<Args>(args)...); }
#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -752,7 +770,7 @@
{
/// @cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(multimap)
+ BOOST_COPYABLE_AND_MOVABLE(multimap)
typedef containers_detail::rbtree<Key,
std::pair<const Key, T>,
containers_detail::select1st< std::pair<const Key, T> >,
@@ -807,7 +825,10 @@
explicit multimap(const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
: m_tree(comp, a)
- {}
+ {
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename Alloc::value_type>::value));
+ }
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison object
//! and allocator, and inserts elements from the range [first ,last ).
@@ -819,7 +840,10 @@
const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
: m_tree(first, last, comp, a, false)
- {}
+ {
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename Alloc::value_type>::value));
+ }
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
//! allocator, and inserts elements from the ordered range [first ,last). This function
@@ -840,28 +864,34 @@
//! <b>Complexity</b>: Linear in x.size().
multimap(const multimap<Key,T,Pred,Alloc>& x)
: m_tree(x.m_tree)
- {}
+ {
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename Alloc::value_type>::value));
+ }
//! <b>Effects</b>: Move constructs a multimap. Constructs *this using x's resources.
//!
//! <b>Complexity</b>: Construct.
//!
//! <b>Postcondition</b>: x is emptied.
- multimap(BOOST_MOVE_MACRO_RV_REF(multimap) x)
- : m_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree))
- {}
+ multimap(BOOST_RV_REF(multimap) x)
+ : m_tree(boost::move(x.m_tree))
+ {
+ //Allocator type must be std::pair<CONST Key, T>
+ BOOST_STATIC_ASSERT((containers_detail::is_same<std::pair<const Key, T>, typename Alloc::value_type>::value));
+ }
//! <b>Effects</b>: Makes *this a copy of x.
//!
//! <b>Complexity</b>: Linear in x.size().
- multimap& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(multimap) x)
+ multimap& operator=(BOOST_COPY_ASSIGN_REF(multimap) x)
{ m_tree = x.m_tree; return *this; }
//! <b>Effects</b>: this->swap(x.get()).
//!
//! <b>Complexity</b>: Constant.
- multimap& operator=(BOOST_MOVE_MACRO_RV_REF(multimap) x)
- { m_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree); return *this; }
+ multimap& operator=(BOOST_RV_REF(multimap) x)
+ { m_tree = boost::move(x.m_tree); return *this; }
//! <b>Effects</b>: Returns the comparison object out
//! of which a was constructed.
@@ -1009,15 +1039,15 @@
//! the iterator pointing to the newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator insert(BOOST_MOVE_MACRO_RV_REF(nonconst_value_type) x)
- { return m_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(BOOST_RV_REF(nonconst_value_type) x)
+ { return m_tree.insert_equal(boost::move(x)); }
//! <b>Effects</b>: Inserts a new value move-constructed from x and returns
//! the iterator pointing to the newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator insert(BOOST_MOVE_MACRO_RV_REF(nonconst_impl_value_type) x)
- { return m_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(BOOST_RV_REF(nonconst_impl_value_type) x)
+ { return m_tree.insert_equal(boost::move(x)); }
//! <b>Effects</b>: Inserts a copy of x in the container.
//! p is a hint pointing to where the insert should start to search.
@@ -1049,8 +1079,8 @@
//!
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p.
- iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(nonconst_value_type) x)
- { return m_tree.insert_equal(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(iterator position, BOOST_RV_REF(nonconst_value_type) x)
+ { return m_tree.insert_equal(position, boost::move(x)); }
//! <b>Effects</b>: Inserts a new value move constructed from x in the container.
//! p is a hint pointing to where the insert should start to search.
@@ -1060,8 +1090,8 @@
//!
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p.
- iterator insert(iterator position, BOOST_MOVE_MACRO_RV_REF(nonconst_impl_value_type) x)
- { return m_tree.insert_equal(position, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(iterator position, BOOST_RV_REF(nonconst_impl_value_type) x)
+ { return m_tree.insert_equal(position, boost::move(x)); }
//! <b>Requires</b>: i, j are not iterators into *this.
//!
@@ -1085,7 +1115,7 @@
//! is inserted right before p.
template <class... Args>
iterator emplace(Args&&... args)
- { return m_tree.emplace_equal(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_equal(boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the container.
@@ -1098,7 +1128,7 @@
//! is inserted right before p.
template <class... Args>
iterator emplace_hint(const_iterator hint, Args&&... args)
- { return m_tree.emplace_hint_equal(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_hint_equal(hint, boost::forward<Args>(args)...); }
#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
Modified: sandbox/move/boost/container/set.hpp
==============================================================================
--- sandbox/move/boost/container/set.hpp (original)
+++ sandbox/move/boost/container/set.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -23,10 +23,10 @@
#include <functional>
#include <memory>
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_TREE_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
#include INCLUDE_BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
#endif
@@ -62,7 +62,7 @@
{
/// @cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(set)
+ BOOST_COPYABLE_AND_MOVABLE(set)
typedef containers_detail::rbtree<T, T,
containers_detail::identity<T>, Pred, Alloc> tree_t;
tree_t m_tree; // red-black tree representing set
@@ -136,21 +136,21 @@
//! <b>Complexity</b>: Construct.
//!
//! <b>Postcondition</b>: x is emptied.
- set(BOOST_MOVE_MACRO_RV_REF(set) x)
- : m_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree))
+ set(BOOST_RV_REF(set) x)
+ : m_tree(boost::move(x.m_tree))
{}
//! <b>Effects</b>: Makes *this a copy of x.
//!
//! <b>Complexity</b>: Linear in x.size().
- set& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(set) x)
+ set& operator=(BOOST_COPY_ASSIGN_REF(set) x)
{ m_tree = x.m_tree; return *this; }
//! <b>Effects</b>: this->swap(x.get()).
//!
//! <b>Complexity</b>: Constant.
- set& operator=(BOOST_MOVE_MACRO_RV_REF(set) x)
- { m_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree); return *this; }
+ set& operator=(BOOST_RV_REF(set) x)
+ { m_tree = boost::move(x.m_tree); return *this; }
//! <b>Effects</b>: Returns the comparison object out
//! of which a was constructed.
@@ -330,7 +330,7 @@
{ return this->insert(const_cast<const T &>(x)); }
template<class U>
- std::pair<iterator,bool> insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ std::pair<iterator,bool> insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_insert(u); }
#endif
@@ -342,8 +342,8 @@
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_tree.insert_unique(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
+ { return m_tree.insert_unique(boost::move(x)); }
//! <b>Effects</b>: Inserts a copy of x in the container if and only if there is
//! no element in the container with key equivalent to the key of x.
@@ -362,7 +362,7 @@
{ return this->insert(position, const_cast<const T &>(x)); }
template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_insert(position, u); }
#endif
@@ -372,8 +372,8 @@
//! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator insert(const_iterator p, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_tree.insert_unique(p, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
+ { return m_tree.insert_unique(p, boost::move(x)); }
//! <b>Requires</b>: i, j are not iterators into *this.
//!
@@ -399,7 +399,7 @@
//! <b>Complexity</b>: Logarithmic.
template <class... Args>
iterator emplace(Args&&... args)
- { return m_tree.emplace_unique(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_unique(boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... if and only if there is
@@ -412,7 +412,7 @@
//! <b>Complexity</b>: Logarithmic.
template <class... Args>
iterator emplace_hint(const_iterator hint, Args&&... args)
- { return m_tree.emplace_hint_unique(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_hint_unique(hint, boost::forward<Args>(args)...); }
#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -620,7 +620,7 @@
{
/// @cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(multiset)
+ BOOST_COPYABLE_AND_MOVABLE(multiset)
typedef containers_detail::rbtree<T, T,
containers_detail::identity<T>, Pred, Alloc> tree_t;
tree_t m_tree; // red-black tree representing multiset
@@ -695,21 +695,21 @@
//! <b>Complexity</b>: Construct.
//!
//! <b>Postcondition</b>: x is emptied.
- multiset(BOOST_MOVE_MACRO_RV_REF(multiset) x)
- : m_tree(BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree))
+ multiset(BOOST_RV_REF(multiset) x)
+ : m_tree(boost::move(x.m_tree))
{}
//! <b>Effects</b>: Makes *this a copy of x.
//!
//! <b>Complexity</b>: Linear in x.size().
- multiset& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(multiset) x)
+ multiset& operator=(BOOST_COPY_ASSIGN_REF(multiset) x)
{ m_tree = x.m_tree; return *this; }
//! <b>Effects</b>: this->swap(x.get()).
//!
//! <b>Complexity</b>: Constant.
- multiset& operator=(BOOST_MOVE_MACRO_RV_REF(multiset) x)
- { m_tree = BOOST_CONTAINER_MOVE_NAMESPACE::move(x.m_tree); return *this; }
+ multiset& operator=(BOOST_RV_REF(multiset) x)
+ { m_tree = boost::move(x.m_tree); return *this; }
//! <b>Effects</b>: Returns the comparison object out
//! of which a was constructed.
@@ -885,7 +885,7 @@
{ return this->insert(const_cast<const T &>(x)); }
template<class U>
- iterator insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ iterator insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_insert(u); }
#endif
@@ -896,8 +896,8 @@
//!
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p.
- iterator insert(BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_tree.insert_equal(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(BOOST_RV_REF(value_type) x)
+ { return m_tree.insert_equal(boost::move(x)); }
//! <b>Effects</b>: Inserts a copy of x in the container.
//! p is a hint pointing to where the insert should start to search.
@@ -915,7 +915,7 @@
{ return this->insert(position, const_cast<const T &>(x)); }
template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_insert(position, u); }
#endif
@@ -927,8 +927,8 @@
//!
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p.
- iterator insert(const_iterator p, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return m_tree.insert_equal(p, BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
+ { return m_tree.insert_equal(p, boost::move(x)); }
//! <b>Requires</b>: i, j are not iterators into *this.
//!
@@ -948,7 +948,7 @@
//! <b>Complexity</b>: Logarithmic.
template <class... Args>
iterator emplace(Args&&... args)
- { return m_tree.emplace_equal(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_equal(boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)...
@@ -960,7 +960,7 @@
//! is inserted right before p.
template <class... Args>
iterator emplace_hint(const_iterator hint, Args&&... args)
- { return m_tree.emplace_hint_equal(hint, BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return m_tree.emplace_hint_equal(hint, boost::forward<Args>(args)...); }
#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
Modified: sandbox/move/boost/container/slist.hpp
==============================================================================
--- sandbox/move/boost/container/slist.hpp (original)
+++ sandbox/move/boost/container/slist.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -19,7 +19,7 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
#include <boost/pointer_to_other.hpp>
#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
@@ -73,7 +73,7 @@
template<class ...Args>
slist_node(Args &&...args)
- : m_data(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)
+ : m_data(boost::forward<Args>(args)...)
{}
#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -222,7 +222,7 @@
/// @cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(slist)
+ BOOST_COPYABLE_AND_MOVABLE(slist)
typedef difference_type list_difference_type;
typedef pointer list_pointer;
typedef const_pointer list_const_pointer;
@@ -372,8 +372,8 @@
//! <b>Throws</b>: If allocator_type's copy constructor throws.
//!
//! <b>Complexity</b>: Constant.
- slist(BOOST_MOVE_MACRO_RV_REF(slist) x)
- : AllocHolder(BOOST_CONTAINER_MOVE_NAMESPACE::move((AllocHolder&)x))
+ slist(BOOST_RV_REF(slist) x)
+ : AllocHolder(boost::move((AllocHolder&)x))
{}
//! <b>Effects</b>: Makes *this contain the same elements as x.
@@ -384,7 +384,7 @@
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to the number of elements in x.
- slist& operator= (BOOST_MOVE_MACRO_COPY_ASSIGN_REF(slist) x)
+ slist& operator= (BOOST_COPY_ASSIGN_REF(slist) x)
{
if (&x != this){
this->assign(x.begin(), x.end());
@@ -400,7 +400,7 @@
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to the number of elements in x.
- slist& operator= (BOOST_MOVE_MACRO_RV_REF(slist) mx)
+ slist& operator= (BOOST_RV_REF(slist) mx)
{
if (&mx != this){
this->clear();
@@ -451,7 +451,7 @@
template <class InpIt>
void assign(InpIt first, InpIt last)
{
- const bool aux_boolean = containers_detail::is_convertible<InpIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InpIt, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
this->priv_assign_dispatch(first, last, Result());
}
@@ -603,7 +603,7 @@
void push_front(T &x) { push_front(const_cast<const T &>(x)); }
template<class U>
- void push_front(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ void push_front(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_push_front(u); }
#endif
@@ -613,8 +613,8 @@
//! <b>Throws</b>: If memory allocation throws.
//!
//! <b>Complexity</b>: Amortized constant time.
- void push_front(BOOST_MOVE_MACRO_RV_REF(T) x)
- { this->icont().push_front(*this->create_node(BOOST_CONTAINER_MOVE_NAMESPACE::move(x))); }
+ void push_front(BOOST_RV_REF(T) x)
+ { this->icont().push_front(*this->create_node(boost::move(x))); }
//! <b>Effects</b>: Removes the first element from the list.
//!
@@ -665,7 +665,7 @@
{ return this->insert_after(position, const_cast<const T &>(x)); }
template<class U>
- iterator insert_after(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ iterator insert_after(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return this->priv_insert_after(position, u); }
#endif
@@ -682,8 +682,8 @@
//!
//! <b>Note</b>: Does not affect the validity of iterators and references of
//! previous values.
- iterator insert_after(const_iterator prev_pos, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(BOOST_CONTAINER_MOVE_NAMESPACE::move(x)))); }
+ iterator insert_after(const_iterator prev_pos, BOOST_RV_REF(value_type) x)
+ { return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(boost::move(x)))); }
//! <b>Requires</b>: prev_pos must be a valid iterator of *this.
//!
@@ -713,7 +713,7 @@
template <class InIter>
void insert_after(const_iterator prev_pos, InIter first, InIter last)
{
- const bool aux_boolean = containers_detail::is_convertible<InIter, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InIter, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
this->priv_insert_after_range_dispatch(prev_pos, first, last, Result());
}
@@ -733,7 +733,7 @@
{ return this->insert(position, const_cast<const T &>(x)); }
template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return this->priv_insert(position, u); }
#endif
@@ -744,8 +744,8 @@
//! <b>Throws</b>: If memory allocation throws.
//!
//! <b>Complexity</b>: Linear to the elements before p.
- iterator insert(const_iterator p, BOOST_MOVE_MACRO_RV_REF(value_type) x)
- { return this->insert_after(previous(p), BOOST_CONTAINER_MOVE_NAMESPACE::move(x)); }
+ iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
+ { return this->insert_after(previous(p), boost::move(x)); }
//! <b>Requires</b>: p must be a valid iterator of *this.
//!
@@ -781,7 +781,7 @@
//! <b>Complexity</b>: Amortized constant time.
template <class... Args>
void emplace_front(Args&&... args)
- { this->emplace_after(this->cbefore_begin(), BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { this->emplace_after(this->cbefore_begin(), boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... before p
@@ -792,7 +792,7 @@
//! <b>Complexity</b>: Linear to the elements before p
template <class... Args>
iterator emplace(const_iterator p, Args&&... args)
- { return this->emplace_after(this->previous(p), BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...); }
+ { return this->emplace_after(this->previous(p), boost::forward<Args>(args)...); }
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... after prev
@@ -805,7 +805,7 @@
iterator emplace_after(const_iterator prev, Args&&... args)
{
typename AllocHolder::Deallocator d(AllocHolder::create_node_and_deallocator());
- new ((void*)containers_detail::get_pointer(d.get())) Node(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ new ((void*)containers_detail::get_pointer(d.get())) Node(boost::forward<Args>(args)...);
NodePtr node = d.get();
d.release();
return iterator(this->icont().insert_after(prev.get(), *node));
@@ -1338,7 +1338,7 @@
template<class Integer>
void priv_insert_dispatch(const_iterator prev, Integer n, Integer x, containers_detail::true_)
- { this->priv_create_and_insert_nodes(prev, (std::size_t)n, x); }
+ { this->priv_create_and_insert_nodes(prev, (size_type)n, x); }
void priv_fill_assign(size_type n, const T& val)
{
@@ -1380,7 +1380,7 @@
template <class Int>
void priv_insert_after_range_dispatch(const_iterator prev_pos, Int n, Int x, containers_detail::true_)
- { this->priv_create_and_insert_nodes(prev_pos, (std::size_t)n, x); }
+ { this->priv_create_and_insert_nodes(prev_pos, (size_type)n, x); }
template <class InIter>
void priv_insert_after_range_dispatch(const_iterator prev_pos, InIter first, InIter last, containers_detail::false_)
Modified: sandbox/move/boost/container/stable_vector.hpp
==============================================================================
--- sandbox/move/boost/container/stable_vector.hpp (original)
+++ sandbox/move/boost/container/stable_vector.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2008-2009. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2011. 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)
//
@@ -140,7 +140,7 @@
template<class ...Args>
node_type(Args &&...args)
- : value(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...)
+ : value(boost::forward<Args>(args)...)
{}
#else //BOOST_CONTAINERS_PERFECT_FORWARDING
@@ -177,10 +177,14 @@
typedef typename boost::pointer_to_other
<Pointer, void>::type void_ptr;
+ typedef typename boost::pointer_to_other
+ <Pointer, const void>::type const_void_ptr;
typedef node_type<void_ptr, T> node_type_t;
typedef typename boost::pointer_to_other
<void_ptr, node_type_t>::type node_type_ptr_t;
typedef typename boost::pointer_to_other
+ <void_ptr, const node_type_t>::type const_node_type_ptr_t;
+ typedef typename boost::pointer_to_other
<void_ptr, void_ptr>::type void_ptr_ptr;
friend class iterator<T, const T, typename boost::pointer_to_other<Pointer, T>::type>;
@@ -205,13 +209,19 @@
{}
private:
- static node_type_ptr_t node_ptr_cast(void_ptr p)
+ static node_type_ptr_t node_ptr_cast(const void_ptr &p)
{
using boost::get_pointer;
return node_type_ptr_t(static_cast<node_type_t*>(stable_vector_detail::get_pointer(p)));
}
- static void_ptr_ptr void_ptr_ptr_cast(void_ptr p)
+ static const_node_type_ptr_t node_ptr_cast(const const_void_ptr &p)
+ {
+ using boost::get_pointer;
+ return const_node_type_ptr_t(static_cast<const node_type_t*>(stable_vector_detail::get_pointer(p)));
+ }
+
+ static void_ptr_ptr void_ptr_ptr_cast(const void_ptr &p)
{
using boost::get_pointer;
return void_ptr_ptr(static_cast<void_ptr*>(stable_vector_detail::get_pointer(p)));
@@ -225,9 +235,9 @@
{ pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)+1)); }
void decrement()
{ pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)-1)); }
- void advance(std::ptrdiff_t n)
+ void advance(difference_type n)
{ pn = node_ptr_cast(*(void_ptr_ptr_cast(pn->up)+n)); }
- std::ptrdiff_t distance_to(const iterator& x)const
+ difference_type distance_to(const iterator& x)const
{ return void_ptr_ptr_cast(x.pn->up) - void_ptr_ptr_cast(pn->up); }
public:
@@ -261,9 +271,9 @@
return *this;
}
- iterator operator+(difference_type off) const
+ friend iterator operator+(const iterator &left, difference_type off)
{
- iterator tmp(*this);
+ iterator tmp(left);
tmp += off;
return tmp;
}
@@ -278,38 +288,36 @@
iterator& operator-=(difference_type off)
{ *this += -off; return *this; }
- iterator operator-(difference_type off) const
+ friend iterator operator-(const iterator &left, difference_type off)
{
- iterator tmp(*this);
+ iterator tmp(left);
tmp -= off;
return tmp;
}
- difference_type operator-(const iterator& right) const
+ friend difference_type operator-(const iterator& left, const iterator& right)
{
- void_ptr_ptr p1 = void_ptr_ptr_cast(this->pn->up);
- void_ptr_ptr p2 = void_ptr_ptr_cast(right.pn->up);
- return p1 - p2;
+ return void_ptr_ptr_cast(left.pn->up) - void_ptr_ptr_cast(right.pn->up);
}
//Comparison operators
- bool operator== (const iterator& r) const
- { return pn == r.pn; }
+ friend bool operator== (const iterator& l, const iterator& r)
+ { return l.pn == r.pn; }
- bool operator!= (const iterator& r) const
- { return pn != r.pn; }
+ friend bool operator!= (const iterator& l, const iterator& r)
+ { return l.pn != r.pn; }
- bool operator< (const iterator& r) const
- { return void_ptr_ptr_cast(pn->up) < void_ptr_ptr_cast(r.pn->up); }
+ friend bool operator< (const iterator& l, const iterator& r)
+ { return void_ptr_ptr_cast(l.pn->up) < void_ptr_ptr_cast(r.pn->up); }
- bool operator<= (const iterator& r) const
- { return void_ptr_ptr_cast(pn->up) <= void_ptr_ptr_cast(r.pn->up); }
+ friend bool operator<= (const iterator& l, const iterator& r)
+ { return void_ptr_ptr_cast(l.pn->up) <= void_ptr_ptr_cast(r.pn->up); }
- bool operator> (const iterator& r) const
- { return void_ptr_ptr_cast(pn->up) > void_ptr_ptr_cast(r.pn->up); }
+ friend bool operator> (const iterator& l, const iterator& r)
+ { return void_ptr_ptr_cast(l.pn->up) > void_ptr_ptr_cast(r.pn->up); }
- bool operator>= (const iterator& r) const
- { return void_ptr_ptr_cast(pn->up) >= void_ptr_ptr_cast(r.pn->up); }
+ friend bool operator>= (const iterator& l, const iterator& r)
+ { return void_ptr_ptr_cast(l.pn->up) >= void_ptr_ptr_cast(r.pn->up); }
node_type_ptr_t pn;
};
@@ -346,7 +354,11 @@
/// @endcond
-//!Help taken from ( Introducing stable_vector)
+//!Originally developed by Joaquin M. Lopez Munoz, stable_vector is std::vector
+//!drop-in replacement implemented as a node container, offering iterator and reference
+//!stability.
+//!
+//!More details taken the author's blog: ( Introducing stable_vector)
//!
//!We present stable_vector, a fully STL-compliant stable container that provides
//!most of the features of std::vector except element contiguity.
@@ -379,8 +391,12 @@
move_const_ref_type<T>::type insert_const_ref_type;
typedef typename Allocator::template
rebind<void>::other::pointer void_ptr;
+ typedef typename boost::pointer_to_other
+ <void_ptr, const void>::type const_void_ptr;
typedef typename Allocator::template
rebind<void_ptr>::other::pointer void_ptr_ptr;
+ typedef typename boost::pointer_to_other
+ <void_ptr, const void_ptr>::type const_void_ptr_ptr;
typedef stable_vector_detail::node_type
<void_ptr, T> node_type_t;
typedef typename Allocator::template
@@ -454,8 +470,14 @@
///@cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(stable_vector)
+ BOOST_COPYABLE_AND_MOVABLE(stable_vector)
static const size_type ExtraPointers = 3;
+ //This container stores metadata at the end of the void_ptr vector with additional 3 pointers:
+ // back() is impl.back() - ExtraPointers;
+ // end node index is impl.end()[-3]
+ // Node cache first is impl.end()[-2];
+ // Node cache last is *impl.back();
+
typedef typename stable_vector_detail::
select_multiallocation_chain
< node_allocator_type
@@ -464,13 +486,24 @@
///@endcond
public:
- // construct/copy/destroy:
+ //! <b>Effects</b>: Constructs a stable_vector taking the allocator as parameter.
+ //!
+ //! <b>Throws</b>: If allocator_type's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant.
explicit stable_vector(const Allocator& al=Allocator())
: internal_data(al),impl(al)
{
STABLE_VECTOR_CHECK_INVARIANT;
}
+ //! <b>Effects</b>: Constructs a stable_vector that will use a copy of allocator a
+ //! and inserts n default contructed values.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor or copy constructor
+ //! throws or T's default or copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
explicit stable_vector(size_type n)
: internal_data(Allocator()),impl(Allocator())
{
@@ -480,6 +513,13 @@
cod.release();
}
+ //! <b>Effects</b>: Constructs a stable_vector that will use a copy of allocator a
+ //! and inserts n copies of value.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor or copy constructor
+ //! throws or T's default or copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
stable_vector(size_type n, const T& t, const Allocator& al=Allocator())
: internal_data(al),impl(al)
{
@@ -489,6 +529,13 @@
cod.release();
}
+ //! <b>Effects</b>: Constructs a stable_vector that will use a copy of allocator a
+ //! and inserts a copy of the range [first, last) in the stable_vector.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor or copy constructor
+ //! throws or T's constructor taking an dereferenced InIt throws.
+ //!
+ //! <b>Complexity</b>: Linear to the range [first, last).
template <class InputIterator>
stable_vector(InputIterator first,InputIterator last,const Allocator& al=Allocator())
: internal_data(al),impl(al)
@@ -499,6 +546,11 @@
cod.release();
}
+ //! <b>Effects</b>: Copy constructs a stable_vector.
+ //!
+ //! <b>Postcondition</b>: x == *this.
+ //!
+ //! <b>Complexity</b>: Linear to the elements x contains.
stable_vector(const stable_vector& x)
: internal_data(x.get_al()),impl(x.get_al())
{
@@ -508,17 +560,36 @@
cod.release();
}
- stable_vector(BOOST_MOVE_MACRO_RV_REF(stable_vector) x)
+ //! <b>Effects</b>: Move constructor. Moves mx's resources to *this.
+ //!
+ //! <b>Throws</b>: If allocator_type's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant.
+ stable_vector(BOOST_RV_REF(stable_vector) x)
: internal_data(x.get_al()),impl(x.get_al())
{ this->swap(x); }
+ //! <b>Effects</b>: Destroys the stable_vector. All stored values are destroyed
+ //! and used memory is deallocated.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements.
~stable_vector()
{
this->clear();
clear_pool();
}
- stable_vector& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(stable_vector) x)
+ //! <b>Effects</b>: Makes *this contain the same elements as x.
+ //!
+ //! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
+ //! of each of x's elements.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in x.
+ stable_vector& operator=(BOOST_COPY_ASSIGN_REF(stable_vector) x)
{
STABLE_VECTOR_CHECK_INVARIANT;
if (this != &x) {
@@ -527,7 +598,15 @@
return *this;
}
- stable_vector& operator=(BOOST_MOVE_MACRO_RV_REF(stable_vector) x)
+ //! <b>Effects</b>: Move assignment. All mx's values are transferred to *this.
+ //!
+ //! <b>Postcondition</b>: x.empty(). *this contains a the elements x had
+ //! before the function.
+ //!
+ //! <b>Throws</b>: If allocator_type's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear.
+ stable_vector& operator=(BOOST_RV_REF(stable_vector) x)
{
if (&x != this){
this->swap(x);
@@ -536,48 +615,152 @@
return *this;
}
+ //! <b>Effects</b>: Assigns the the range [first, last) to *this.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's constructor from dereferencing InpIt throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
template<typename InputIterator>
void assign(InputIterator first,InputIterator last)
{
assign_dispatch(first, last, boost::is_integral<InputIterator>());
}
+
+ //! <b>Effects</b>: Assigns the n copies of val to *this.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
void assign(size_type n,const T& t)
{
typedef constant_iterator<value_type, difference_type> cvalue_iterator;
return assign_dispatch(cvalue_iterator(t, n), cvalue_iterator(), boost::mpl::false_());
}
+ //! <b>Effects</b>: Returns a copy of the internal allocator.
+ //!
+ //! <b>Throws</b>: If allocator's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant.
allocator_type get_allocator()const {return get_al();}
- // iterators:
+ //! <b>Effects</b>: Returns an iterator to the first element contained in the stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
iterator begin()
{ return (impl.empty()) ? end(): iterator(node_ptr_cast(impl.front())) ; }
+ //! <b>Effects</b>: Returns a const_iterator to the first element contained in the stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_iterator begin()const
{ return (impl.empty()) ? cend() : const_iterator(node_ptr_cast(impl.front())) ; }
+ //! <b>Effects</b>: Returns an iterator to the end of the stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
iterator end() {return iterator(get_end_node());}
+
+ //! <b>Effects</b>: Returns a const_iterator to the end of the stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_iterator end()const {return const_iterator(get_end_node());}
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
reverse_iterator rbegin() {return reverse_iterator(this->end());}
+
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reverse_iterator rbegin()const {return const_reverse_iterator(this->end());}
+
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
+ //! of the reversed stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
reverse_iterator rend() {return reverse_iterator(this->begin());}
+
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
+ //! of the reversed stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reverse_iterator rend()const {return const_reverse_iterator(this->begin());}
+ //! <b>Effects</b>: Returns a const_iterator to the first element contained in the stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_iterator cbegin()const {return this->begin();}
+
+ //! <b>Effects</b>: Returns a const_iterator to the end of the stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_iterator cend()const {return this->end();}
+
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reverse_iterator crbegin()const{return this->rbegin();}
+
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
+ //! of the reversed stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reverse_iterator crend()const {return this->rend();}
- // capacity:
+ //! <b>Effects</b>: Returns the number of the elements contained in the stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
size_type size() const
{ return impl.empty() ? 0 : (impl.size() - ExtraPointers); }
+ //! <b>Effects</b>: Returns the largest possible size of the stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
size_type max_size() const
{ return impl.max_size() - ExtraPointers; }
+ //! <b>Effects</b>: Number of elements for which memory has been allocated.
+ //! capacity() is always greater than or equal to size().
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
size_type capacity() const
{
if(!impl.capacity()){
@@ -590,9 +773,20 @@
}
}
+ //! <b>Effects</b>: Returns true if the stable_vector contains no elements.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
bool empty() const
{ return impl.empty() || impl.size() == ExtraPointers; }
+ //! <b>Effects</b>: Inserts or erases elements at the end such that
+ //! the size becomes n. New elements are copy constructed from x.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to the difference between size() and new_size.
void resize(size_type n, const T& t)
{
STABLE_VECTOR_CHECK_INVARIANT;
@@ -602,6 +796,12 @@
this->erase(this->cbegin() + n, this->cend());
}
+ //! <b>Effects</b>: Inserts or erases elements at the end such that
+ //! the size becomes n. New elements are default constructed.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to the difference between size() and new_size.
void resize(size_type n)
{
typedef default_construct_iterator<value_type, difference_type> default_iterator;
@@ -612,6 +812,12 @@
this->erase(this->cbegin() + n, this->cend());
}
+ //! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
+ //! effect. Otherwise, it is a request for allocation of additional memory.
+ //! If the request is successful, then capacity() is greater than or equal to
+ //! n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
+ //!
+ //! <b>Throws</b>: If memory allocation allocation throws.
void reserve(size_type n)
{
STABLE_VECTOR_CHECK_INVARIANT;
@@ -636,39 +842,106 @@
}
}
- // element access:
-
+ //! <b>Requires</b>: size() < n.
+ //!
+ //! <b>Effects</b>: Returns a reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
reference operator[](size_type n){return value(impl[n]);}
+
+ //! <b>Requires</b>: size() < n.
+ //!
+ //! <b>Effects</b>: Returns a const reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reference operator[](size_type n)const{return value(impl[n]);}
- const_reference at(size_type n)const
+ //! <b>Requires</b>: size() < n.
+ //!
+ //! <b>Effects</b>: Returns a reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: std::range_error if n >= size()
+ //!
+ //! <b>Complexity</b>: Constant.
+ reference at(size_type n)
{
if(n>=size())
throw std::out_of_range("invalid subscript at stable_vector::at");
return operator[](n);
}
- reference at(size_type n)
+ //! <b>Requires</b>: size() < n.
+ //!
+ //! <b>Effects</b>: Returns a const reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reference at(size_type n)const
{
if(n>=size())
throw std::out_of_range("invalid subscript at stable_vector::at");
return operator[](n);
}
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a reference to the first
+ //! element of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
reference front()
{ return value(impl.front()); }
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a const reference to the first
+ //! element of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reference front()const
{ return value(impl.front()); }
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a reference to the last
+ //! element of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
reference back()
{ return value(*(&impl.back() - ExtraPointers)); }
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a const reference to the last
+ //! element of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
const_reference back()const
{ return value(*(&impl.back() - ExtraPointers)); }
- // modifiers:
-
+ //! <b>Effects</b>: Inserts a copy of x at the end of the stable_vector.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
void push_back(insert_const_ref_type x)
{ return priv_push_back(x); }
@@ -676,16 +949,35 @@
void push_back(T &x) { push_back(const_cast<const T &>(x)); }
template<class U>
- void push_back(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ void push_back(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_push_back(u); }
#endif
- void push_back(BOOST_MOVE_MACRO_RV_REF(T) t)
- { this->insert(end(), BOOST_CONTAINER_MOVE_NAMESPACE::move(t)); }
+ //! <b>Effects</b>: Constructs a new element in the end of the stable_vector
+ //! and moves the resources of mx to this new element.
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_back(BOOST_RV_REF(T) t)
+ { this->insert(end(), boost::move(t)); }
+ //! <b>Effects</b>: Removes the last element from the stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant time.
void pop_back()
{ this->erase(this->end()-1); }
+ //! <b>Requires</b>: position must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert a copy of x before position.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or x's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: If position is end(), amortized constant time
+ //! Linear time otherwise.
iterator insert(const_iterator position, insert_const_ref_type x)
{ return this->priv_insert(position, x); }
@@ -693,14 +985,22 @@
iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast<const T &>(x)); }
template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
+ iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return this->priv_insert(position, u); }
#endif
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(T) x)
+ //! <b>Requires</b>: position must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert a new element before position with mx's resources.
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: If position is end(), amortized constant time
+ //! Linear time otherwise.
+ iterator insert(const_iterator position, BOOST_RV_REF(T) x)
{
typedef repeat_iterator<T, difference_type> repeat_it;
- typedef BOOST_CONTAINER_MOVE_NAMESPACE::move_iterator<repeat_it> repeat_move_it;
+ typedef boost::move_iterator<repeat_it> repeat_move_it;
//Just call more general insert(pos, size, value) and return iterator
size_type pos_n = position - cbegin();
this->insert(position
@@ -709,12 +1009,27 @@
return iterator(this->begin() + pos_n);
}
+ //! <b>Requires</b>: pos must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert n copies of x before pos.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
void insert(const_iterator position, size_type n, const T& t)
{
STABLE_VECTOR_CHECK_INVARIANT;
this->insert_not_iter(position, n, t);
}
+ //! <b>Requires</b>: pos must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert a copy of the [first, last) range before pos.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, T's constructor from a
+ //! dereferenced InpIt throws or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to std::distance [first, last).
template <class InputIterator>
void insert(const_iterator position,InputIterator first, InputIterator last)
{
@@ -726,7 +1041,7 @@
#if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type T constructed with
- //! std::forward<Args>(args)... in the end of the vector.
+ //! std::forward<Args>(args)... in the end of the stable_vector.
//!
//! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
//!
@@ -735,8 +1050,8 @@
void emplace_back(Args &&...args)
{
typedef emplace_functor<node_type_t, Args...> EmplaceFunctor;
- typedef emplace_iterator<node_type_t, EmplaceFunctor> EmplaceIterator;
- EmplaceFunctor &&ef = EmplaceFunctor(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator;
+ EmplaceFunctor &&ef = EmplaceFunctor(boost::forward<Args>(args)...);
this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
}
@@ -755,8 +1070,8 @@
//Just call more general insert(pos, size, value) and return iterator
size_type pos_n = position - cbegin();
typedef emplace_functor<node_type_t, Args...> EmplaceFunctor;
- typedef emplace_iterator<node_type_t, EmplaceFunctor> EmplaceIterator;
- EmplaceFunctor &&ef = EmplaceFunctor(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator;
+ EmplaceFunctor &&ef = EmplaceFunctor(boost::forward<Args>(args)...);
this->insert(position, EmplaceIterator(ef), EmplaceIterator());
return iterator(this->begin() + pos_n);
}
@@ -766,7 +1081,7 @@
void emplace_back()
{
typedef emplace_functor<node_type_t> EmplaceFunctor;
- typedef emplace_iterator<node_type_t, EmplaceFunctor> EmplaceIterator;
+ typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator;
EmplaceFunctor ef;
this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
}
@@ -774,7 +1089,7 @@
iterator emplace(const_iterator position)
{
typedef emplace_functor<node_type_t> EmplaceFunctor;
- typedef emplace_iterator<node_type_t, EmplaceFunctor> EmplaceIterator;
+ typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator;
EmplaceFunctor ef;
size_type pos_n = position - this->cbegin();
this->insert(position, EmplaceIterator(ef), EmplaceIterator());
@@ -787,7 +1102,7 @@
{ \
typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
<node_type_t, BOOST_PP_ENUM_PARAMS(n, P)> EmplaceFunctor; \
- typedef emplace_iterator<node_type_t, EmplaceFunctor> EmplaceIterator; \
+ typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator; \
EmplaceFunctor ef(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator()); \
} \
@@ -797,7 +1112,7 @@
{ \
typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
<node_type_t, BOOST_PP_ENUM_PARAMS(n, P)> EmplaceFunctor; \
- typedef emplace_iterator<node_type_t, EmplaceFunctor> EmplaceIterator; \
+ typedef emplace_iterator<node_type_t, EmplaceFunctor, difference_type> EmplaceIterator; \
EmplaceFunctor ef(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
size_type pos_n = pos - this->cbegin(); \
this->insert(pos, EmplaceIterator(ef), EmplaceIterator()); \
@@ -809,31 +1124,84 @@
#endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
+ //! <b>Effects</b>: Erases the element at position pos.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the elements between pos and the
+ //! last element. Constant if pos is the last element.
iterator erase(const_iterator position)
{
STABLE_VECTOR_CHECK_INVARIANT;
- difference_type d=position-this->cbegin();
- impl_iterator it=impl.begin()+d;
+ difference_type d = position - this->cbegin();
+ impl_iterator it = impl.begin() + d;
this->delete_node(*it);
- impl.erase(it);
- this->align_nodes(impl.begin()+d,get_last_align());
+ it = impl.erase(it);
+ this->align_nodes(it, get_last_align());
return this->begin()+d;
}
+ //! <b>Effects</b>: Erases the elements pointed by [first, last).
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the distance between first and last
+ //! plus linear to the elements between pos and the last element.
iterator erase(const_iterator first, const_iterator last)
{ return priv_erase(first, last, alloc_version()); }
+ //! <b>Effects</b>: Swaps the contents of *this and x.
+ //! If this->allocator_type() != x.allocator_type()
+ //! allocators are also swapped.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
void swap(stable_vector & x)
{
STABLE_VECTOR_CHECK_INVARIANT;
this->swap_impl(*this,x);
}
+ //! <b>Effects</b>: Erases all the elements of the stable_vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the stable_vector.
void clear()
{ this->erase(this->cbegin(),this->cend()); }
+ //! <b>Effects</b>: Tries to deallocate the excess of memory created
+ //! with previous allocations. The size of the stable_vector is unchanged
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: Linear to size().
+ void shrink_to_fit()
+ {
+ if(this->capacity()){
+ //First empty allocated node pool
+ this->clear_pool();
+ //If empty completely destroy the index, let's recover default-constructed state
+ if(this->empty()){
+ impl_type().swap(this->impl);
+ this->internal_data.set_end_pointer_to_default_constructed();
+ }
+ //Otherwise, try to shrink-to-fit the index and readjust pointers if necessary
+ else{
+ const size_type size = this->size();
+ const void* old_ptr = &impl[0];
+ this->impl.shrink_to_fit();
+ bool realloced = &impl[0] != old_ptr;
+ //Fix the pointers for the newly allocated buffer
+ if(realloced){
+ this->align_nodes(impl.begin(), impl.begin()+size+1);
+ }
+ }
+ }
+ }
+
/// @cond
- private:
iterator priv_insert(const_iterator position, const value_type &t)
{
@@ -847,17 +1215,17 @@
void clear_pool(allocator_v1)
{
if(!impl.empty() && impl.back()){
- void_ptr &p1 = *(impl.end()-2);
- void_ptr &p2 = impl.back();
+ void_ptr &pool_first_ref = impl.end()[-2];
+ void_ptr &pool_last_ref = impl.back();
multiallocation_chain holder;
- holder.incorporate_after(holder.before_begin(), p1, p2, this->internal_data.pool_size);
+ holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, this->internal_data.pool_size);
while(!holder.empty()){
node_type_ptr_t n = holder.front();
holder.pop_front();
this->deallocate_one(n);
}
- p1 = p2 = 0;
+ pool_first_ref = pool_last_ref = 0;
this->internal_data.pool_size = 0;
}
}
@@ -866,12 +1234,12 @@
{
if(!impl.empty() && impl.back()){
- void_ptr &p1 = *(impl.end()-2);
- void_ptr &p2 = impl.back();
+ void_ptr &pool_first_ref = impl.end()[-2];
+ void_ptr &pool_last_ref = impl.back();
multiallocation_chain holder;
- holder.incorporate_after(holder.before_begin(), p1, p2, internal_data.pool_size);
- get_al().deallocate_individual(BOOST_CONTAINER_MOVE_NAMESPACE::move(holder));
- p1 = p2 = 0;
+ holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
+ get_al().deallocate_individual(boost::move(holder));
+ pool_first_ref = pool_last_ref = 0;
this->internal_data.pool_size = 0;
}
}
@@ -896,30 +1264,30 @@
void add_to_pool(size_type n, allocator_v2)
{
- void_ptr &p1 = *(impl.end()-2);
- void_ptr &p2 = impl.back();
+ void_ptr &pool_first_ref = impl.end()[-2];
+ void_ptr &pool_last_ref = impl.back();
multiallocation_chain holder;
- holder.incorporate_after(holder.before_begin(), p1, p2, internal_data.pool_size);
- BOOST_STATIC_ASSERT((::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<multiallocation_chain>::value == true));
+ holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
+ //BOOST_STATIC_ASSERT((::boost::has_move_emulation_enabled<multiallocation_chain>::value == true));
multiallocation_chain m (get_al().allocate_individual(n));
holder.splice_after(holder.before_begin(), m, m.before_begin(), m.last(), n);
this->internal_data.pool_size += n;
std::pair<void_ptr, void_ptr> data(holder.extract_data());
- p1 = data.first;
- p2 = data.second;
+ pool_first_ref = data.first;
+ pool_last_ref = data.second;
}
void put_in_pool(node_type_ptr_t p)
{
- void_ptr &p1 = *(impl.end()-2);
- void_ptr &p2 = impl.back();
+ void_ptr &pool_first_ref = impl.end()[-2];
+ void_ptr &pool_last_ref = impl.back();
multiallocation_chain holder;
- holder.incorporate_after(holder.before_begin(), p1, p2, internal_data.pool_size);
+ holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
holder.push_front(p);
++this->internal_data.pool_size;
std::pair<void_ptr, void_ptr> ret(holder.extract_data());
- p1 = ret.first;
- p2 = ret.second;
+ pool_first_ref = ret.first;
+ pool_last_ref = ret.second;
}
node_type_ptr_t get_from_pool()
@@ -928,20 +1296,20 @@
return node_type_ptr_t(0);
}
else{
- void_ptr &p1 = *(impl.end()-2);
- void_ptr &p2 = impl.back();
+ void_ptr &pool_first_ref = impl.end()[-2];
+ void_ptr &pool_last_ref = impl.back();
multiallocation_chain holder;
- holder.incorporate_after(holder.before_begin(), p1, p2, internal_data.pool_size);
+ holder.incorporate_after(holder.before_begin(), pool_first_ref, pool_last_ref, internal_data.pool_size);
node_type_ptr_t ret = holder.front();
holder.pop_front();
--this->internal_data.pool_size;
if(!internal_data.pool_size){
- p1 = p2 = 0;
+ pool_first_ref = pool_last_ref = void_ptr(0);
}
else{
std::pair<void_ptr, void_ptr> data(holder.extract_data());
- p1 = data.first;
- p2 = data.second;
+ pool_first_ref = data.first;
+ pool_last_ref = data.second;
}
return ret;
}
@@ -992,8 +1360,8 @@
impl_iterator it1(impl.begin() + d1), it2(impl.begin() + d2);
for(impl_iterator it = it1; it != it2; ++it)
this->delete_node(*it);
- impl.erase(it1, it2);
- this->align_nodes(impl.begin() + d1, get_last_align());
+ impl_iterator e = impl.erase(it1, it2);
+ this->align_nodes(e, get_last_align());
}
return iterator(this->begin() + d1);
}
@@ -1018,19 +1386,19 @@
return priv_erase(first, last, allocator_v1());
}
- static node_type_ptr_t node_ptr_cast(void_ptr p)
+ static node_type_ptr_t node_ptr_cast(const void_ptr &p)
{
using boost::get_pointer;
return node_type_ptr_t(static_cast<node_type_t*>(stable_vector_detail::get_pointer(p)));
}
- static node_type_base_ptr_t node_base_ptr_cast(void_ptr p)
+ static node_type_base_ptr_t node_base_ptr_cast(const void_ptr &p)
{
using boost::get_pointer;
return node_type_base_ptr_t(static_cast<node_type_base_t*>(stable_vector_detail::get_pointer(p)));
}
- static value_type& value(void_ptr p)
+ static value_type& value(const void_ptr &p)
{
return node_ptr_cast(p)->value;
}
@@ -1065,7 +1433,7 @@
}
template<class Iter>
- void_ptr new_node(void_ptr up, Iter it)
+ void_ptr new_node(const void_ptr &up, Iter it)
{
node_type_ptr_t p = this->allocate_one();
try{
@@ -1079,14 +1447,14 @@
return p;
}
- void delete_node(void_ptr p)
+ void delete_node(const void_ptr &p)
{
node_type_ptr_t n(node_ptr_cast(p));
n->~node_type_t();
this->put_in_pool(n);
}
- static void align_nodes(impl_iterator first,impl_iterator last)
+ static void align_nodes(impl_iterator first, impl_iterator last)
{
while(first!=last){
node_ptr_cast(*first)->up = void_ptr(&*first);
@@ -1136,14 +1504,14 @@
size_type i=0;
try{
while(first!=last){
- *(it + i) = this->new_node(void_ptr((void*)(&*(it + i))), first);
+ it[i] = this->new_node(void_ptr_ptr(&it[i]), first);
++first;
++i;
}
}
catch(...){
- impl.erase(it + i, it + n);
- this->align_nodes(it + i, get_last_align());
+ impl_iterator e = impl.erase(it + i, it + n);
+ this->align_nodes(e, get_last_align());
throw;
}
}
@@ -1161,17 +1529,17 @@
mem.pop_front();
//This can throw
boost::container::construct_in_place(&*p, first);
- p->set_pointer(void_ptr((void*)(&*(it + i))));
+ p->set_pointer(void_ptr_ptr(&it[i]));
++first;
- *(it + i) = p;
+ it[i] = p;
++i;
}
}
catch(...){
get_al().deallocate_one(p);
- get_al().deallocate_many(BOOST_CONTAINER_MOVE_NAMESPACE::move(mem));
- impl.erase(it+i, it+n);
- this->align_nodes(it+i,get_last_align());
+ get_al().deallocate_many(boost::move(mem));
+ impl_iterator e = impl.erase(it+i, it+n);
+ this->align_nodes(e, get_last_align());
throw;
}
}
@@ -1190,16 +1558,16 @@
}
//This can throw
boost::container::construct_in_place(&*p, first);
- p->set_pointer(void_ptr(&*(it+i)));
+ p->set_pointer(void_ptr_ptr(&it[i]));
++first;
- *(it+i)=p;
+ it[i]=p;
++i;
}
}
catch(...){
put_in_pool(p);
- impl.erase(it+i,it+n);
- this->align_nodes(it+i,get_last_align());
+ impl_iterator e = impl.erase(it+i, it+n);
+ this->align_nodes(e, get_last_align());
throw;
}
}
@@ -1228,9 +1596,10 @@
if(get_end_node() != *(impl.end() - ExtraPointers)){
return false;
}
- for(const_impl_iterator it=impl.begin(),it_end=get_last_align();it!=it_end;++it){
- if(node_ptr_cast(*it)->up != &*it)
- return false;
+ for(const_impl_iterator it = impl.begin(), it_end = get_last_align(); it != it_end; ++it){
+ if(const_void_ptr(node_ptr_cast(*it)->up) !=
+ const_void_ptr(const_void_ptr_ptr(&*it)))
+ return false;
}
size_type n = capacity()-size();
const void_ptr &pool_head = impl.back();
@@ -1238,7 +1607,7 @@
node_type_ptr_t p = node_ptr_cast(pool_head);
while(p){
++num_pool;
- p = p->up;
+ p = node_ptr_cast(p->up);
}
return n >= num_pool;
}
@@ -1259,8 +1628,14 @@
ebo_holder(const allocator_type &a)
: node_allocator_type(a), pool_size(0), end_node()
{
+ this->set_end_pointer_to_default_constructed();
+ }
+
+ void set_end_pointer_to_default_constructed()
+ {
end_node.set_pointer(void_ptr(&end_node.up));
}
+
size_type pool_size;
node_type_base_t end_node;
} internal_data;
Modified: sandbox/move/boost/container/string.hpp
==============================================================================
--- sandbox/move/boost/container/string.hpp (original)
+++ sandbox/move/boost/container/string.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -22,7 +22,7 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_ALLOCATION_TYPE_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
#include <boost/static_assert.hpp>
#include <functional>
@@ -42,6 +42,7 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_TYPE_TRAITS_HPP
#include <boost/detail/no_exceptions_support.hpp>
#include <boost/type_traits/has_trivial_destructor.hpp>
+#include <boost/aligned_storage.hpp>
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost {
@@ -67,7 +68,7 @@
class basic_string_base
{
basic_string_base();
- BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(basic_string_base)
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_string_base)
public:
typedef A allocator_type;
@@ -81,14 +82,14 @@
: members_(a)
{ init(); }
- basic_string_base(const allocator_type& a, std::size_t n)
+ basic_string_base(const allocator_type& a, size_type n)
: members_(a)
{
this->init();
this->allocate_initial_block(n);
}
- basic_string_base(BOOST_MOVE_MACRO_RV_REF(basic_string_base) b)
+ basic_string_base(BOOST_RV_REF(basic_string_base) b)
: members_(b.members_)
{
init();
@@ -134,14 +135,6 @@
}
};
- //This basic type should have the same alignment as long_t
-//iG typedef typename type_with_alignment<containers_detail::alignment_of<long_t>::value>::type
-// long_alignment_type;
- typedef void *long_alignment_type;
- BOOST_STATIC_ASSERT((containers_detail::alignment_of<long_alignment_type>::value %
- containers_detail::alignment_of<long_t>::value) == 0);
-
-
//This type is the first part of the structure controlling a short string
//The "data" member stores
struct short_header
@@ -152,11 +145,9 @@
//This type has the same alignment and size as long_t but it's POD
//so, unlike long_t, it can be placed in a union
- struct long_raw_t
- {
- long_alignment_type a;
- unsigned char b[sizeof(long_t) - sizeof(long_alignment_type)];
- };
+
+ typedef typename boost::aligned_storage< sizeof(long_t),
+ containers_detail::alignment_of<long_t>::value>::type long_raw_t;
protected:
static const size_type MinInternalBufferChars = 8;
@@ -264,7 +255,7 @@
(void)limit_size;
(void)reuse;
if(!(command & allocate_new))
- return std::pair<pointer, bool>(pointer(0), 0);
+ return std::pair<pointer, bool>(pointer(0), false);
received_size = preferred_size;
return std::make_pair(this->alloc().allocate(received_size), false);
}
@@ -284,7 +275,7 @@
size_type next_capacity(size_type additional_objects) const
{ return get_next_capacity(this->alloc().max_size(), this->priv_storage(), additional_objects); }
- void deallocate(pointer p, std::size_t n)
+ void deallocate(pointer p, size_type n)
{
if (p && (n > InternalBufferChars))
this->alloc().deallocate(p, n);
@@ -302,7 +293,7 @@
void destroy(pointer p)
{ containers_detail::get_pointer(p)->~value_type(); }
- void allocate_initial_block(std::size_t n)
+ void allocate_initial_block(size_type n)
{
if (n <= this->max_size()) {
if(n > InternalBufferChars){
@@ -321,7 +312,7 @@
void deallocate_block()
{ this->deallocate(this->priv_addr(), this->priv_storage()); }
- std::size_t max_size() const
+ size_type max_size() const
{ return this->alloc().max_size() - 1; }
// Helper functions for exception handling.
@@ -429,7 +420,7 @@
{
/// @cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(basic_string)
+ BOOST_COPYABLE_AND_MOVABLE(basic_string)
typedef containers_detail::basic_string_base<A> base_t;
static const typename base_t::size_type InternalBufferChars = base_t::InternalBufferChars;
@@ -507,13 +498,14 @@
public: // Constructor, destructor, assignment.
/// @cond
struct reserve_t {};
- /// @endcond
- basic_string(reserve_t, std::size_t n,
+ basic_string(reserve_t, size_type n,
const allocator_type& a = allocator_type())
: base_t(a, n + 1)
{ this->priv_terminate_string(); }
+ /// @endcond
+
//! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter.
//!
//! <b>Throws</b>: If allocator_type's copy constructor throws.
@@ -535,8 +527,8 @@
//! <b>Throws</b>: If allocator_type's copy constructor throws.
//!
//! <b>Complexity</b>: Constant.
- basic_string(BOOST_MOVE_MACRO_RV_REF(basic_string) s)
- : base_t(BOOST_CONTAINER_MOVE_NAMESPACE::move((base_t&)s))
+ basic_string(BOOST_RV_REF(basic_string) s)
+ : base_t(boost::move((base_t&)s))
{}
//! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter,
@@ -584,7 +576,7 @@
: base_t(a)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InputIterator, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InputIterator, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
this->priv_initialize_dispatch(f, l, Result());
}
@@ -602,7 +594,7 @@
//! <b>Postcondition</b>: x == *this.
//!
//! <b>Complexity</b>: Linear to the elements x contains.
- basic_string& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(basic_string) s)
+ basic_string& operator=(BOOST_COPY_ASSIGN_REF(basic_string) s)
{
if (&s != this)
this->assign(s.begin(), s.end());
@@ -614,7 +606,7 @@
//! <b>Throws</b>: If allocator_type's copy constructor throws.
//!
//! <b>Complexity</b>: Constant.
- basic_string& operator=(BOOST_MOVE_MACRO_RV_REF(basic_string) ms)
+ basic_string& operator=(BOOST_RV_REF(basic_string) ms)
{
basic_string &s = ms;
if (&s != this){
@@ -931,7 +923,7 @@
{ return this->operator=(s); }
//! <b>Effects</b>: Moves the resources from ms *this.
- basic_string& assign(BOOST_MOVE_MACRO_RV_REF(basic_string) ms)
+ basic_string& assign(BOOST_RV_REF(basic_string) ms)
{ return this->operator=(ms);}
//! <b>Effects</b>: Assigns the range [pos, pos + n) from s to *this.
@@ -960,7 +952,7 @@
basic_string& assign(InputIter first, InputIter last)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InputIter, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InputIter, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
return this->priv_assign_dispatch(first, last, Result());
}
@@ -1050,7 +1042,7 @@
}
//! <b>Effects</b>: Inserts the character c n-times before position.
- void insert(iterator position, std::size_t n, CharT c)
+ void insert(iterator position, size_type n, CharT c)
{
this->insert(position, cvalue_iterator(c, n),
cvalue_iterator());
@@ -1061,7 +1053,7 @@
void insert(iterator p, InputIter first, InputIter last)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InputIter, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InputIter, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
this->priv_insert_dispatch(p, first, last, Result());
}
@@ -1204,7 +1196,7 @@
InputIter f, InputIter l)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InputIter, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InputIter, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
return this->priv_replace_dispatch(first, last, f, l, Result());
}
@@ -1295,7 +1287,7 @@
//! substring of *this, beginning at character position min(pos, size()).
size_type rfind(const CharT* s, size_type pos, size_type n) const
{
- const std::size_t len = size();
+ const size_type len = size();
if (n > len)
return npos;
@@ -1540,8 +1532,8 @@
static int s_compare(const_pointer f1, const_pointer l1,
const_pointer f2, const_pointer l2)
{
- const std::ptrdiff_t n1 = l1 - f1;
- const std::ptrdiff_t n2 = l2 - f2;
+ const difference_type n1 = l1 - f1;
+ const difference_type n2 = l2 - f2;
const int cmp = Traits::compare(containers_detail::get_pointer(f1),
containers_detail::get_pointer(f2),
containers_detail::min_value(n1, n2));
@@ -1900,19 +1892,19 @@
}
template <class CharT, class Traits, class A> inline
-BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
operator+(
- BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
+ BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
, const basic_string<CharT,Traits,A>& y)
{
mx += y;
- return BOOST_CONTAINER_MOVE_NAMESPACE::move(mx);
+ return boost::move(mx);
}
template <class CharT, class Traits, class A> inline
-BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
operator+(const basic_string<CharT,Traits,A>& x,
- BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+ BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
{
typedef typename basic_string<CharT,Traits,A>::size_type size_type;
return my.replace(size_type(0), size_type(0), x);
@@ -1922,10 +1914,10 @@
inline basic_string<CharT,Traits,A>
operator+(const CharT* s, const basic_string<CharT,Traits,A>& y)
{
- typedef basic_string<CharT,Traits,A> str_t;
+ typedef basic_string<CharT, Traits, A> str_t;
typedef typename str_t::reserve_t reserve_t;
reserve_t reserve;
- const std::size_t n = Traits::length(s);
+ const typename str_t::size_type n = Traits::length(s);
str_t result(reserve, n + y.size());
result.append(s, s + n);
result.append(y);
@@ -1933,12 +1925,12 @@
}
template <class CharT, class Traits, class A> inline
-BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
operator+(const CharT* s,
- BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+ BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
{
typedef typename basic_string<CharT,Traits,A>::size_type size_type;
- return BOOST_CONTAINER_MOVE_NAMESPACE::move(my.get().replace(size_type(0), size_type(0), s));
+ return boost::move(my.get().replace(size_type(0), size_type(0), s));
}
template <class CharT, class Traits, class A>
@@ -1955,9 +1947,9 @@
}
template <class CharT, class Traits, class A> inline
-BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
operator+(CharT c,
- BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
+ BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) my)
{
typedef typename basic_string<CharT,Traits,A>::size_type size_type;
return my.replace(size_type(0), size_type(0), &c, &c + 1);
@@ -1970,7 +1962,7 @@
typedef basic_string<CharT,Traits,A> str_t;
typedef typename str_t::reserve_t reserve_t;
reserve_t reserve;
- const std::size_t n = Traits::length(s);
+ const typename str_t::size_type n = Traits::length(s);
str_t result(reserve, x.size() + n, x.alloc());
result.append(x);
result.append(s, s + n);
@@ -1978,12 +1970,12 @@
}
template <class CharT, class Traits, class A>
-BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-operator+(BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+operator+(BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
, const CharT* s)
{
mx += s;
- return BOOST_CONTAINER_MOVE_NAMESPACE::move(mx);
+ return boost::move(mx);
}
template <class CharT, class Traits, class A>
@@ -2000,12 +1992,12 @@
}
template <class CharT, class Traits, class A>
-BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
-operator+( BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
+BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
+operator+( BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
, const CharT c)
{
mx += c;
- return BOOST_CONTAINER_MOVE_NAMESPACE::move(mx);
+ return boost::move(mx);
}
// Operator== and operator!=
@@ -2023,7 +2015,7 @@
inline bool
operator==(const CharT* s, const basic_string<CharT,Traits,A>& y)
{
- std::size_t n = Traits::length(s);
+ typename basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
return n == y.size() && Traits::compare(s, y.data(), n) == 0;
}
@@ -2031,7 +2023,7 @@
inline bool
operator==(const basic_string<CharT,Traits,A>& x, const CharT* s)
{
- std::size_t n = Traits::length(s);
+ typename basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
return x.size() == n && Traits::compare(x.data(), s, n) == 0;
}
@@ -2068,7 +2060,7 @@
operator<(const CharT* s, const basic_string<CharT,Traits,A>& y)
{
return y.compare(s) > 0;
-// std::size_t n = Traits::length(s);
+// basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
// return basic_string<CharT,Traits,A>
// ::s_compare(s, s + n, y.begin(), y.end()) < 0;
}
@@ -2079,7 +2071,7 @@
const CharT* s)
{
return x.compare(s) < 0;
-// std::size_t n = Traits::length(s);
+// basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
// return basic_string<CharT,Traits,A>
// ::s_compare(x.begin(), x.end(), s, s + n) < 0;
}
@@ -2174,8 +2166,8 @@
if (sentry) {
ok = true;
- std::size_t n = s.size();
- std::size_t pad_len = 0;
+ typename basic_string<CharT,Traits,A>::size_type n = s.size();
+ typename basic_string<CharT,Traits,A>::size_type pad_len = 0;
const bool left = (os.flags() & std::ios::left) != 0;
const std::size_t w = os.width(0);
std::basic_streambuf<CharT, Traits>* buf = os.rdbuf();
@@ -2251,7 +2243,7 @@
std::basic_istream<CharT, Traits>&
getline(std::istream& is, basic_string<CharT,Traits,A>& s,CharT delim)
{
- std::size_t nread = 0;
+ typename basic_string<CharT,Traits,A>::size_type nread = 0;
typename std::basic_istream<CharT, Traits>::sentry sentry(is, true);
if (sentry) {
std::basic_streambuf<CharT, Traits>* buf = is.rdbuf();
Modified: sandbox/move/boost/container/vector.hpp
==============================================================================
--- sandbox/move/boost/container/vector.hpp (original)
+++ sandbox/move/boost/container/vector.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -31,6 +31,7 @@
#include <boost/type_traits/has_trivial_assign.hpp>
#include <boost/type_traits/has_nothrow_copy.hpp>
#include <boost/type_traits/has_nothrow_assign.hpp>
+#include <boost/move/move_helpers.hpp>
#include INCLUDE_BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_ALLOCATION_TYPE_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_UTILITIES_HPP
@@ -38,7 +39,7 @@
#include INCLUDE_BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_DESTROYERS_HPP
#include INCLUDE_BOOST_CONTAINER_CONTAINER_FWD_HPP
-#include INCLUDE_BOOST_CONTAINER_MOVE_HPP
+#include <boost/move/move.hpp>
#include <boost/pointer_to_other.hpp>
#include INCLUDE_BOOST_CONTAINER_DETAIL_MPL_HPP
#include INCLUDE_BOOST_CONTAINER_DETAIL_ADVANCED_INSERT_INT_HPP
@@ -288,7 +289,7 @@
(void)limit_size;
(void)reuse;
if(!(command & allocate_new))
- return std::pair<pointer, bool>(pointer(0), 0);
+ return std::pair<pointer, bool>(pointer(0), false);
received_size = preferred_size;
return std::make_pair(this->alloc().allocate(received_size), false);
}
@@ -375,8 +376,6 @@
/// @cond
typedef vector<T, A> self_t;
typedef containers_detail::vector_alloc_holder<A> base_t;
- typedef typename containers_detail::
- move_const_ref_type<T>::type insert_const_ref_type;
/// @endcond
public:
//! The type of object, T, stored in the vector
@@ -411,7 +410,7 @@
/// @cond
private:
- BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(vector)
+ BOOST_COPYABLE_AND_MOVABLE(vector)
typedef containers_detail::advanced_insert_aux_int<T, T*> advanced_insert_aux_int_t;
typedef containers_detail::vector_value_traits<value_type, A> value_traits;
@@ -421,7 +420,7 @@
typedef constant_iterator<T, difference_type> cvalue_iterator;
typedef repeat_iterator<T, difference_type> repeat_it;
- typedef BOOST_CONTAINER_MOVE_NAMESPACE::move_iterator<repeat_it> repeat_move_it;
+ typedef boost::move_iterator<repeat_it> repeat_move_it;
/// @endcond
public:
@@ -471,7 +470,7 @@
//! <b>Throws</b>: If allocator_type's copy constructor throws.
//!
//! <b>Complexity</b>: Constant.
- vector(BOOST_MOVE_MACRO_RV_REF(vector) mx)
+ vector(BOOST_RV_REF(vector) mx)
: base_t(static_cast<base_t&>(mx).alloc())
{ this->swap(mx); }
@@ -600,8 +599,8 @@
//! <b>Requires</b>: !empty()
//!
- //! <b>Effects</b>: Returns a reference to the first element
- //! from the beginning of the container.
+ //! <b>Effects</b>: Returns a reference to the first
+ //! element of the container.
//!
//! <b>Throws</b>: Nothing.
//!
@@ -611,8 +610,8 @@
//! <b>Requires</b>: !empty()
//!
- //! <b>Effects</b>: Returns a const reference to the first element
- //! from the beginning of the container.
+ //! <b>Effects</b>: Returns a const reference to the first
+ //! element of the container.
//!
//! <b>Throws</b>: Nothing.
//!
@@ -622,8 +621,8 @@
//! <b>Requires</b>: !empty()
//!
- //! <b>Effects</b>: Returns a reference to the first element
- //! from the beginning of the container.
+ //! <b>Effects</b>: Returns a reference to the last
+ //! element of the container.
//!
//! <b>Throws</b>: Nothing.
//!
@@ -631,8 +630,10 @@
reference back()
{ return this->members_.m_start[this->members_.m_size - 1]; }
- //! <b>Effects</b>: Returns a const reference to the first element
- //! from the beginning of the container.
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a const reference to the last
+ //! element of the container.
//!
//! <b>Throws</b>: Nothing.
//!
@@ -754,7 +755,7 @@
//! If the request is successful, then capacity() is greater than or equal to
//! n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
//!
- //! <b>Throws</b>: If memory allocation allocation throws or T's copy constructor throws.
+ //! <b>Throws</b>: If memory allocation allocation throws or T's copy/move constructor throws.
void reserve(size_type new_cap)
{
if (this->capacity() < new_cap){
@@ -780,8 +781,8 @@
else{
//We will reuse insert code, so create a dummy input iterator
T *dummy_it(containers_detail::get_pointer(this->members_.m_start));
- containers_detail::advanced_insert_aux_proxy<T, BOOST_CONTAINER_MOVE_NAMESPACE::move_iterator<T*>, T*>
- proxy(::BOOST_CONTAINER_MOVE_NAMESPACE::make_move_iterator(dummy_it), ::BOOST_CONTAINER_MOVE_NAMESPACE::make_move_iterator(dummy_it));
+ containers_detail::advanced_insert_aux_proxy<T, boost::move_iterator<T*>, T*>
+ proxy(::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
//Backwards (and possibly forward) expansion
if(ret.second){
#ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
@@ -818,7 +819,7 @@
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to the number of elements in x.
- vector& operator=(BOOST_MOVE_MACRO_COPY_ASSIGN_REF(vector) x)
+ vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x)
{
if (&x != this){
this->assign(x.members_.m_start, x.members_.m_start + x.members_.m_size);
@@ -834,7 +835,7 @@
//! <b>Throws</b>: If allocator_type's copy constructor throws.
//!
//! <b>Complexity</b>: Linear.
- vector& operator=(BOOST_MOVE_MACRO_RV_REF(vector) x)
+ vector& operator=(BOOST_RV_REF(vector) x)
{
if (&x != this){
this->swap(x);
@@ -861,17 +862,32 @@
void assign(InIt first, InIt last)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InIt, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
this->priv_assign_dispatch(first, last, Result());
}
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts a copy of x at the end of the vector.
//!
//! <b>Throws</b>: If memory allocation throws or
//! T's copy constructor throws.
//!
//! <b>Complexity</b>: Amortized constant time.
+ void push_back(const T &x);
+
+ //! <b>Effects</b>: Constructs a new element in the end of the vector
+ //! and moves the resources of mx to this new element.
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_back(T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
+ #endif
+
+/*
void push_back(insert_const_ref_type x)
{ return priv_push_back(x); }
@@ -879,11 +895,13 @@
void push_back(T &x) { push_back(const_cast<const T &>(x)); }
template<class U>
- void push_back(const U &u, typename containers_detail::enable_if_c
- <containers_detail::is_same<T, U>::value &&
- !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value
- >::type* =0)
+ typename containers_detail::enable_if_c
+ <!::boost::has_move_emulation_enabled<U>::value &&
+ containers_detail::is_same<T, U>::value
+ >::type
+ push_back(const U &u)
{ return priv_push_back(u); }
+
#endif
//! <b>Effects</b>: Constructs a new element in the end of the vector
@@ -892,17 +910,25 @@
//! <b>Throws</b>: If memory allocation throws.
//!
//! <b>Complexity</b>: Amortized constant time.
- void push_back(BOOST_MOVE_MACRO_RV_REF(T) x)
+ void push_back(BOOST_RV_REF(T) x)
{
if (this->members_.m_size < this->members_.m_capacity){
//There is more memory, just construct a new object at the end
- new((void*)containers_detail::get_pointer(this->members_.m_start + this->members_.m_size))value_type(BOOST_CONTAINER_MOVE_NAMESPACE::move(x));
+ new((void*)containers_detail::get_pointer(this->members_.m_start + this->members_.m_size))value_type(::boost::move(x));
++this->members_.m_size;
}
else{
- this->insert(this->cend(), BOOST_CONTAINER_MOVE_NAMESPACE::move(x));
+ this->insert(this->cend(), ::boost::move(x));
}
}
+*/
+ //! <b>Effects</b>: Constructs a new element in the end of the vector
+ //! and moves the resources of mx to this new element.
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+
#if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -918,12 +944,12 @@
T* back_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size;
if (this->members_.m_size < this->members_.m_capacity){
//There is more memory, just construct a new object at the end
- new((void*)(back_pos))value_type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ new((void*)(back_pos))value_type(::boost::forward<Args>(args)...);
++this->members_.m_size;
}
else{
typedef containers_detail::advanced_insert_aux_emplace<T, T*, Args...> type;
- type &&proxy = type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ type &&proxy = type(::boost::forward<Args>(args)...);
priv_range_insert(back_pos, 1, proxy);
}
}
@@ -943,7 +969,7 @@
//Just call more general insert(pos, size, value) and return iterator
size_type pos_n = position - cbegin();
typedef containers_detail::advanced_insert_aux_emplace<T, T*, Args...> type;
- type &&proxy = type(BOOST_CONTAINER_MOVE_NAMESPACE::forward<Args>(args)...);
+ type &&proxy = type(::boost::forward<Args>(args)...);
priv_range_insert(position.get_ptr(), 1, proxy);
return iterator(this->members_.m_start + pos_n);
}
@@ -974,30 +1000,30 @@
#define BOOST_PP_LOCAL_MACRO(n) \
template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
{ \
T* back_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size; \
if (this->members_.m_size < this->members_.m_capacity){ \
new((void*)(back_pos))value_type \
- (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ (BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
++this->members_.m_size; \
} \
else{ \
- containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
+ containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
<value_type, T*, BOOST_PP_ENUM_PARAMS(n, P)> \
- proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
priv_range_insert(back_pos, 1, proxy); \
} \
} \
\
template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- iterator emplace(const_iterator pos, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
+ iterator emplace(const_iterator pos, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
{ \
size_type pos_n = pos - cbegin(); \
- containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
+ containers_detail::BOOST_PP_CAT(BOOST_PP_CAT(advanced_insert_aux_emplace, n), arg) \
<value_type, T*, BOOST_PP_ENUM_PARAMS(n, P)> \
- proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
- priv_range_insert(containers_detail::get_pointer(pos.get_ptr()), 1, proxy); \
+ proxy(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); \
+ priv_range_insert(containers_detail::get_pointer(pos.get_ptr()), 1, proxy); \
return iterator(this->members_.m_start + pos_n); \
} \
//!
@@ -1026,6 +1052,7 @@
}
}
+ #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
//! <b>Requires</b>: position must be a valid iterator of *this.
//!
//! <b>Effects</b>: Insert a copy of x before position.
@@ -1034,16 +1061,7 @@
//!
//! <b>Complexity</b>: If position is end(), amortized constant time
//! Linear time otherwise.
- iterator insert(const_iterator position, insert_const_ref_type x)
- { return this->priv_insert(position, x); }
-
- #if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
- iterator insert(const_iterator position, T &x) { return this->insert(position, const_cast<const T &>(x)); }
-
- template<class U>
- iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::BOOST_CONTAINER_MOVE_NAMESPACE::is_movable<U>::value >::type* =0)
- { return this->priv_insert(position, u); }
- #endif
+ iterator insert(const_iterator position, const T &x);
//! <b>Requires</b>: position must be a valid iterator of *this.
//!
@@ -1053,15 +1071,10 @@
//!
//! <b>Complexity</b>: If position is end(), amortized constant time
//! Linear time otherwise.
- iterator insert(const_iterator position, BOOST_MOVE_MACRO_RV_REF(T) x)
- {
- //Just call more general insert(pos, size, value) and return iterator
- size_type pos_n = position - cbegin();
- this->insert(position
- ,repeat_move_it(repeat_it(x, 1))
- ,repeat_move_it(repeat_it()));
- return iterator(this->members_.m_start + pos_n);
- }
+ iterator insert(const_iterator position, T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
+ #endif
//! <b>Requires</b>: pos must be a valid iterator of *this.
//!
@@ -1075,7 +1088,7 @@
void insert(const_iterator pos, InIt first, InIt last)
{
//Dispatch depending on integer/iterator
- const bool aux_boolean = containers_detail::is_convertible<InIt, std::size_t>::value;
+ const bool aux_boolean = containers_detail::is_convertible<InIt, size_type>::value;
typedef containers_detail::bool_<aux_boolean> Result;
this->priv_insert_dispatch(pos, first, last, Result());
}
@@ -1107,12 +1120,12 @@
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the elements between pos and the
- //! last element. Constant if pos is the first or the last element.
+ //! last element. Constant if pos is the last element.
iterator erase(const_iterator position)
{
T *pos = containers_detail::get_pointer(position.get_ptr());
T *beg = containers_detail::get_pointer(this->members_.m_start);
- BOOST_CONTAINER_MOVE_NAMESPACE::move(pos + 1, beg + this->members_.m_size, pos);
+ ::boost::move(pos + 1, beg + this->members_.m_size, pos);
--this->members_.m_size;
//Destroy last element
base_t::destroy(containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size);
@@ -1123,12 +1136,13 @@
//!
//! <b>Throws</b>: Nothing.
//!
- //! <b>Complexity</b>: Linear to the distance between first and last.
+ //! <b>Complexity</b>: Linear to the distance between first and last
+ //! plus linear to the elements between pos and the last element.
iterator erase(const_iterator first, const_iterator last)
{
if (first != last){ // worth doing, copy down over hole
T* end_pos = containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size;
- T* ptr = containers_detail::get_pointer(BOOST_CONTAINER_MOVE_NAMESPACE::move
+ T* ptr = containers_detail::get_pointer(boost::move
(containers_detail::get_pointer(last.get_ptr())
,end_pos
,containers_detail::get_pointer(first.get_ptr())
@@ -1190,7 +1204,7 @@
//! <b>Effects</b>: Tries to deallocate the excess of memory created
//! with previous allocations. The size of the vector is unchanged
//!
- //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
+ //! <b>Throws</b>: If memory allocation throws, or T's copy/move constructor throws.
//!
//! <b>Complexity</b>: Linear to size().
void shrink_to_fit()
@@ -1207,15 +1221,26 @@
return iterator(this->members_.m_start + pos_n);
}
- void priv_push_back(const T &x)
+ iterator priv_insert(const_iterator position, BOOST_RV_REF(T) x)
+ {
+ //Just call more general insert(pos, size, value) and return iterator
+ size_type pos_n = position - cbegin();
+ this->insert(position
+ ,repeat_move_it(repeat_it(x, 1))
+ ,repeat_move_it(repeat_it()));
+ return iterator(this->members_.m_start + pos_n);
+ }
+
+ template <class U>
+ void priv_push_back(BOOST_MOVE_CATCH_FWD(U) x)
{
if (this->members_.m_size < this->members_.m_capacity){
//There is more memory, just construct a new object at the end
- new((void*)(containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size))value_type(x);
+ new((void*)containers_detail::get_pointer(this->members_.m_start + this->members_.m_size))value_type(::boost::forward<U>(x));
++this->members_.m_size;
}
else{
- this->insert(this->cend(), x);
+ this->insert(this->cend(), ::boost::forward<U>(x));
}
}
@@ -1226,8 +1251,29 @@
this->prot_deallocate();
}
else{
- //This would not work with stateful allocators
- vector<T, A>(*this).swap(*this);
+ //Allocate a new buffer.
+ size_type real_cap = 0;
+ std::pair<pointer, bool> ret =
+ this->allocation_command
+ (allocate_new, this->size(), this->size(), real_cap, this->members_.m_start);
+ if(real_cap < this->capacity()){
+ //We will reuse insert code, so create a dummy input iterator
+ T *dummy_it(containers_detail::get_pointer(this->members_.m_start));
+ containers_detail::advanced_insert_aux_proxy<T, boost::move_iterator<T*>, T*>
+ proxy(::boost::make_move_iterator(dummy_it), ::boost::make_move_iterator(dummy_it));
+ #ifdef BOOST_CONTAINERS_VECTOR_ALLOC_STATS
+ ++this->num_alloc;
+ #endif
+ this->priv_range_insert_new_allocation
+ ( containers_detail::get_pointer(ret.first)
+ , real_cap
+ , containers_detail::get_pointer(this->members_.m_start)
+ , 0
+ , proxy);
+ }
+ else{
+ this->alloc().deallocate(ret.first, real_cap);
+ }
}
}
}
@@ -1335,10 +1381,10 @@
if (elems_after > n){
//New elements can be just copied.
//Move to uninitialized memory last objects
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_finish - n, old_finish, old_finish);
+ ::boost::uninitialized_move(old_finish - n, old_finish, old_finish);
this->members_.m_size += n;
//Copy previous to last objects to the initialized end
- BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(pos, old_finish - n, old_finish);
+ boost::move_backward(pos, old_finish - n, old_finish);
//Insert new objects in the pos
interf.copy_all_to(pos);
}
@@ -1348,7 +1394,7 @@
interf.uninitialized_copy_some_and_update(old_finish, elems_after, false);
this->members_.m_size += n - elems_after;
//Copy old [pos, end()) elements to the uninitialized memory
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move
+ ::boost::uninitialized_move
( pos, old_finish, containers_detail::get_pointer(this->members_.m_start) + this->members_.m_size);
this->members_.m_size += elems_after;
//Copy first new elements in pos
@@ -1370,7 +1416,7 @@
//the start of the new buffer
T *old_buffer = containers_detail::get_pointer(this->members_.m_start);
if(old_buffer){
- new_finish = ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move
+ new_finish = ::boost::uninitialized_move
(containers_detail::get_pointer(this->members_.m_start), pos, old_finish = new_finish);
constructed_values_destroyer.increment_size(new_finish - old_finish);
}
@@ -1381,7 +1427,7 @@
//Initialize from the rest of the old buffer,
//starting from previous point
if(old_buffer){
- new_finish = ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move
+ new_finish = ::boost::uninitialized_move
(pos, old_buffer + this->members_.m_size, new_finish);
//Destroy and deallocate old elements
//If there is allocated memory, destroy and deallocate
@@ -1422,7 +1468,7 @@
//Check if s_before is big enough to hold the beginning of old data + new data
if(difference_type(s_before) >= difference_type(elemsbefore + n)){
//Copy first old values before pos, after that the new objects
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_start, pos, new_start);
+ ::boost::uninitialized_move(old_start, pos, new_start);
this->members_.m_size = elemsbefore;
interf.uninitialized_copy_all_to(new_start + elemsbefore);
this->members_.m_size += n;
@@ -1440,7 +1486,7 @@
//|___________|__________|_________|________________________|
//
//Now initialize the rest of memory with the last old values
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move
+ ::boost::uninitialized_move
(pos, old_finish, new_start + elemsbefore + n);
//All new elements correctly constructed, avoid new element destruction
this->members_.m_size = old_size + n;
@@ -1467,13 +1513,13 @@
size_type raw_gap = s_before - (elemsbefore + n);
//Now initialize the rest of s_before memory with the
//first of elements after new values
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(pos, pos + raw_gap, new_start + elemsbefore + n);
+ ::boost::uninitialized_move(pos, pos + raw_gap, new_start + elemsbefore + n);
//Update size since we have a contiguous buffer
this->members_.m_size = old_size + s_before;
//All new elements correctly constructed, avoid old element destruction
old_values_destroyer.release();
//Now copy remaining last objects in the old buffer begin
- T *to_destroy = BOOST_CONTAINER_MOVE_NAMESPACE::move(pos + raw_gap, old_finish, old_start);
+ T *to_destroy = ::boost::move(pos + raw_gap, old_finish, old_start);
//Now destroy redundant elements except if they were moved and
//they have trivial destructor after move
size_type n_destroy = old_finish - to_destroy;
@@ -1532,13 +1578,13 @@
//
//Copy the first part of old_begin to raw_mem
T *start_n = old_start + difference_type(s_before);
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_start, start_n, new_start);
+ ::boost::uninitialized_move(old_start, start_n, new_start);
//The buffer is all constructed until old_end,
//release destroyer and update size
old_values_destroyer.release();
this->members_.m_size = old_size + s_before;
//Now copy the second part of old_begin overwriting himself
- T* next = BOOST_CONTAINER_MOVE_NAMESPACE::move(start_n, pos, old_start);
+ T* next = ::boost::move(start_n, pos, old_start);
if(do_after){
//Now copy the new_beg elements
interf.copy_some_and_update(next, s_before, true);
@@ -1548,7 +1594,7 @@
interf.copy_all_to(next);
T* move_start = next + n;
//Now displace old_end elements
- T* move_end = BOOST_CONTAINER_MOVE_NAMESPACE::move(pos, old_finish, move_start);
+ T* move_end = ::boost::move(pos, old_finish, move_start);
//Destroy remaining moved elements from old_end except if
//they have trivial destructor after being moved
difference_type n_destroy = s_before - n;
@@ -1584,7 +1630,7 @@
//|___________|_____|_________|__________________________|
//
//First copy whole old_begin and part of new to raw_mem
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(old_start, pos, new_start);
+ ::boost::uninitialized_move(old_start, pos, new_start);
this->members_.m_size = elemsbefore;
const size_type mid_n = difference_type(s_before) - elemsbefore;
@@ -1603,7 +1649,7 @@
interf.copy_all_to(old_start);
T* move_start = old_start + (n-mid_n);
//Displace old_end
- T* move_end = BOOST_CONTAINER_MOVE_NAMESPACE::move(pos, old_finish, move_start);
+ T* move_end = ::boost::move(pos, old_finish, move_start);
//Destroy remaining moved elements from old_end except if they
//have trivial destructor after being moved
difference_type n_destroy = s_before - n;
@@ -1654,10 +1700,10 @@
//
//First copy the part of old_end raw_mem
T* finish_n = old_finish - difference_type(n_after);
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(finish_n, old_finish, old_finish);
+ ::boost::uninitialized_move(finish_n, old_finish, old_finish);
this->members_.m_size += n_after;
//Displace the rest of old_end to the new position
- BOOST_CONTAINER_MOVE_NAMESPACE::move_backward(pos, finish_n, old_finish);
+ boost::move_backward(pos, finish_n, old_finish);
//Now overwrite with new_end
//The new_end part is [first + (n - n_after), last)
interf.copy_all_to(pos);
@@ -1680,7 +1726,7 @@
//The new_end part is [first + (n - n_after), last)
interf.uninitialized_copy_some_and_update(old_finish, elemsafter, false);
this->members_.m_size += mid_last_dist;
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_move(pos, old_finish, old_finish + mid_last_dist);
+ ::boost::uninitialized_move(pos, old_finish, old_finish + mid_last_dist);
this->members_.m_size += n_after - mid_last_dist;
//Now copy the part of new_end over constructed elements
interf.copy_all_to(pos);
@@ -1693,7 +1739,7 @@
void priv_range_insert(const_iterator pos, InIt first, InIt last, std::input_iterator_tag)
{
for(;first != last; ++first){
- this->insert(pos, BOOST_CONTAINER_MOVE_NAMESPACE::move(value_type(*first)));
+ this->insert(pos, ::boost::move(value_type(*first)));
}
}
@@ -1764,14 +1810,14 @@
T *end = std::copy(first, mid, start);
//Initialize the remaining new elements in the uninitialized memory
// iG std::uninitialized_copy(mid, last, end);
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(mid, last, end);
+ ::boost::uninitialized_copy_or_move(mid, last, end);
this->members_.m_size = n;
}
}
else if(!ret.second){
typename value_traits::UCopiedArrayDeallocator scoped_alloc(ret.first, this->alloc(), real_cap);
// iG std::uninitialized_copy(first, last, containers_detail::get_pointer(ret.first));
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first, last, containers_detail::get_pointer(ret.first));
+ ::boost::uninitialized_copy_or_move(first, last, containers_detail::get_pointer(ret.first));
scoped_alloc.release();
//Destroy and deallocate old buffer
if(this->members_.m_start != 0){
@@ -1801,7 +1847,7 @@
FwdIt mid = first;
std::advance(mid, first_count);
// iG std::uninitialized_copy(first, mid, containers_detail::get_pointer(ret.first));
- ::BOOST_CONTAINER_MOVE_NAMESPACE::uninitialized_copy_or_move(first, mid, containers_detail::get_pointer(ret.first));
+ ::boost::uninitialized_copy_or_move(first, mid, containers_detail::get_pointer(ret.first));
if(old_offset > n){
//All old elements will be destroyed by "old_values_destroyer"
@@ -1839,7 +1885,7 @@
template <class Integer>
void priv_assign_dispatch(Integer n, Integer val, containers_detail::true_)
- { this->assign((size_type) n, val); }
+ { this->assign((size_type) n, (value_type)val); }
template <class InIt>
void priv_assign_dispatch(InIt first, InIt last, containers_detail::false_)
Modified: sandbox/move/boost/intrusive/avl_set.hpp
==============================================================================
--- sandbox/move/boost/intrusive/avl_set.hpp (original)
+++ sandbox/move/boost/intrusive/avl_set.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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: sandbox/move/boost/intrusive/avltree.hpp
==============================================================================
--- sandbox/move/boost/intrusive/avltree.hpp (original)
+++ sandbox/move/boost/intrusive/avltree.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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.
@@ -465,9 +486,10 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal_upper_bound
+ iterator ret(node_algorithms::insert_equal_upper_bound
(node_ptr(&priv_header()), to_insert, key_node_comp), this);
+ this->priv_size_traits().increment();
+ return ret;
}
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
@@ -491,9 +513,10 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal
+ iterator ret(node_algorithms::insert_equal
(node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp), this);
+ this->priv_size_traits().increment();
+ return ret;
}
//! <b>Requires</b>: Dereferencing iterator must yield an lvalue
@@ -698,9 +721,9 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
node_algorithms::insert_unique_commit
(node_ptr(&priv_header()), to_insert, commit_data);
+ this->priv_size_traits().increment();
return iterator(to_insert, this);
}
@@ -723,9 +746,10 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_before
+ iterator ret(node_algorithms::insert_before
(node_ptr(&priv_header()), pos.pointed_node(), to_insert), this);
+ this->priv_size_traits().increment();
+ return ret;
}
//! <b>Requires</b>: value must be an lvalue, and it must be no less
@@ -747,8 +771,8 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
node_algorithms::push_back(node_ptr(&priv_header()), to_insert);
+ this->priv_size_traits().increment();
}
//! <b>Requires</b>: value must be an lvalue, and it must be no greater
@@ -770,8 +794,8 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
node_algorithms::push_front(node_ptr(&priv_header()), to_insert);
+ this->priv_size_traits().increment();
}
//! <b>Effects</b>: Erases the element pointed to by pos.
@@ -1271,6 +1295,8 @@
node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
, node_ptr(&priv_header())
, get_real_value_traits().to_node_ptr(with_this));
+ if(safemode_or_autounlink)
+ node_algorithms::init(replace_this.pointed_node());
}
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
@@ -1601,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;
@@ -1623,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: sandbox/move/boost/intrusive/circular_slist_algorithms.hpp
==============================================================================
--- sandbox/move/boost/intrusive/circular_slist_algorithms.hpp (original)
+++ sandbox/move/boost/intrusive/circular_slist_algorithms.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -63,7 +63,7 @@
//! <b>Effects</b>: Constructs an non-used list element, putting the next
//! pointer to null:
- //! <tt>NodeTraits::get_next(this_node) == 0
+ //! <tt>NodeTraits::get_next(this_node) == 0</tt>
//!
//! <b>Complexity</b>: Constant
//!
Modified: sandbox/move/boost/intrusive/derivation_value_traits.hpp
==============================================================================
--- sandbox/move/boost/intrusive/derivation_value_traits.hpp (original)
+++ sandbox/move/boost/intrusive/derivation_value_traits.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -46,14 +46,18 @@
static pointer to_value_ptr(node_ptr n)
{
- using ::boost::static_pointer_cast;
- return static_pointer_cast<value_type>(n));
+// This still fails in gcc < 4.4 so forget about it
+// using ::boost::static_pointer_cast;
+// return static_pointer_cast<value_type>(n));
+ return pointer(&static_cast<value_type&>(*n));
}
static const_pointer to_value_ptr(const_node_ptr n)
{
- using ::boost::static_pointer_cast;
- return static_pointer_cast<const value_type>(n));
+// This still fails in gcc < 4.4 so forget about it
+// using ::boost::static_pointer_cast;
+// return static_pointer_cast<const value_type>(n));
+ return const_pointer(&static_cast<const value_type&>(*n));
}
};
Modified: sandbox/move/boost/intrusive/detail/hashtable_node.hpp
==============================================================================
--- sandbox/move/boost/intrusive/detail/hashtable_node.hpp (original)
+++ sandbox/move/boost/intrusive/detail/hashtable_node.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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_; }
@@ -119,8 +141,10 @@
static typename Container::node_ptr downcast_bucket(typename bucket_type::node_ptr p)
{
- using ::boost::static_pointer_cast;
- return static_pointer_cast<typename Container::node>(p);
+// This still fails in gcc < 4.4 so forget about it
+// using ::boost::static_pointer_cast;
+// return static_pointer_cast<typename Container::node>(p);
+ return typename Container::node_ptr(&static_cast<typename Container::node&>(*p));
}
public:
Modified: sandbox/move/boost/intrusive/detail/mpl.hpp
==============================================================================
--- sandbox/move/boost/intrusive/detail/mpl.hpp (original)
+++ sandbox/move/boost/intrusive/detail/mpl.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -138,6 +138,10 @@
struct is_unary_or_binary_function_impl
{ static const bool value = false; };
+// see boost ticket #4094
+// avoid duplicate definitions of is_unary_or_binary_function_impl
+#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
+
template <typename R>
struct is_unary_or_binary_function_impl<R (*)()>
{ static const bool value = true; };
@@ -145,19 +149,11 @@
template <typename R>
struct is_unary_or_binary_function_impl<R (*)(...)>
{ static const bool value = true; };
-/*
-#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
-
-template <typename R>
-struct is_unary_or_binary_function_impl<R (__stdcall*)()>
-{ static const bool value = true; };
-template <typename R>
-struct is_unary_or_binary_function_impl<R (__stdcall*)(...)>
-{ static const bool value = true; };
+#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R>
-struct is_unary_or_binary_function_impl<R (__stdcall*)(...)>
+struct is_unary_or_binary_function_impl<R (__stdcall*)()>
{ static const bool value = true; };
template <typename R>
@@ -165,18 +161,19 @@
{ static const bool value = true; };
template <typename R>
-struct is_unary_or_binary_function_impl<R (__fastcall*)(...)>
-{ static const bool value = true; };
-
-template <typename R>
struct is_unary_or_binary_function_impl<R (__cdecl*)()>
{ static const bool value = true; };
template <typename R>
struct is_unary_or_binary_function_impl<R (__cdecl*)(...)>
{ static const bool value = true; };
+
#endif
-*/
+
+// see boost ticket #4094
+// avoid duplicate definitions of is_unary_or_binary_function_impl
+#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
+
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (*)(T0)>
{ static const bool value = true; };
@@ -185,34 +182,30 @@
struct is_unary_or_binary_function_impl<R (*)(T0...)>
{ static const bool value = true; };
-#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
+#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__stdcall*)(T0)>
{ static const bool value = true; };
-/*
-template <typename R, class T0>
-struct is_unary_or_binary_function_impl<R (__stdcall*)(T0...)>
-{ static const bool value = true; };
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__fastcall*)(T0)>
{ static const bool value = true; };
template <typename R, class T0>
-struct is_unary_or_binary_function_impl<R (__fastcall*)(T0...)>
-{ static const bool value = true; };
-
-template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0)>
{ static const bool value = true; };
template <typename R, class T0>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0...)>
{ static const bool value = true; };
-*/
+
#endif
+// see boost ticket #4094
+// avoid duplicate definitions of is_unary_or_binary_function_impl
+#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
+
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (*)(T0, T1)>
{ static const bool value = true; };
@@ -220,15 +213,11 @@
template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (*)(T0, T1...)>
{ static const bool value = true; };
-/*
-#ifdef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
-template <typename R, class T0, class T1>
-struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1)>
-{ static const bool value = true; };
+#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS
template <typename R, class T0, class T1>
-struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1...)>
+struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1)>
{ static const bool value = true; };
template <typename R, class T0, class T1>
@@ -236,10 +225,6 @@
{ static const bool value = true; };
template <typename R, class T0, class T1>
-struct is_unary_or_binary_function_impl<R (__fastcall*)(T0, T1...)>
-{ static const bool value = true; };
-
-template <typename R, class T0, class T1>
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1)>
{ static const bool value = true; };
@@ -247,7 +232,7 @@
struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1...)>
{ static const bool value = true; };
#endif
-*/
+
template <typename T>
struct is_unary_or_binary_function_impl<T&>
{ static const bool value = false; };
Modified: sandbox/move/boost/intrusive/detail/parent_from_member.hpp
==============================================================================
--- sandbox/move/boost/intrusive/detail/parent_from_member.hpp (original)
+++ sandbox/move/boost/intrusive/detail/parent_from_member.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -9,8 +9,8 @@
// See http://www.boost.org/libs/intrusive for documentation.
//
/////////////////////////////////////////////////////////////////////////////
-#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
-#define BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
+#ifndef BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP
+#define BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <cstddef>
@@ -47,15 +47,13 @@
template<class Parent, class Member>
inline Parent *parent_from_member(Member *member, const Member Parent::* ptr_to_member)
{
- return (Parent*)((char*)member -
- offset_from_pointer_to_member(ptr_to_member));
+ return (Parent*)((char*)member - offset_from_pointer_to_member(ptr_to_member));
}
template<class Parent, class Member>
inline const Parent *parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
{
- return (const Parent*)((const char*)member -
- offset_from_pointer_to_member(ptr_to_member));
+ return (const Parent*)((const char*)member - offset_from_pointer_to_member(ptr_to_member));
}
} //namespace detail {
@@ -68,4 +66,4 @@
#include <boost/intrusive/detail/config_end.hpp>
-#endif //#ifndef BOOST_INTRUSIVE_PARENT_FROM_MEMBER_HPP
+#endif //#ifndef BOOST_INTRUSIVE_DETAIL_PARENT_FROM_MEMBER_HPP
Modified: sandbox/move/boost/intrusive/detail/transform_iterator.hpp
==============================================================================
--- sandbox/move/boost/intrusive/detail/transform_iterator.hpp (original)
+++ sandbox/move/boost/intrusive/detail/transform_iterator.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -46,7 +46,7 @@
// This function is needed for MWCW and BCC, which won't call operator->
// again automatically per 13.3.1.2 para 8
// operator T*() const { return &m_value; }
- mutable T &m_value;
+ T &m_value;
};
template <class Iterator, class UnaryFunction>
Modified: sandbox/move/boost/intrusive/detail/tree_node.hpp
==============================================================================
--- sandbox/move/boost/intrusive/detail/tree_node.hpp (original)
+++ sandbox/move/boost/intrusive/detail/tree_node.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -96,7 +96,7 @@
tree_iterator()
- : members_ (0, 0)
+ : members_ (node_ptr(0), (const void *)0)
{}
explicit tree_iterator(node_ptr nodeptr, const Container *cont_ptr)
Modified: sandbox/move/boost/intrusive/detail/utilities.hpp
==============================================================================
--- sandbox/move/boost/intrusive/detail/utilities.hpp (original)
+++ sandbox/move/boost/intrusive/detail/utilities.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -207,32 +207,33 @@
: private detail::ebo_functor_holder<KeyValueCompare>
{
typedef typename Container::real_value_traits real_value_traits;
+ typedef typename Container::value_type value_type;
typedef typename real_value_traits::node_ptr node_ptr;
typedef typename real_value_traits::const_node_ptr const_node_ptr;
typedef detail::ebo_functor_holder<KeyValueCompare> base_t;
key_nodeptr_comp(KeyValueCompare kcomp, const Container *cont)
: base_t(kcomp), cont_(cont)
{}
+
+ template<class T>
+ struct is_node_ptr
+ {
+ static const bool value = is_same<T, const_node_ptr>::value || is_same<T, node_ptr>::value;
+ };
- template<class KeyType>
- bool operator()( const_node_ptr node, const KeyType &key
- , typename enable_if_c
- <!is_convertible<KeyType, const_node_ptr>::value>::type * = 0) const
- { return base_t::get()(*cont_->get_real_value_traits().to_value_ptr(node), key); }
-
- template<class KeyType>
- bool operator()(const KeyType &key, const_node_ptr node
- , typename enable_if_c
- <!is_convertible<KeyType, const_node_ptr>::value>::type * = 0) const
- { return base_t::get()(key, *cont_->get_real_value_traits().to_value_ptr(node)); }
-
- bool operator()(const_node_ptr node1, const_node_ptr node2) const
- {
- return base_t::get()
- ( *cont_->get_real_value_traits().to_value_ptr(node1)
- , *cont_->get_real_value_traits().to_value_ptr(node2)
- );
- }
+ template<class T>
+ typename enable_if_c<is_node_ptr<T>::value, const value_type &>::type
+ key_forward(const T &node) const
+ { return *cont_->get_real_value_traits().to_value_ptr(node); }
+
+ template<class T>
+ typename enable_if_c<!is_node_ptr<T>::value, const T &>::type
+ key_forward(const T &key) const
+ { return key;}
+
+ template<class KeyType, class KeyType2>
+ bool operator()(const KeyType &key1, const KeyType2 &key2) const
+ { return base_t::get()(this->key_forward(key1), this->key_forward(key2)); }
const Container *cont_;
};
@@ -410,14 +411,10 @@
static const link_mode_type link_mode = Hook::boost_intrusive_tags::link_mode;
static node_ptr to_node_ptr(reference value)
- {
- return reinterpret_cast<node*>(&(value.*P));
- }
+ { return static_cast<node*>(&(value.*P)); }
static const_node_ptr to_node_ptr(const_reference value)
- {
- return static_cast<const node*>(&(value.*P));
- }
+ { return static_cast<const node*>(&(value.*P)); }
static pointer to_value_ptr(node_ptr n)
{
@@ -432,6 +429,45 @@
}
};
+template<class Functor>
+struct function_hook_traits
+{
+ public:
+ typedef typename Functor::hook_type hook_type;
+ typedef typename Functor::hook_ptr hook_ptr;
+ typedef typename Functor::const_hook_ptr const_hook_ptr;
+ typedef typename hook_type::boost_intrusive_tags::node_traits node_traits;
+ typedef typename node_traits::node node;
+ typedef typename Functor::value_type value_type;
+ 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, value_type>::type pointer;
+ typedef typename boost::pointer_to_other<node_ptr, const value_type>::type const_pointer;
+ typedef typename std::iterator_traits<pointer>::reference reference;
+ typedef typename std::iterator_traits<const_pointer>::reference const_reference;
+ static const link_mode_type link_mode = hook_type::boost_intrusive_tags::link_mode;
+
+ static node_ptr to_node_ptr(reference value)
+ { return static_cast<node*>(&*Functor::to_hook_ptr(value)); }
+
+ static const_node_ptr to_node_ptr(const_reference value)
+ { return static_cast<const node*>(&*Functor::to_hook_ptr(value)); }
+
+ static pointer to_value_ptr(node_ptr n)
+ { return Functor::to_value_ptr(to_hook_ptr(n)); }
+
+ static const_pointer to_value_ptr(const_node_ptr n)
+ { return Functor::to_value_ptr(to_hook_ptr(n)); }
+
+ private:
+ static hook_ptr to_hook_ptr(node_ptr n)
+ { return hook_ptr(&*static_cast<hook_type*>(&*n)); }
+
+ static const_hook_ptr to_hook_ptr(const_node_ptr n)
+ { return const_hook_ptr(&*static_cast<const hook_type*>(&*n)); }
+};
+
+
//This function uses binary search to discover the
//highest set bit of the integer
inline std::size_t floor_log2 (std::size_t x)
@@ -454,14 +490,19 @@
inline float fast_log2 (float val)
{
- boost::uint32_t * exp_ptr =
- static_cast<boost::uint32_t *>(static_cast<void*>(&val));
- boost::uint32_t x = *exp_ptr;
+ union caster_t
+ {
+ boost::uint32_t x;
+ float val;
+ } caster;
+
+ caster.val = val;
+ boost::uint32_t x = caster.x;
const int log_2 = (int)(((x >> 23) & 255) - 128);
x &= ~(255 << 23);
x += 127 << 23;
- *exp_ptr = x;
-
+ caster.x = x;
+ val = caster.val;
val = ((-1.0f/3) * val + 2) * val - 2.0f/3;
return (val + log_2);
Modified: sandbox/move/boost/intrusive/hashtable.hpp
==============================================================================
--- sandbox/move/boost/intrusive/hashtable.hpp (original)
+++ sandbox/move/boost/intrusive/hashtable.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -37,6 +37,8 @@
#include <boost/intrusive/unordered_set_hook.hpp>
#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 {
@@ -123,7 +125,7 @@
< typename NodeTraits::node
, boost::intrusive::value_traits<trivial_traits>
, boost::intrusive::constant_time_size<false>
- , boost::intrusive::size_type<std::size_t>
+ , boost::intrusive::size_type<typename boost::make_unsigned<typename std::iterator_traits<typename NodeTraits::node_ptr>::difference_type>::type>
>::type
{};
};
@@ -158,26 +160,22 @@
template<class SupposedValueTraits>
struct unordered_bucket_impl
{
- /// @cond
typedef typename
get_slist_impl_from_supposed_value_traits
<SupposedValueTraits>::type slist_impl;
typedef detail::bucket_impl<slist_impl> implementation_defined;
- /// @endcond
typedef implementation_defined type;
};
template<class SupposedValueTraits>
struct unordered_bucket_ptr_impl
{
- /// @cond
typedef typename detail::get_node_traits
<SupposedValueTraits>::type::node_ptr node_ptr;
typedef typename unordered_bucket_impl
<SupposedValueTraits>::type bucket_type;
typedef typename boost::pointer_to_other
<node_ptr, bucket_type>::type implementation_defined;
- /// @endcond
typedef implementation_defined type;
};
@@ -215,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>
{
@@ -224,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
@@ -240,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;
};
@@ -270,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_;
@@ -286,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
@@ -331,8 +346,10 @@
static node_ptr dcast_bucket_ptr(slist_node_ptr p)
{
- using ::boost::static_pointer_cast;
- return static_pointer_cast<node>(p);
+// This still fails in gcc < 4.4 so forget about it
+// using ::boost::static_pointer_cast;
+// return static_pointer_cast<node>(p);
+ return node_ptr(&static_cast<node&>(*p));
}
static slist_node_ptr priv_get_bucket_before_begin
@@ -500,7 +517,6 @@
template<class ValueTraitsOrHookOption>
struct unordered_default_bucket_traits
{
- /// @cond
typedef typename ValueTraitsOrHookOption::
template pack<none>::value_traits supposed_value_traits;
typedef typename detail::
@@ -508,7 +524,6 @@
<supposed_value_traits>::type slist_impl;
typedef detail::bucket_traits_impl
<slist_impl> implementation_defined;
- /// @endcond
typedef implementation_defined type;
};
@@ -710,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 ||
@@ -794,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).
//!
@@ -938,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);
@@ -1681,7 +1723,8 @@
//! <b>Throws</b>: If the internal hash function throws.
const_iterator iterator_to(const_reference value) const
{
- return const_iterator(bucket_type::s_iterator_to(priv_value_to_node(const_cast<reference>(value))), this);
+ siterator sit = bucket_type::s_iterator_to(const_cast<node &>(this->priv_value_to_node(value)));
+ return const_iterator(sit, this);
}
//! <b>Requires</b>: value must be an lvalue and shall be in a unordered_set of
@@ -2151,7 +2194,7 @@
{
const std::size_t *primes = &detail::prime_list_holder<0>::prime_list[0];
const std::size_t *primes_end = primes + detail::prime_list_holder<0>::prime_list_size;
- size_type const* bound = std::lower_bound(primes, primes_end, n);
+ std::size_t const* bound = std::lower_bound(primes, primes_end, n);
if(bound == primes_end)
--bound;
return size_type(*bound);
@@ -2203,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)); }
@@ -2227,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()); }
@@ -2327,8 +2382,10 @@
static node_ptr dcast_bucket_ptr(typename slist_impl::node_ptr p)
{
- using ::boost::static_pointer_cast;
- return static_pointer_cast<node>(p);
+// This still fails in gcc < 4.4 so forget about it
+// using ::boost::static_pointer_cast;
+// return static_pointer_cast<node>(p);
+ return node_ptr(&static_cast<node&>(*p));
}
std::size_t priv_stored_or_compute_hash(const value_type &v, detail::true_) const
@@ -2896,7 +2953,6 @@
//Real value traits must be calculated from options
typedef typename detail::get_value_traits
<T, typename packed_options::value_traits>::type value_traits;
- /// @cond
static const bool external_value_traits =
detail::external_value_traits_is_true<value_traits>::value;
typedef typename detail::eval_if_c
@@ -2905,7 +2961,6 @@
, detail::identity<value_traits>
>::type real_value_traits;
typedef typename packed_options::bucket_traits specified_bucket_traits;
- /// @endcond
//Real bucket traits must be calculated from options and calculated value_traits
typedef typename detail::get_slist_impl
@@ -2991,6 +3046,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(hashtable)
public:
typedef typename Base::value_traits value_traits;
@@ -3012,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: sandbox/move/boost/intrusive/intrusive_fwd.hpp
==============================================================================
--- sandbox/move/boost/intrusive/intrusive_fwd.hpp (original)
+++ sandbox/move/boost/intrusive/intrusive_fwd.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -50,7 +50,7 @@
////////////////////////////
//slist
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -64,7 +64,7 @@
#endif
class slist;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -75,7 +75,7 @@
#endif
class slist_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -87,7 +87,7 @@
class slist_member_hook;
//list
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -99,7 +99,7 @@
#endif
class list;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -110,7 +110,7 @@
#endif
class list_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -121,8 +121,19 @@
#endif
class list_member_hook;
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
+template
+ < class O1 = none
+ , class O2 = none
+ , class O3 = none
+ >
+#else
+template<class ...Options>
+#endif
+class list_hook;
+
//rbtree/set/multiset
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -135,7 +146,7 @@
#endif
class rbtree;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -148,7 +159,7 @@
#endif
class set;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -161,7 +172,7 @@
#endif
class multiset;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -173,7 +184,7 @@
#endif
class set_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -186,7 +197,7 @@
class set_member_hook;
//splaytree/splay_set/splay_multiset
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -199,7 +210,7 @@
#endif
class splaytree;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -212,7 +223,7 @@
#endif
class splay_set;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -225,7 +236,7 @@
#endif
class splay_multiset;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -236,7 +247,7 @@
#endif
class splay_set_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -248,7 +259,7 @@
class splay_set_member_hook;
//avltree/avl_set/avl_multiset
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -261,7 +272,7 @@
#endif
class avltree;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -274,7 +285,7 @@
#endif
class avl_set;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -287,7 +298,7 @@
#endif
class avl_multiset;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -299,7 +310,7 @@
#endif
class avl_set_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -313,7 +324,7 @@
//treap/treap_set/treap_multiset
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -326,7 +337,7 @@
#endif
class treap;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -339,7 +350,7 @@
#endif
class treap_set;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -357,7 +368,7 @@
struct priority_compare;
//sgtree/sg_set/sg_multiset
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -370,7 +381,7 @@
#endif
class sgtree;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -383,7 +394,7 @@
#endif
class sg_set;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -396,7 +407,7 @@
#endif
class sg_multiset;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -407,7 +418,7 @@
#endif
class bs_set_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -420,7 +431,7 @@
//hashtable/unordered_set/unordered_multiset
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -439,7 +450,7 @@
#endif
class hashtable;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -458,7 +469,7 @@
#endif
class unordered_set;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class T
, class O1 = none
@@ -477,7 +488,7 @@
#endif
class unordered_multiset;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -489,7 +500,7 @@
#endif
class unordered_set_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -501,7 +512,7 @@
#endif
class unordered_set_member_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
@@ -512,7 +523,7 @@
#endif
class any_base_hook;
-#ifndef BOOST_INTRUSIVE_VARIADIC_TEMPLATES
+#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) && !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template
< class O1 = none
, class O2 = none
Modified: sandbox/move/boost/intrusive/list.hpp
==============================================================================
--- sandbox/move/boost/intrusive/list.hpp (original)
+++ sandbox/move/boost/intrusive/list.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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: sandbox/move/boost/intrusive/options.hpp
==============================================================================
--- sandbox/move/boost/intrusive/options.hpp (original)
+++ sandbox/move/boost/intrusive/options.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -343,6 +343,24 @@
};
+//!This option setter specifies the function object that will
+//!be used to convert between values to be inserted in a container
+//!and the hook to be used for that purpose.
+template< typename Functor>
+struct function_hook
+{
+/// @cond
+ typedef detail::function_hook_traits
+ <Functor> function_value_traits;
+ template<class Base>
+ struct pack : Base
+ {
+ typedef function_value_traits value_traits;
+ };
+/// @endcond
+};
+
+
//!This option setter specifies that the container
//!must use the specified base hook
template<typename BaseHook>
@@ -757,7 +775,7 @@
struct do_pack<typelist<Prev, Others...> >
{
typedef typename Prev::template pack
- <typename do_pack<typelist<Others...>>::type> type;
+ <typename do_pack<typelist<Others...> >::type> type;
};
Added: sandbox/move/boost/intrusive/parent_from_member.hpp
==============================================================================
--- (empty file)
+++ sandbox/move/boost/intrusive/parent_from_member.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -0,0 +1,42 @@
+/////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2010-2010
+//
+// 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_GET_PARENT_FROM_MEMBER_HPP
+#define BOOST_INTRUSIVE_GET_PARENT_FROM_MEMBER_HPP
+
+#include <boost/intrusive/detail/config_begin.hpp>
+#include <boost/intrusive/detail/parent_from_member.hpp>
+
+namespace boost {
+namespace intrusive {
+
+//! Given a pointer to a member and its corresponding pointer to data member,
+//! this function returns the pointer of the parent containing that member.
+//! Note: this function does not work with pointer to members that rely on
+//! virtual inheritance.
+template<class Parent, class Member>
+inline Parent *get_parent_from_member(Member *member, const Member Parent::* ptr_to_member)
+{ return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); }
+
+//! Given a const pointer to a member and its corresponding const pointer to data member,
+//! this function returns the const pointer of the parent containing that member.
+//! Note: this function does not work with pointer to members that rely on
+//! virtual inheritance.
+template<class Parent, class Member>
+inline const Parent *get_parent_from_member(const Member *member, const Member Parent::* ptr_to_member)
+{ return ::boost::intrusive::detail::parent_from_member(member, ptr_to_member); }
+
+} //namespace intrusive {
+} //namespace boost {
+
+#include <boost/intrusive/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_INTRUSIVE_GET_PARENT_FROM_MEMBER_HPP
Modified: sandbox/move/boost/intrusive/rbtree.hpp
==============================================================================
--- sandbox/move/boost/intrusive/rbtree.hpp (original)
+++ sandbox/move/boost/intrusive/rbtree.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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.
@@ -478,9 +498,10 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal_upper_bound
+ iterator ret(node_algorithms::insert_equal_upper_bound
(node_ptr(&priv_header()), to_insert, key_node_comp), this);
+ this->priv_size_traits().increment();
+ return ret;
}
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
@@ -504,9 +525,10 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal
+ iterator ret(node_algorithms::insert_equal
(node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp), this);
+ this->priv_size_traits().increment();
+ return ret;
}
//! <b>Requires</b>: Dereferencing iterator must yield an lvalue
@@ -711,9 +733,9 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
node_algorithms::insert_unique_commit
(node_ptr(&priv_header()), to_insert, commit_data);
+ this->priv_size_traits().increment();
return iterator(to_insert, this);
}
@@ -1284,6 +1306,8 @@
node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
, node_ptr(&priv_header())
, get_real_value_traits().to_node_ptr(with_this));
+ if(safemode_or_autounlink)
+ node_algorithms::init(replace_this.pointed_node());
}
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
@@ -1609,6 +1633,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(rbtree)
public:
typedef typename Base::value_compare value_compare;
@@ -1632,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: sandbox/move/boost/intrusive/rbtree_algorithms.hpp
==============================================================================
--- sandbox/move/boost/intrusive/rbtree_algorithms.hpp (original)
+++ sandbox/move/boost/intrusive/rbtree_algorithms.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -57,7 +57,6 @@
#include <boost/intrusive/detail/utilities.hpp>
#include <boost/intrusive/detail/tree_algorithms.hpp>
-
namespace boost {
namespace intrusive {
Modified: sandbox/move/boost/intrusive/set.hpp
==============================================================================
--- sandbox/move/boost/intrusive/set.hpp (original)
+++ sandbox/move/boost/intrusive/set.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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: sandbox/move/boost/intrusive/sg_set.hpp
==============================================================================
--- sandbox/move/boost/intrusive/sg_set.hpp (original)
+++ sandbox/move/boost/intrusive/sg_set.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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: sandbox/move/boost/intrusive/sgtree.hpp
==============================================================================
--- sandbox/move/boost/intrusive/sgtree.hpp (original)
+++ sandbox/move/boost/intrusive/sgtree.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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.
@@ -621,11 +642,11 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
node_ptr p = node_algorithms::insert_equal_upper_bound
(node_ptr(&priv_header()), to_insert, key_node_comp
, (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
+ this->priv_size_traits().increment();
data_.max_tree_size_ = (size_type)max_tree_size;
return iterator(p, this);
}
@@ -651,11 +672,11 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
node_ptr p = node_algorithms::insert_equal
(node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp
, (std::size_t)this->size(), this->get_h_alpha_func(), max_tree_size);
+ this->priv_size_traits().increment();
data_.max_tree_size_ = (size_type)max_tree_size;
return iterator(p, this);
}
@@ -862,11 +883,11 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
node_algorithms::insert_unique_commit
( node_ptr(&priv_header()), to_insert, commit_data
, (std::size_t)this->size(), this->get_h_alpha_func(), max_tree_size);
+ this->priv_size_traits().increment();
data_.max_tree_size_ = (size_type)max_tree_size;
return iterator(to_insert, this);
}
@@ -890,11 +911,11 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
node_ptr p = node_algorithms::insert_before
( node_ptr(&priv_header()), pos.pointed_node(), to_insert
, (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
+ this->priv_size_traits().increment();
data_.max_tree_size_ = (size_type)max_tree_size;
return iterator(p, this);
}
@@ -918,11 +939,11 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
node_algorithms::push_back
( node_ptr(&priv_header()), to_insert
, (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
+ this->priv_size_traits().increment();
data_.max_tree_size_ = (size_type)max_tree_size;
}
@@ -945,11 +966,11 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
std::size_t max_tree_size = (std::size_t)data_.max_tree_size_;
node_algorithms::push_front
( node_ptr(&priv_header()), to_insert
, (size_type)this->size(), this->get_h_alpha_func(), max_tree_size);
+ this->priv_size_traits().increment();
data_.max_tree_size_ = (size_type)max_tree_size;
}
@@ -1453,6 +1474,8 @@
node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
, node_ptr(&priv_header())
, get_real_value_traits().to_node_ptr(with_this));
+ if(safemode_or_autounlink)
+ node_algorithms::init(replace_this.pointed_node());
}
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
@@ -1836,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;
@@ -1858,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: sandbox/move/boost/intrusive/slist.hpp
==============================================================================
--- sandbox/move/boost/intrusive/slist.hpp (original)
+++ sandbox/move/boost/intrusive/slist.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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: sandbox/move/boost/intrusive/splay_set.hpp
==============================================================================
--- sandbox/move/boost/intrusive/splay_set.hpp (original)
+++ sandbox/move/boost/intrusive/splay_set.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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: sandbox/move/boost/intrusive/splaytree.hpp
==============================================================================
--- sandbox/move/boost/intrusive/splaytree.hpp (original)
+++ sandbox/move/boost/intrusive/splaytree.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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.
@@ -466,9 +487,10 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal_lower_bound
+ iterator ret (node_algorithms::insert_equal_lower_bound
(node_ptr(&priv_header()), to_insert, key_node_comp), this);
+ this->priv_size_traits().increment();
+ return ret;
}
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
@@ -492,9 +514,10 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal
+ iterator ret(node_algorithms::insert_equal
(node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp), this);
+ this->priv_size_traits().increment();
+ return ret;
}
//! <b>Requires</b>: Dereferencing iterator must yield an lvalue
@@ -693,9 +716,9 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
node_algorithms::insert_unique_commit
(node_ptr(&priv_header()), to_insert, commit_data);
+ this->priv_size_traits().increment();
return iterator(to_insert, this);
}
@@ -1259,6 +1282,8 @@
node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
, node_ptr(&priv_header())
, get_real_value_traits().to_node_ptr(with_this));
+ if(safemode_or_autounlink)
+ node_algorithms::init(replace_this.pointed_node());
}
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
@@ -1610,6 +1635,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(splaytree)
public:
typedef typename Base::value_compare value_compare;
@@ -1633,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: sandbox/move/boost/intrusive/treap.hpp
==============================================================================
--- sandbox/move/boost/intrusive/treap.hpp (original)
+++ sandbox/move/boost/intrusive/treap.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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.
@@ -549,9 +572,10 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal_upper_bound
+ iterator ret(node_algorithms::insert_equal_upper_bound
(node_ptr(&priv_header()), to_insert, key_node_comp, key_node_pcomp), this);
+ this->priv_size_traits().increment();
+ return ret;
}
//! <b>Requires</b>: value must be an lvalue, and "hint" must be
@@ -577,9 +601,10 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
- return iterator(node_algorithms::insert_equal
+ iterator ret (node_algorithms::insert_equal
(node_ptr(&priv_header()), hint.pointed_node(), to_insert, key_node_comp, key_node_pcomp), this);
+ this->priv_size_traits().increment();
+ return ret;
}
//! <b>Requires</b>: Dereferencing iterator must yield an lvalue
@@ -801,8 +826,8 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
node_algorithms::insert_unique_commit(node_ptr(&priv_header()), to_insert, commit_data);
+ this->priv_size_traits().increment();
return iterator(to_insert, this);
}
@@ -825,11 +850,12 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
detail::key_nodeptr_comp<priority_compare, treap_impl>
pcomp(priv_pcomp(), this);
- return iterator(node_algorithms::insert_before
+ iterator ret (node_algorithms::insert_before
(node_ptr(&priv_header()), pos.pointed_node(), to_insert, pcomp), this);
+ this->priv_size_traits().increment();
+ return ret;
}
//! <b>Requires</b>: value must be an lvalue, and it must be no less
@@ -851,10 +877,10 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
detail::key_nodeptr_comp<priority_compare, treap_impl>
pcomp(priv_pcomp(), this);
node_algorithms::push_back(node_ptr(&priv_header()), to_insert, pcomp);
+ this->priv_size_traits().increment();
}
//! <b>Requires</b>: value must be an lvalue, and it must be no greater
@@ -876,10 +902,10 @@
node_ptr to_insert(get_real_value_traits().to_node_ptr(value));
if(safemode_or_autounlink)
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
- this->priv_size_traits().increment();
detail::key_nodeptr_comp<priority_compare, treap_impl>
pcomp(priv_pcomp(), this);
node_algorithms::push_front(node_ptr(&priv_header()), to_insert, pcomp);
+ this->priv_size_traits().increment();
}
//! <b>Effects</b>: Erases the element pointed to by pos.
@@ -1384,6 +1410,8 @@
node_algorithms::replace_node( get_real_value_traits().to_node_ptr(*replace_this)
, node_ptr(&priv_header())
, get_real_value_traits().to_node_ptr(with_this));
+ if(safemode_or_autounlink)
+ node_algorithms::init(replace_this.pointed_node());
}
//! <b>Requires</b>: value must be an lvalue and shall be in a set of
@@ -1696,6 +1724,7 @@
Options...
#endif
>::type Base;
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(treap)
public:
typedef typename Base::value_compare value_compare;
@@ -1722,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: sandbox/move/boost/intrusive/treap_set.hpp
==============================================================================
--- sandbox/move/boost/intrusive/treap_set.hpp (original)
+++ sandbox/move/boost/intrusive/treap_set.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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: sandbox/move/boost/intrusive/unordered_set.hpp
==============================================================================
--- sandbox/move/boost/intrusive/unordered_set.hpp (original)
+++ sandbox/move/boost/intrusive/unordered_set.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 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 {
@@ -39,7 +41,7 @@
//! The container supports the following options:
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<>, \c hash<> and \c equal<>
-//! \c bucket_traits<>, power_2_buckets<> and cache_begin<>.
+//! \c bucket_traits<>, \c power_2_buckets<> and \c cache_begin<>.
//!
//! unordered_set only provides forward iterators but it provides 4 iterator types:
//! iterator and const_iterator to navigate through the whole container and
@@ -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
@@ -1096,7 +1113,7 @@
//! The container supports the following options:
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<>, \c hash<> and \c equal<>
-//! \c bucket_traits<>, power_2_buckets<> and cache_begin<>.
+//! \c bucket_traits<>, \c power_2_buckets<> and \c cache_begin<>.
//!
//! unordered_multiset only provides forward iterators but it provides 4 iterator types:
//! iterator and const_iterator to navigate through the whole container and
@@ -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
Modified: sandbox/move/boost/intrusive/unordered_set_hook.hpp
==============================================================================
--- sandbox/move/boost/intrusive/unordered_set_hook.hpp (original)
+++ sandbox/move/boost/intrusive/unordered_set_hook.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -78,8 +78,10 @@
static node_ptr get_next(const_node_ptr n)
{
- using ::boost::static_pointer_cast;
- return static_pointer_cast<node>(n->next_);
+// This still fails in gcc < 4.4 so forget about it
+// using ::boost::static_pointer_cast;
+// return static_pointer_cast<node>(n->next_);
+ return node_ptr(&static_cast<node&>(*n->next_));
}
static void set_next(node_ptr n, node_ptr next)
Modified: sandbox/move/boost/move/move.hpp
==============================================================================
--- sandbox/move/boost/move/move.hpp (original)
+++ sandbox/move/boost/move/move.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -1,6 +1,7 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright David Abrahams, Vicente Botet, Ion Gaztanaga 2009.
+// (C) Copyright David Abrahams, Vicente Botet 2009.
+// (C) Copyright Ion Gaztanaga 2009-2010.
// 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)
@@ -8,77 +9,100 @@
// See http://www.boost.org/libs/move for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-//
-// Parts of this file come from Adobe's Move library:
-//
-// Copyright 2005-2007 Adobe Systems Incorporated
-// Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
-// or a copy at http://stlab.adobe.com/licenses.html)
-//
-//////////////////////////////////////////////////////////////////////////////
//! \file
-#ifndef BOOST_MOVE_DETAIL_MOVE_HPP
-#define BOOST_MOVE_DETAIL_MOVE_HPP
+#ifndef BOOST_MOVE_MOVE_HPP
+#define BOOST_MOVE_MOVE_HPP
#include <boost/config.hpp>
#include <algorithm> //copy, copy_backward
#include <memory> //uninitialized_copy
#include <iterator> //std::iterator
-#include <boost/mpl/if.hpp>
+
+#define BOOST_MOVE_AVOID_BOOST_DEPENDENCIES
+
+#ifndef BOOST_MOVE_AVOID_BOOST_DEPENDENCIES
#include <boost/utility/enable_if.hpp>
+#include <boost/utility/addressof.hpp>
+#include <boost/mpl/if.hpp>
#include <boost/mpl/bool.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/type_traits/is_class.hpp>
+#include <boost/type_traits/is_base_of.hpp>
+#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/has_trivial_destructor.hpp>
-#include <boost/utility/addressof.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+#endif //#ifdef BOOST_MOVE_AVOID_BOOST_DEPENDENCIES
+/// @cond
+
+#ifdef BOOST_MOVE_AVOID_BOOST_DEPENDENCIES
+#define BOOST_MOVE_MPL_NS ::boost::move_detail
+#define BOOST_MOVE_BOOST_NS ::boost::move_detail
+#else
+#define BOOST_MOVE_MPL_NS ::boost::mpl
+#define BOOST_MOVE_BOOST_NS ::boost
+#endif
-//! Defining or undefining this macro will change Boost.Move behaviour
-//! for copyable and movable classes when assigning from non-const rvalues:
-//! \code
-//! copyable_and_movable produce(){ return copyable_and_movable(); }
-//! \endcode
-//! If the macro is NOT defined:
-//! \code
-//! copyable_and_movable cm;
-//! cm = copyable_and_movable(); //object is COPIED (missed optimization)
-//! \endcode
-//! If the macro IS defined:
-//! \code
-//! copyable_and_movable cm;
-//! cm = copyable_and_movable(); //object is MOVED
-//! \endcode
-//! However, the second option has also some downsides. See documentation for more details.
-#define BOOST_MOVE_OPTIMIZED_EMULATION
+#ifdef BOOST_MOVE_AVOID_BOOST_DEPENDENCIES
-/// @cond
+namespace boost {
+namespace move_detail {
-//Define to easily port between Boost.Move and internal Boost.Interprocess move emulation
-//#define BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE
+//if_
+template<bool C, typename T1, typename T2>
+struct if_c
+{
+ typedef T1 type;
+};
-#ifdef BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE
+template<typename T1, typename T2>
+struct if_c<false,T1,T2>
+{
+ typedef T2 type;
+};
-#define INTERPROCESS_NAMESPACE_BEGIN namespace interprocess {
-#define INTERPROCESS_NAMESPACE_END }// namespace interprocess {
-#define BOOST_MOVE_NAMESPACE boost::interprocess
+template<typename T1, typename T2, typename T3>
+struct if_
+{
+ typedef typename if_c<0 != T1::value, T2, T3>::type type;
+};
-#else //BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE
+//enable_if_
+template <bool B, class T = void>
+struct enable_if_c
+{
+ typedef T type;
+};
-#define INTERPROCESS_NAMESPACE_BEGIN
-#define INTERPROCESS_NAMESPACE_END
-#define BOOST_MOVE_NAMESPACE boost
+template <class T>
+struct enable_if_c<false, T> {};
-#endif //BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE
+template <class Cond, class T = void>
+struct enable_if : public enable_if_c<Cond::value, T> {};
-namespace boost {
-INTERPROCESS_NAMESPACE_BEGIN
-namespace move_detail {
+template <class Cond, class T = void>
+struct disable_if : public enable_if_c<!Cond::value, T> {};
+
+//integral_constant
+template<class T, T v>
+struct integral_constant
+{
+ static const T value = v;
+ typedef T value_type;
+ typedef integral_constant<T, v> type;
+};
+//identity
template <class T>
struct identity
{
typedef T type;
};
+//is_convertible
template <class T, class U>
class is_convertible
{
@@ -91,20 +115,121 @@
enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) };
};
+//and_ not_
+template <typename Condition1, typename Condition2, typename Condition3 = integral_constant<bool, true> >
+ struct and_
+ : public integral_constant<bool, Condition1::value && Condition2::value && Condition3::value>
+{};
+
+template <typename Boolean>
+ struct not_
+ : public integral_constant<bool, !Boolean::value>
+{};
+
+//is_lvalue_reference
+template<class T>
+struct is_lvalue_reference
+ : public integral_constant<bool, false>
+{};
+
+template<class T>
+struct is_lvalue_reference<T&>
+ : public integral_constant<bool, true>
+{};
+
+//has_trivial_destructor
+template<class T>
+struct has_trivial_destructor
+ : public integral_constant<bool, false>
+{};
+
+//addressof
+template<class T> struct addr_impl_ref
+{
+ T & v_;
+ inline addr_impl_ref( T & v ): v_( v ) {}
+ inline operator T& () const { return v_; }
+
+ private:
+ addr_impl_ref & operator=(const addr_impl_ref &);
+};
+
+template<class T> struct addressof_impl
+{
+ static inline T * f( T & v, long )
+ {
+ return reinterpret_cast<T*>(
+ &const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
+ }
+
+ static inline T * f( T * v, int )
+ { return v; }
+};
+
+template<class T> T * addressof( T & v )
+{
+ return ::boost::move_detail::addressof_impl<T>::f
+ ( ::boost::move_detail::addr_impl_ref<T>( v ), 0 );
+}
+
+/*
+typedef char one;
+struct two {one _[2];};
+
+template <typename B, typename D>
+struct is_base_of_host
+{
+ operator B*() const;
+ operator D*();
+};
+
+template <typename B, typename D>
+struct is_base_of
+{
+ typedef char yes;
+ class no { char dummy[2]; };
+
+ template <typename T>
+ static yes check(D*, T);
+ static no check(B*, int);
+
+ static const bool value = sizeof(check(is_base_of_host<B,D>(), int())) == sizeof(yes);
+};
+*/
+
} //namespace move_detail {
-INTERPROCESS_NAMESPACE_END
} //namespace boost {
+#endif //BOOST_MOVE_AVOID_BOOST_DEPENDENCIES
+
/// @endcond
+#if !defined(BOOST_NO_RVALUE_REFERENCES)
+
+#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5)
+
+#define BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
+
+#else
+
+#if defined(_MSC_VER) && (_MSC_VER == 1600)
+#define BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG
+#endif
+
+#endif
+
+#endif
+
+
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
-#include <boost/type_traits/is_fundamental.hpp>
-#include <boost/type_traits/is_pointer.hpp>
-#include <boost/type_traits/is_same.hpp>
+#ifdef __GNUC__
+# define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS __attribute__((__may_alias__))
+#else
+# define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS
+#endif
namespace boost {
-INTERPROCESS_NAMESPACE_BEGIN
//////////////////////////////////////////////////////////////////////////////
//
@@ -118,7 +243,7 @@
~rv();
rv(rv const&);
void operator=(rv const&);
-};
+} BOOST_MOVE_ATTRIBUTE_MAY_ALIAS;
//////////////////////////////////////////////////////////////////////////////
//
@@ -130,40 +255,45 @@
template <class T>
struct is_rv
-{
- static const bool value = false;
-};
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, false>
+{};
template <class T>
struct is_rv< rv<T> >
-{
- static const bool value = true;
-};
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+{};
+
+template <class T>
+struct is_rv< const rv<T> >
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, true>
+{};
} //namespace move_detail {
//////////////////////////////////////////////////////////////////////////////
//
-// is_movable
+// has_move_emulation_enabled
//
//////////////////////////////////////////////////////////////////////////////
template<class T>
-struct is_movable
- : public ::boost::mpl::bool_<move_detail::is_convertible<T, rv<T>&>::value>
-{
-};
+struct has_move_emulation_enabled
+ : BOOST_MOVE_BOOST_NS::is_convertible< T, ::boost::rv<T>& >
+{};
template<class T>
-struct is_movable< rv<T> >
- : public ::boost::mpl::bool_<false>
-{
-};
+struct has_move_emulation_enabled<T&>
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, false>
+{};
+
+template<class T>
+struct has_move_emulation_enabled< ::boost::rv<T> >
+ : BOOST_MOVE_BOOST_NS::integral_constant<bool, false>
+{};
template <class T>
struct has_nothrow_move
- : public ::boost::mpl::bool_<false>
-{
-};
+ : public BOOST_MOVE_BOOST_NS::integral_constant<bool, false>
+{};
//////////////////////////////////////////////////////////////////////////////
//
@@ -171,34 +301,33 @@
//
//////////////////////////////////////////////////////////////////////////////
template <class T>
-typename ::boost::disable_if<is_movable<T>, T&>::type move(T& x)
+typename BOOST_MOVE_BOOST_NS::disable_if<has_move_emulation_enabled<T>, T&>::type move(T& x)
{
return x;
}
template <class T>
-typename enable_if<is_movable<T>, rv<T>&>::type move(T& x)
+typename BOOST_MOVE_BOOST_NS::enable_if<has_move_emulation_enabled<T>, rv<T>&>::type move(T& x)
{
- return *static_cast<rv<T>* >(boost::addressof(x));
+ return *static_cast<rv<T>* >(BOOST_MOVE_BOOST_NS::addressof(x));
}
template <class T>
-typename enable_if<is_movable<T>, rv<T>&>::type move(rv<T>& x)
+typename BOOST_MOVE_BOOST_NS::enable_if<has_move_emulation_enabled<T>, rv<T>&>::type move(rv<T>& x)
{
return x;
}
-
#define BOOST_RV_REF(TYPE)\
- ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \
+ ::boost::rv< TYPE >& \
//
#define BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
- ::BOOST_MOVE_NAMESPACE::rv< TYPE<ARG1, ARG2> >& \
+ ::boost::rv< TYPE<ARG1, ARG2> >& \
//
#define BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
- ::BOOST_MOVE_NAMESPACE::rv< TYPE<ARG1, ARG2, ARG3> >& \
+ ::boost::rv< TYPE<ARG1, ARG2, ARG3> >& \
//
@@ -207,21 +336,19 @@
//
#define BOOST_CATCH_CONST_RLVALUE(TYPE)\
- const ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \
+ const ::boost::rv< TYPE >& \
//
-#ifdef BOOST_MOVE_OPTIMIZED_EMULATION
-
#define BOOST_COPY_ASSIGN_REF(TYPE)\
- const ::BOOST_MOVE_NAMESPACE::rv< TYPE >& \
+ const ::boost::rv< TYPE >& \
//
-#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
- const ::BOOST_MOVE_NAMESPACE::rv< TYPE<ARG1, ARG2> >& \
+#define BOOST_MOVE_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
+ const ::boost::rv< TYPE<ARG1, ARG2> >& \
//
-#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
- const ::BOOST_MOVE_NAMESPACE::rv< TYPE<ARG1, ARG2, ARG3> >& \
+#define BOOST_MOVE_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
+ const ::boost::rv< TYPE<ARG1, ARG2, ARG3> >& \
//
//////////////////////////////////////////////////////////////////////////////
@@ -231,109 +358,19 @@
//////////////////////////////////////////////////////////////////////////////
template <class T>
-typename enable_if< ::BOOST_MOVE_NAMESPACE::move_detail::is_rv<T>, T &>::type
- forward(const typename move_detail::identity<T>::type &x)
-{
- return const_cast<T&>(x);
-}
-
-template <class T>
-typename disable_if< ::BOOST_MOVE_NAMESPACE::move_detail::is_rv<T>, const T &>::type
- forward(const typename move_detail::identity<T>::type &x)
-{
- return x;
-}
-
-#else //BOOST_MOVE_OPTIMIZED_EMULATION
-
-#define BOOST_COPY_ASSIGN_REF(TYPE)\
- const TYPE & \
-//
-
-#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
- const TYPE< ARG1, ARG2 >& \
-//
-
-#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
- const TYPE< ARG1, ARG2, ARG3 > & \
-//
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// forward()
-//
-//////////////////////////////////////////////////////////////////////////////
-/*
-template <class T>
-typename enable_if< ::BOOST_MOVE_NAMESPACE::move_detail::is_rv<T>, T &>::type
- forward(const typename move_detail::identity<T>::type &x)
+typename BOOST_MOVE_BOOST_NS::enable_if< ::boost::move_detail::is_rv<T>, T &>::type
+ forward(const typename BOOST_MOVE_MPL_NS::identity<T>::type &x)
{
return const_cast<T&>(x);
}
template <class T>
-typename disable_if< ::BOOST_MOVE_NAMESPACE::move_detail::is_rv<T>, const T &>::type
- forward(const typename move_detail::identity<T>::type &x)
-{
- return x;
-}
-*/
-
-//Catches const lvalues for movable types
-template <class T>
-const T&
- forward( BOOST_CATCH_CONST_RLVALUE(T) x
- , typename ::boost::enable_if_c< ::BOOST_MOVE_NAMESPACE::is_movable<T>::value >::type* = 0)
-{
- return static_cast<const T&>(x);
-}
-
-//Catches const lvalues for non-movable types
-template <class T>
-const T&
- forward( const T &x
- , typename ::boost::enable_if_c< !::BOOST_MOVE_NAMESPACE::is_movable<T>::value &&
- !::boost::move_detail::is_rv<T>::value
- >::type* = 0)
-{
- return static_cast<const T&>(x);
-}
-
-//Catches forwarded ::boost::rv<T> via BOOST_FWD_REFs
-template <class T>
-T &
- forward( const T &t
- , typename ::boost::enable_if_c< ::boost::move_detail::is_rv<T>::value >::type* = 0)
-{
- return const_cast<T&>(t);
-}
-
-//Catches forwarded ::boost::rv<T>
-template <class T, class U>
-const T &
- forward( const U &u
- , typename ::boost::enable_if_c< ::boost::is_same< ::boost::rv<T>, U >::value >::type * = 0)
-{
- return static_cast<const T&>(u);
-}
-
-//Catches non-const lvalues
-template <class T>
-T&
- forward( typename move_detail::identity<T>::type &x
- , typename ::boost::enable_if_c< !::boost::move_detail::is_rv<T>::value >::type* = 0)
+typename BOOST_MOVE_BOOST_NS::disable_if< ::boost::move_detail::is_rv<T>, const T &>::type
+ forward(const typename BOOST_MOVE_MPL_NS::identity<T>::type &x)
{
return x;
}
-//Catches non-const rvalues
-template <class T>
-typename enable_if<is_movable<T>, ::boost::rv<T> & >::type
- forward(BOOST_RV_REF(T) x)
-{ return x; }
-
-#endif
-
//////////////////////////////////////////////////////////////////////////////
//
// BOOST_MOVABLE_BUT_NOT_COPYABLE
@@ -344,10 +381,10 @@
TYPE(TYPE &);\
TYPE& operator=(TYPE &);\
public:\
- operator ::BOOST_MOVE_NAMESPACE::rv<TYPE>&() \
- { return *reinterpret_cast< ::BOOST_MOVE_NAMESPACE::rv<TYPE>* >(this); }\
- operator const ::BOOST_MOVE_NAMESPACE::rv<TYPE>&() const \
- { return *reinterpret_cast<const ::BOOST_MOVE_NAMESPACE::rv<TYPE>* >(this); }\
+ operator ::boost::rv<TYPE>&() \
+ { return *static_cast< ::boost::rv<TYPE>* >(this); }\
+ operator const ::boost::rv<TYPE>&() const \
+ { return *static_cast<const ::boost::rv<TYPE>* >(this); }\
private:\
//
@@ -357,35 +394,27 @@
//
//////////////////////////////////////////////////////////////////////////////
-#ifdef BOOST_MOVE_OPTIMIZED_EMULATION
-
#define BOOST_COPYABLE_AND_MOVABLE(TYPE)\
public:\
TYPE& operator=(TYPE &t)\
- { this->operator=(static_cast<const ::BOOST_MOVE_NAMESPACE::rv<TYPE> &>(const_cast<const TYPE &>(t))); return *this;}\
+ { this->operator=(static_cast<const ::boost::rv<TYPE> &>(const_cast<const TYPE &>(t))); return *this;}\
public:\
- operator ::BOOST_MOVE_NAMESPACE::rv<TYPE>&() \
- { return *reinterpret_cast< ::BOOST_MOVE_NAMESPACE::rv<TYPE>* >(this); }\
- operator const ::BOOST_MOVE_NAMESPACE::rv<TYPE>&() const \
- { return *reinterpret_cast<const ::BOOST_MOVE_NAMESPACE::rv<TYPE>* >(this); }\
+ operator ::boost::rv<TYPE>&() \
+ { return *static_cast< ::boost::rv<TYPE>* >(this); }\
+ operator const ::boost::rv<TYPE>&() const \
+ { return *static_cast<const ::boost::rv<TYPE>* >(this); }\
private:\
//
-#else //#ifdef BOOST_MOVE_OPTIMIZED_EMULATION
-
-#define BOOST_COPYABLE_AND_MOVABLE(TYPE)\
+#define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)\
public:\
- operator ::BOOST_MOVE_NAMESPACE::rv<TYPE>&() \
- { return *reinterpret_cast< ::BOOST_MOVE_NAMESPACE::rv<TYPE>* >(this); }\
- operator const ::BOOST_MOVE_NAMESPACE::rv<TYPE>&() const \
- { return *reinterpret_cast<const ::BOOST_MOVE_NAMESPACE::rv<TYPE>* >(this); }\
+ operator ::boost::rv<TYPE>&() \
+ { return *static_cast< ::boost::rv<TYPE>* >(this); }\
+ operator const ::boost::rv<TYPE>&() const \
+ { return *static_cast<const ::boost::rv<TYPE>* >(this); }\
private:\
//
-#endif
-
-
-INTERPROCESS_NAMESPACE_END
} //namespace boost
#else //BOOST_NO_RVALUE_REFERENCES
@@ -393,58 +422,12 @@
#include <boost/type_traits/remove_reference.hpp>
namespace boost {
-INTERPROCESS_NAMESPACE_BEGIN
-
-/// @cond
-
-namespace move_detail {
-
-template<class T>
-struct is_lvalue_reference
- : public ::boost::mpl::bool_<false>
-{};
-
-template<class T>
-struct is_lvalue_reference<T&>
- : public ::boost::mpl::bool_<true>
-{};
-
-typedef char one;
-struct two {one _[2];};
-
-template <class T>
-struct internal_member_value_traits
-{
- template <class U> static one test(...);
- template <class U> static two test(typename U::boost_move_emulation_t* = 0);
- static const bool value = sizeof(test<T>(0)) == sizeof(two);
-};
-
-} //namespace move_detail {
-
-/// @endcond
-
-//////////////////////////////////////////////////////////////////////////////
-//
-// is_movable
-//
-//////////////////////////////////////////////////////////////////////////////
-
-//! For compilers with rvalue references, this traits class returns true
-//! if BOOST_ENABLE_MOVE_EMULATION is activated.
-//!
-//! For other compilers returns true if T is convertible to <i>::boost::rv<T>&</i>
-template<class T>
-struct is_movable
- : public ::boost::mpl::bool_<move_detail::internal_member_value_traits<T>::value>
-{
-};
//! By default this traits returns false. Classes with non-thworing move construction
//! and assignment should specialize this trait to obtain some performance improvements.
template <class T>
struct has_nothrow_move
- : public ::boost::mpl::bool_<false>
+ : public BOOST_MOVE_MPL_NS::integral_constant<bool, false>
{};
//////////////////////////////////////////////////////////////////////////////
@@ -463,7 +446,7 @@
#else //BOOST_MOVE_DOXYGEN_INVOKED
-#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ <= 5)
+#if defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
//Old move approach, lvalues could bind to rvalue references
template <class T> inline
@@ -504,24 +487,26 @@
#else
-#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ <= 5)
+#if defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
//Old move approach, lvalues could bind to rvalue references
template <class T> inline
-T&& forward (typename move_detail::identity<T>::type&& t)
+T&& forward (typename BOOST_MOVE_MPL_NS::identity<T>::type&& t)
{ return t; }
#else //Old move
+//Implementation #5 from N2951, thanks to Howard Hinnant
+
template <class T, class U>
inline T&& forward(U&& t
- , typename enable_if_c<
- move_detail::is_lvalue_reference<T>::value ? move_detail::is_lvalue_reference<U>::value : true>::type * = 0
- , typename enable_if_c<
+ , typename BOOST_MOVE_BOOST_NS::enable_if_c<
+ move_detail::is_lvalue_reference<T>::value ? move_detail::is_lvalue_reference<U>::value : true>::type * = 0/*
+ , typename BOOST_MOVE_BOOST_NS::enable_if_c<
move_detail::is_convertible
- <typename remove_reference<U>::type*, typename remove_reference<T>::type*>::value>::type * = 0)
-{ return static_cast<T&&>(t); }
+ <typename remove_reference<U>::type*, typename remove_reference<T>::type*>::value>::type * = 0*/)
+{ return static_cast<T&&>(t); }
#endif //Old move
@@ -557,7 +542,6 @@
//! The user will need to write a move constructor/assignment and a copy assignment
//! as explained in the documentation to fully write a copyable and movable class.
#define BOOST_COPYABLE_AND_MOVABLE(TYPE)\
- typedef int boost_move_emulation_t;
//
/// @cond
@@ -611,13 +595,11 @@
/// @endcond
-INTERPROCESS_NAMESPACE_END
} //namespace boost {
#endif //BOOST_NO_RVALUE_REFERENCES
namespace boost {
-INTERPROCESS_NAMESPACE_BEGIN
//////////////////////////////////////////////////////////////////////////////
//
@@ -639,9 +621,9 @@
#if !defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_DOXYGEN_INVOKED)
typedef value_type && reference;
#else
- typedef typename ::boost::mpl::if_
- < ::BOOST_MOVE_NAMESPACE::is_movable<value_type>
- , ::BOOST_MOVE_NAMESPACE::rv<value_type>&
+ typedef typename BOOST_MOVE_MPL_NS::if_
+ < ::boost::has_move_emulation_enabled<value_type>
+ , ::boost::rv<value_type>&
, value_type & >::type reference;
#endif
typedef It pointer;
@@ -665,10 +647,10 @@
reference operator*() const
{
- #if !defined(BOOST_NO_RVALUE_REFERENCES)
+ #if defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
return *m_it;
#else
- return ::BOOST_MOVE_NAMESPACE::move(*m_it);
+ return ::boost::move(*m_it);
#endif
}
@@ -701,10 +683,10 @@
reference operator[](difference_type n) const
{
- #if !defined(BOOST_NO_RVALUE_REFERENCES)
+ #if defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
return m_it[n];
#else
- return ::BOOST_MOVE_NAMESPACE::move(m_it[n]);
+ return ::boost::move(m_it[n]);
#endif
}
@@ -742,13 +724,13 @@
template <class I>
struct is_move_iterator
- : public ::boost::mpl::bool_<false>
+ : public BOOST_MOVE_MPL_NS::integral_constant<bool, false>
{
};
template <class I>
-struct is_move_iterator< ::BOOST_MOVE_NAMESPACE::move_iterator<I> >
- : public ::boost::mpl::bool_<true>
+struct is_move_iterator< ::boost::move_iterator<I> >
+ : public BOOST_MOVE_MPL_NS::integral_constant<bool, true>
{
};
@@ -787,7 +769,7 @@
explicit back_move_insert_iterator(C& x) : container_m(&x) { }
back_move_insert_iterator& operator=(typename C::reference x)
- { container_m->push_back(BOOST_MOVE_NAMESPACE::move(x)); return *this; }
+ { container_m->push_back(boost::move(x)); return *this; }
back_move_insert_iterator& operator*() { return *this; }
back_move_insert_iterator& operator++() { return *this; }
@@ -822,7 +804,7 @@
explicit front_move_insert_iterator(C& x) : container_m(&x) { }
front_move_insert_iterator& operator=(typename C::reference x)
- { container_m->push_front(BOOST_MOVE_NAMESPACE::move(x)); return *this; }
+ { container_m->push_front(boost::move(x)); return *this; }
front_move_insert_iterator& operator*() { return *this; }
front_move_insert_iterator& operator++() { return *this; }
@@ -858,7 +840,7 @@
move_insert_iterator& operator=(typename C::reference x)
{
- pos_ = container_m->insert(pos_, ::BOOST_MOVE_NAMESPACE::move(x));
+ pos_ = container_m->insert(pos_, ::boost::move(x));
++pos_;
return *this;
}
@@ -897,7 +879,7 @@
O move(I f, I l, O result)
{
while (f != l) {
- *result = ::BOOST_MOVE_NAMESPACE::move(*f);
+ *result = ::boost::move(*f);
++f; ++result;
}
return result;
@@ -925,7 +907,7 @@
{
while (f != l) {
--l; --result;
- *result = ::BOOST_MOVE_NAMESPACE::move(*l);
+ *result = ::boost::move(*l);
}
return result;
}
@@ -949,29 +931,29 @@
typename F> // F models ForwardIterator
F uninitialized_move(I f, I l, F r
/// @cond
- ,typename enable_if<is_movable<typename std::iterator_traits<I>::value_type> >::type* = 0
+// ,typename BOOST_MOVE_BOOST_NS::enable_if<has_move_emulation_enabled<typename std::iterator_traits<I>::value_type> >::type* = 0
/// @endcond
)
{
typedef typename std::iterator_traits<I>::value_type input_value_type;
while (f != l) {
- ::new(static_cast<void*>(&*r)) input_value_type(BOOST_MOVE_NAMESPACE::move(*f));
+ ::new(static_cast<void*>(&*r)) input_value_type(boost::move(*f));
++f; ++r;
}
return r;
}
/// @cond
-
+/*
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
F uninitialized_move(I f, I l, F r,
- typename disable_if<is_movable<typename std::iterator_traits<I>::value_type> >::type* = 0)
+ typename BOOST_MOVE_BOOST_NS::disable_if<has_move_emulation_enabled<typename std::iterator_traits<I>::value_type> >::type* = 0)
{
return std::uninitialized_copy(f, l, r);
}
-
+*/
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_copy_or_move
@@ -983,30 +965,70 @@
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
-F uninitialized_move_move_iterator(I f, I l, F r,
- typename enable_if< is_movable<typename I::value_type> >::type* = 0)
+F uninitialized_move_move_iterator(I f, I l, F r
+// ,typename BOOST_MOVE_BOOST_NS::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0
+)
{
- return ::BOOST_MOVE_NAMESPACE::uninitialized_move(f, l, r);
+ return ::boost::uninitialized_move(f, l, r);
}
-
+/*
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
F uninitialized_move_move_iterator(I f, I l, F r,
- typename disable_if< is_movable<typename I::value_type> >::type* = 0)
+ typename BOOST_MOVE_BOOST_NS::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0)
{
return std::uninitialized_copy(f.base(), l.base(), r);
}
-
+*/
} //namespace move_detail {
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
F uninitialized_copy_or_move(I f, I l, F r,
- typename enable_if< move_detail::is_move_iterator<I> >::type* = 0)
+ typename BOOST_MOVE_BOOST_NS::enable_if< move_detail::is_move_iterator<I> >::type* = 0)
+{
+ return ::boost::move_detail::uninitialized_move_move_iterator(f, l, r);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// copy_or_move
+//
+//////////////////////////////////////////////////////////////////////////////
+
+namespace move_detail {
+
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+F move_move_iterator(I f, I l, F r
+// ,typename BOOST_MOVE_BOOST_NS::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0
+)
{
- return ::BOOST_MOVE_NAMESPACE::move_detail::uninitialized_move_move_iterator(f, l, r);
+ return ::boost::move(f, l, r);
+}
+/*
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+F move_move_iterator(I f, I l, F r,
+ typename BOOST_MOVE_BOOST_NS::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0)
+{
+ return std::copy(f.base(), l.base(), r);
+}
+*/
+
+} //namespace move_detail {
+
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+F copy_or_move(I f, I l, F r,
+ typename BOOST_MOVE_BOOST_NS::enable_if< move_detail::is_move_iterator<I> >::type* = 0)
+{
+ return ::boost::move_detail::move_move_iterator(f, l, r);
}
/// @endcond
@@ -1028,13 +1050,36 @@
typename F> // F models ForwardIterator
F uninitialized_copy_or_move(I f, I l, F r
/// @cond
- ,typename disable_if< move_detail::is_move_iterator<I> >::type* = 0
+ ,typename BOOST_MOVE_BOOST_NS::disable_if< move_detail::is_move_iterator<I> >::type* = 0
/// @endcond
)
{
return std::uninitialized_copy(f, l, r);
}
+//! <b>Effects</b>:
+//! \code
+//! for (; first != last; ++result, ++first)
+//! *result = *first;
+//! \endcode
+//!
+//! <b>Returns</b>: result
+//!
+//! <b>Note</b>: This function is provided because
+//! <i>std::uninitialized_copy</i> from some STL implementations
+//! is not compatible with <i>move_iterator</i>
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+F copy_or_move(I f, I l, F r
+ /// @cond
+ ,typename BOOST_MOVE_BOOST_NS::disable_if< move_detail::is_move_iterator<I> >::type* = 0
+ /// @endcond
+ )
+{
+ return std::copy(f, l, r);
+}
+
//! If this trait yields to true
//! (<i>has_trivial_destructor_after_move <T>::value == true</i>)
//! means that if T is used as argument of a move construction/assignment,
@@ -1046,42 +1091,9 @@
//! when inserted in containers.
template <class T>
struct has_trivial_destructor_after_move
- : public ::boost::has_trivial_destructor<T>
+ : BOOST_MOVE_BOOST_NS::has_trivial_destructor<T>
{};
-#ifndef BOOST_MOVE_DOXYGEN_INVOKED
-
-#ifdef BOOST_MOVE_IN_BOOST_INTERPROCESS_NAMESPACE
-
-#define BOOST_INTERPROCESS_ENABLE_MOVE_EMULATION(TYPE) BOOST_ENABLE_MOVE_EMULATION(TYPE)
-#define BOOST_INTERPROCESS_MOVABLE_BUT_NOT_COPYABLE(TYPE) BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)
-#define BOOST_INTERPROCESS_COPYABLE_AND_MOVABLE(TYPE) BOOST_COPYABLE_AND_MOVABLE(TYPE)
-#define BOOST_INTERPROCESS_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)
-#define BOOST_INTERPROCESS_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)
-#define BOOST_INTERPROCESS_RV_REF(TYPE) BOOST_RV_REF(TYPE)
-#define BOOST_INTERPROCESS_COPY_ASSIGN_REF(TYPE) BOOST_COPY_ASSIGN_REF(TYPE)
-#define BOOST_INTERPROCESS_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) BOOST_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)
-#define BOOST_INTERPROCESS_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) BOOST_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)
-#define BOOST_INTERPROCESS_FWD_REF(TYPE) BOOST_FWD_REF(TYPE)
-#define BOOST_INTERPROCESS_CATCH_CONST_RLVALUE(TYPE) BOOST_CATCH_CONST_RLVALUE(TYPE)
-
-#endif
-
-#define BOOST_MOVE_MACRO_ENABLE_MOVE_EMULATION(TYPE) BOOST_ENABLE_MOVE_EMULATION(TYPE)
-#define BOOST_MOVE_MACRO_MOVABLE_BUT_NOT_COPYABLE(TYPE) BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)
-#define BOOST_MOVE_MACRO_COPYABLE_AND_MOVABLE(TYPE) BOOST_COPYABLE_AND_MOVABLE(TYPE)
-#define BOOST_MOVE_MACRO_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)
-#define BOOST_MOVE_MACRO_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)
-#define BOOST_MOVE_MACRO_RV_REF(TYPE) BOOST_RV_REF(TYPE)
-#define BOOST_MOVE_MACRO_COPY_ASSIGN_REF(TYPE) BOOST_COPY_ASSIGN_REF(TYPE)
-#define BOOST_MOVE_MACRO_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2) BOOST_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)
-#define BOOST_MOVE_MACRO_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3) BOOST_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)
-#define BOOST_MOVE_MACRO_FWD_REF(TYPE) BOOST_FWD_REF(TYPE)
-#define BOOST_MOVE_MACRO_CATCH_CONST_RLVALUE(TYPE) BOOST_CATCH_CONST_RLVALUE(TYPE)
-
-#endif //BOOST_MOVE_DOXYGEN_INVOKED
-
-INTERPROCESS_NAMESPACE_END
} //namespace boost {
-#endif //#ifndef BOOST_MOVE_HPP
+#endif //#ifndef BOOST_MOVE_MOVE_HPP
Added: sandbox/move/boost/move/move_helpers.hpp
==============================================================================
--- (empty file)
+++ sandbox/move/boost/move/move_helpers.hpp 2011-07-21 19:05:18 EDT (Thu, 21 Jul 2011)
@@ -0,0 +1,173 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2010-2011.
+// 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/move for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_MOVE_MOVE_HELPERS_HPP
+#define BOOST_MOVE_MOVE_HELPERS_HPP
+
+#include <boost/move/move.hpp>
+#include <boost/type_traits/is_class.hpp>
+
+#if defined(BOOST_NO_RVALUE_REFERENCES) || (defined(_MSC_VER) && (_MSC_VER == 1600))
+#include <boost/type_traits/is_same.hpp>
+#include <boost/utility/enable_if.hpp>
+#endif
+#if defined(BOOST_NO_RVALUE_REFERENCES)
+#include <boost/mpl/if.hpp>
+#endif
+
+
+#if defined(BOOST_NO_RVALUE_REFERENCES)
+struct not_a_type;
+#define BOOST_MOVE_CATCH_CONST(U) \
+ typename ::boost::mpl::if_< ::boost::is_class<T>, BOOST_CATCH_CONST_RLVALUE(U), const U &>::type
+#define BOOST_MOVE_CATCH_RVALUE(U)\
+ typename ::boost::mpl::if_< ::boost::is_class<T>, BOOST_RV_REF(T), not_a_type>::type
+#define BOOST_MOVE_CATCH_FWD(U) BOOST_FWD_REF(U)
+#else
+#define BOOST_MOVE_CATCH_CONST(U) const U &
+#define BOOST_MOVE_CATCH_RVALUE(U) U &&
+#define BOOST_MOVE_CATCH_FWD(U) U &&
+#endif
+
+#ifdef BOOST_NO_RVALUE_REFERENCES
+
+#define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
+ RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\
+ { return FWD_FUNCTION(static_cast<const TYPE&>(x)); }\
+\
+ RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
+ { return FWD_FUNCTION(::boost::move(x)); }\
+\
+ RETURN_VALUE PUB_FUNCTION(TYPE &x)\
+ { return FWD_FUNCTION(const_cast<const TYPE &>(x)); }\
+\
+ template<class BOOST_MOVE_TEMPL_PARAM>\
+ typename ::boost::enable_if_c\
+ < ::boost::is_class<TYPE>::value &&\
+ ::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value &&\
+ !::boost::has_move_emulation_enabled<BOOST_MOVE_TEMPL_PARAM>::value\
+ , RETURN_VALUE >::type\
+ PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\
+ { return FWD_FUNCTION(u); }\
+\
+ template<class BOOST_MOVE_TEMPL_PARAM>\
+ typename ::boost::enable_if_c\
+ < ::boost::is_class<BOOST_MOVE_TEMPL_PARAM>::value &&\
+ !::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value &&\
+ !::boost::move_detail::is_rv<BOOST_MOVE_TEMPL_PARAM>::value\
+ , RETURN_VALUE >::type\
+ PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\
+ {\
+ TYPE t(u);\
+ return FWD_FUNCTION(::boost::move(t));\
+ }\
+//
+
+#elif (defined(_MSC_VER) && (_MSC_VER == 1600))
+
+#define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
+ RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\
+ { return FWD_FUNCTION(static_cast<const TYPE&>(x)); }\
+\
+ RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
+ { return FWD_FUNCTION(::boost::move(x)); }\
+\
+ template<class BOOST_MOVE_TEMPL_PARAM>\
+ typename ::boost::enable_if_c\
+ < !::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value\
+ , RETURN_VALUE >::type\
+ PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\
+ {\
+ TYPE t(u);\
+ return FWD_FUNCTION(::boost::move(t));\
+ }\
+//
+
+#else
+
+#define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
+ RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\
+ { return FWD_FUNCTION(static_cast<const TYPE&>(x)); }\
+\
+ RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
+ { return FWD_FUNCTION(::boost::move(x)); }\
+//
+
+#endif
+
+
+#ifdef BOOST_NO_RVALUE_REFERENCES
+
+#define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1)\
+ RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\
+ { return FWD_FUNCTION(arg1, static_cast<const TYPE&>(x)); }\
+\
+ RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
+ { return FWD_FUNCTION(arg1, ::boost::move(x)); }\
+\
+ RETURN_VALUE PUB_FUNCTION(ARG1 arg1, TYPE &x)\
+ { return FWD_FUNCTION(arg1, const_cast<const TYPE &>(x)); }\
+\
+ template<class BOOST_MOVE_TEMPL_PARAM>\
+ typename ::boost::enable_if_c\
+ < ::boost::is_class<TYPE>::value &&\
+ ::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value &&\
+ !::boost::has_move_emulation_enabled<BOOST_MOVE_TEMPL_PARAM>::value\
+ , RETURN_VALUE >::type\
+ PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\
+ { return FWD_FUNCTION(arg1, u); }\
+\
+ template<class BOOST_MOVE_TEMPL_PARAM>\
+ typename ::boost::enable_if_c\
+ < ::boost::is_class<BOOST_MOVE_TEMPL_PARAM>::value &&\
+ !::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value &&\
+ !::boost::move_detail::is_rv<BOOST_MOVE_TEMPL_PARAM>::value\
+ , RETURN_VALUE >::type\
+ PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\
+ {\
+ TYPE t(u);\
+ return FWD_FUNCTION(arg1, ::boost::move(t));\
+ }\
+//
+
+#elif (defined(_MSC_VER) && (_MSC_VER == 1600))
+
+#define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1)\
+ RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\
+ { return FWD_FUNCTION(arg1, static_cast<const TYPE&>(x)); }\
+\
+ RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
+ { return FWD_FUNCTION(arg1, ::boost::move(x)); }\
+\
+ template<class BOOST_MOVE_TEMPL_PARAM>\
+ typename ::boost::enable_if_c\
+ < !::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value\
+ , RETURN_VALUE >::type\
+ PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\
+ {\
+ TYPE t(u);\
+ return FWD_FUNCTION(arg1, ::boost::move(t));\
+ }\
+//
+
+#else
+
+#define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1)\
+ RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\
+ { return FWD_FUNCTION(arg1, static_cast<const TYPE&>(x)); }\
+\
+ RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
+ { return FWD_FUNCTION(arg1, ::boost::move(x)); }\
+//
+
+#endif
+
+#endif //#ifndef BOOST_MOVE_MOVE_HELPERS_HPP
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