|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78589 - in branches/release/boost/container: . detail
From: igaztanaga_at_[hidden]
Date: 2012-05-24 12:36:43
Author: igaztanaga
Date: 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
New Revision: 78589
URL: http://svn.boost.org/trac/boost/changeset/78589
Log:
Merged from trunk
Properties modified:
branches/release/boost/container/ (props changed)
Text files modified:
branches/release/boost/container/allocator_traits.hpp | 34 +-
branches/release/boost/container/container_fwd.hpp | 12
branches/release/boost/container/deque.hpp | 348 ++++++++++----------
branches/release/boost/container/detail/adaptive_node_pool_impl.hpp | 18
branches/release/boost/container/detail/advanced_insert_int.hpp | 8
branches/release/boost/container/detail/algorithms.hpp | 2
branches/release/boost/container/detail/allocation_type.hpp | 2
branches/release/boost/container/detail/destroyers.hpp | 8
branches/release/boost/container/detail/flat_tree.hpp | 214 ++++++++----
branches/release/boost/container/detail/function_detector.hpp | 4
branches/release/boost/container/detail/iterators.hpp | 40 +-
branches/release/boost/container/detail/math_functions.hpp | 4
branches/release/boost/container/detail/mpl.hpp | 20
branches/release/boost/container/detail/node_alloc_holder.hpp | 8
branches/release/boost/container/detail/node_pool_impl.hpp | 20
branches/release/boost/container/detail/pair.hpp | 6
branches/release/boost/container/detail/preprocessor.hpp | 2
branches/release/boost/container/detail/transform_iterator.hpp | 6
branches/release/boost/container/detail/tree.hpp | 132 ++++----
branches/release/boost/container/detail/type_traits.hpp | 4
branches/release/boost/container/detail/utilities.hpp | 4
branches/release/boost/container/detail/value_init.hpp | 6
branches/release/boost/container/detail/variadic_templates_tools.hpp | 4
branches/release/boost/container/detail/version_type.hpp | 2
branches/release/boost/container/flat_map.hpp | 633 +++++++++++++++++++++------------------
branches/release/boost/container/flat_set.hpp | 575 +++++++++++++++++++-----------------
branches/release/boost/container/list.hpp | 346 ++++++++++----------
branches/release/boost/container/map.hpp | 566 +++++++++++++++++-----------------
branches/release/boost/container/scoped_allocator.hpp | 210 ++++++------
branches/release/boost/container/set.hpp | 536 ++++++++++++++++----------------
branches/release/boost/container/slist.hpp | 484 +++++++++++++++---------------
branches/release/boost/container/stable_vector.hpp | 194 ++++++------
branches/release/boost/container/string.hpp | 580 ++++++++++++++++++------------------
branches/release/boost/container/vector.hpp | 347 +++++++++++----------
34 files changed, 2768 insertions(+), 2611 deletions(-)
Modified: branches/release/boost/container/allocator_traits.hpp
==============================================================================
--- branches/release/boost/container/allocator_traits.hpp (original)
+++ branches/release/boost/container/allocator_traits.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -66,10 +66,10 @@
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! Alloc::pointer if such a type exists; otherwise, value_type*
- //!
+ //!
typedef unspecified pointer;
//! Alloc::const_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const
- //!
+ //!
typedef unspecified const_pointer;
//! Non-standard extension
//! Alloc::reference if such a type exists; otherwise, value_type&
@@ -78,16 +78,16 @@
//! Alloc::const_reference if such a type exists ; otherwise, const value_type&
typedef unspecified const_reference;
//! Alloc::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>.
- //!
+ //!
typedef unspecified void_pointer;
//! Alloc::const_void_pointer if such a type exists ; otherwis e, pointer_traits<pointer>::rebind<const
- //!
+ //!
typedef unspecified const_void_pointer;
//! Alloc::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type.
- //!
+ //!
typedef unspecified difference_type;
//! Alloc::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::type
- //!
+ //!
typedef unspecified size_type;
//! Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant
//! type with internal constant static member `value` == false.
@@ -99,9 +99,9 @@
//! type with internal constant static member `value` == false.
typedef unspecified propagate_on_container_swap;
//! Defines an allocator: Alloc::rebind<T>::other if such a type exists; otherwise, Alloc<T, Args>
- //! if Alloc is a class template instantiation of the form Alloc<U, Args>, where Args is zero or
+ //! if Alloc is a class template instantiation of the form Alloc<U, Args>, where Args is zero or
//! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed.
- //!
+ //!
//! In C++03 compilers `rebind_alloc` is a struct derived from an allocator
//! deduced by previously detailed rules.
template <class T> using rebind_alloc = unspecified;
@@ -122,7 +122,7 @@
pointer, value_type*)
pointer;
//const_pointer
- typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
const_pointer, typename boost::intrusive::pointer_traits<pointer>::template
rebind_pointer<const value_type>)
const_pointer;
@@ -131,11 +131,11 @@
reference, typename container_detail::unvoid<value_type>::type&)
reference;
//const_reference
- typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,
const_reference, const typename container_detail::unvoid<value_type>::type&)
const_reference;
//void_pointer
- typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
+ typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc,
void_pointer, typename boost::intrusive::pointer_traits<pointer>::template
rebind_pointer<void>)
void_pointer;
@@ -203,12 +203,12 @@
#endif //BOOST_CONTAINER_DOXYGEN_INVOKED
//! <b>Returns</b>: `a.allocate(n)`
- //!
+ //!
static pointer allocate(Alloc &a, size_type n)
{ return a.allocate(n); }
//! <b>Returns</b>: `a.deallocate(p, n)`
- //!
+ //!
//! <b>Throws</b>: Nothing
static void deallocate(Alloc &a, pointer p, size_type n)
{ return a.deallocate(p, n); }
@@ -260,7 +260,7 @@
}
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
- //! <b>Effects</b>: calls `a.construct(p, std::forward<Args>(args)...)` if that call is well-formed;
+ //! <b>Effects</b>: calls `a.construct(p, std::forward<Args>(args)...)` if that call is well-formed;
//! otherwise, invokes `::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)`
template <class T, class ...Args>
static void construct(Alloc & a, T* p, BOOST_FWD_REF(Args)... args)
@@ -300,8 +300,8 @@
#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
template<class T, class ...Args>
- static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args)
- {
+ static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args)
+ {
const bool value = boost::container::container_detail::
has_member_function_callable_with_construct
< Alloc, T*, Args... >::value;
@@ -336,7 +336,7 @@
//
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE()
-
+
private:
#define BOOST_PP_LOCAL_MACRO(n) \
template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
Modified: branches/release/boost/container/container_fwd.hpp
==============================================================================
--- branches/release/boost/container/container_fwd.hpp (original)
+++ branches/release/boost/container/container_fwd.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -21,8 +21,8 @@
/// @cond
-namespace boost{
-namespace intrusive{
+namespace boost{
+namespace intrusive{
//Create namespace to avoid compilation errors
}}
@@ -32,9 +32,9 @@
}}}
-#include <utility>
-#include <memory>
-#include <functional>
+#include <utility>
+#include <memory>
+#include <functional>
#include <iosfwd>
#include <string>
@@ -127,7 +127,7 @@
//basic_string class
template <class CharT
,class Traits = std::char_traits<CharT>
- ,class A = std::allocator<CharT> >
+ ,class A = std::allocator<CharT> >
class basic_string;
//! Type used to tag that the input range is
Modified: branches/release/boost/container/deque.hpp
==============================================================================
--- branches/release/boost/container/deque.hpp (original)
+++ branches/release/boost/container/deque.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -90,7 +90,7 @@
// Note: this function is simply a kludge to work around several compilers'
// bugs in handling constant expressions.
-inline std::size_t deque_buf_size(std::size_t size)
+inline std::size_t deque_buf_size(std::size_t size)
{ return size < 512 ? std::size_t(512 / size) : std::size_t(1); }
// Deque base class. It has two purposes. First, its constructor
@@ -128,16 +128,16 @@
static size_type s_buffer_size() { return deque_buf_size(sizeof(T)); }
- val_alloc_ptr priv_allocate_node()
+ val_alloc_ptr priv_allocate_node()
{ return this->alloc().allocate(s_buffer_size()); }
- void priv_deallocate_node(val_alloc_ptr p)
+ void priv_deallocate_node(val_alloc_ptr p)
{ this->alloc().deallocate(p, s_buffer_size()); }
- ptr_alloc_ptr priv_allocate_map(size_type n)
+ ptr_alloc_ptr priv_allocate_map(size_type n)
{ return this->ptr_alloc().allocate(n); }
- void priv_deallocate_map(ptr_alloc_ptr p, size_type n)
+ void priv_deallocate_map(ptr_alloc_ptr p, size_type n)
{ this->ptr_alloc().deallocate(p, n); }
public:
@@ -145,7 +145,7 @@
// For any nonsingular iterator i:
// i.node is the address of an element in the map array. The
// contents of i.node is a pointer to the beginning of a node.
- // i.first == //(i.node)
+ // i.first == //(i.node)
// i.last == i.first + node_size
// i.cur is a pointer in the range [i.first, i.last). NOTE:
// the implication of this is that i.cur is always a dereferenceable
@@ -160,14 +160,14 @@
// [start.cur, start.last) and [finish.first, finish.cur) are initialized
// objects, and [start.first, start.cur) and [finish.cur, finish.last)
// are uninitialized storage.
- // [map, map + map_size) is a valid, non-empty range.
- // [start.node, finish.node] is a valid range contained within
- // [map, map + map_size).
+ // [map, map + map_size) is a valid, non-empty range.
+ // [start.node, finish.node] is a valid range contained within
+ // [map, map + map_size).
// A pointer in the range [map, map + map_size) points to an allocated node
// if and only if the pointer is in the range [start.node, finish.node].
- class const_iterator
- : public std::iterator<std::random_access_iterator_tag,
- val_alloc_val, val_alloc_diff,
+ class const_iterator
+ : public std::iterator<std::random_access_iterator_tag,
+ val_alloc_val, val_alloc_diff,
val_alloc_cptr, val_alloc_cref>
{
public:
@@ -185,30 +185,30 @@
friend class deque<T, A>;
friend class deque_base<T, A>;
- protected:
+ protected:
val_alloc_ptr m_cur;
val_alloc_ptr m_first;
val_alloc_ptr m_last;
index_pointer m_node;
- public:
- const_iterator(val_alloc_ptr x, index_pointer y)
+ public:
+ const_iterator(val_alloc_ptr x, index_pointer y)
: m_cur(x), m_first(*y),
m_last(*y + s_buffer_size()), m_node(y) {}
const_iterator() : m_cur(0), m_first(0), m_last(0), m_node(0) {}
const_iterator(const const_iterator& x)
- : m_cur(x.m_cur), m_first(x.m_first),
+ : m_cur(x.m_cur), m_first(x.m_first),
m_last(x.m_last), m_node(x.m_node) {}
- reference operator*() const
+ reference operator*() const
{ return *this->m_cur; }
- pointer operator->() const
+ pointer operator->() const
{ return this->m_cur; }
- difference_type operator-(const self_t& x) const
+ difference_type operator-(const self_t& x) const
{
if(!this->m_cur && !x.m_cur){
return 0;
@@ -217,24 +217,24 @@
(this->m_cur - this->m_first) + (x.m_last - x.m_cur);
}
- self_t& operator++()
+ self_t& operator++()
{
++this->m_cur;
if (this->m_cur == this->m_last) {
this->priv_set_node(this->m_node + 1);
this->m_cur = this->m_first;
}
- return *this;
+ return *this;
}
- self_t operator++(int)
+ self_t operator++(int)
{
self_t tmp = *this;
++*this;
return tmp;
}
- self_t& operator--()
+ self_t& operator--()
{
if (this->m_cur == this->m_first) {
this->priv_set_node(this->m_node - 1);
@@ -244,7 +244,7 @@
return *this;
}
- self_t operator--(int)
+ self_t operator--(int)
{
self_t tmp = *this;
--*this;
@@ -261,7 +261,7 @@
offset > 0 ? offset / difference_type(this->s_buffer_size())
: -difference_type((-offset - 1) / this->s_buffer_size()) - 1;
this->priv_set_node(this->m_node + node_offset);
- this->m_cur = this->m_first +
+ this->m_cur = this->m_first +
(offset - node_offset * difference_type(this->s_buffer_size()));
}
return *this;
@@ -270,37 +270,37 @@
self_t operator+(difference_type n) const
{ self_t tmp = *this; return tmp += n; }
- self_t& operator-=(difference_type n)
+ self_t& operator-=(difference_type n)
{ return *this += -n; }
-
- self_t operator-(difference_type n) const
+
+ self_t operator-(difference_type n) const
{ self_t tmp = *this; return tmp -= n; }
- reference operator[](difference_type n) const
+ reference operator[](difference_type n) const
{ return *(*this + n); }
- bool operator==(const self_t& x) const
+ bool operator==(const self_t& x) const
{ return this->m_cur == x.m_cur; }
- bool operator!=(const self_t& x) const
+ bool operator!=(const self_t& x) const
{ return !(*this == x); }
- bool operator<(const self_t& x) const
+ bool operator<(const self_t& x) const
{
- return (this->m_node == x.m_node) ?
+ return (this->m_node == x.m_node) ?
(this->m_cur < x.m_cur) : (this->m_node < x.m_node);
}
- bool operator>(const self_t& x) const
+ bool operator>(const self_t& x) const
{ return x < *this; }
- bool operator<=(const self_t& x) const
+ bool operator<=(const self_t& x) const
{ return !(x < *this); }
- bool operator>=(const self_t& x) const
+ bool operator>=(const self_t& x) const
{ return !(*this < x); }
- void priv_set_node(index_pointer new_node)
+ void priv_set_node(index_pointer new_node)
{
this->m_node = new_node;
this->m_first = *new_node;
@@ -343,12 +343,12 @@
reference operator[](difference_type n) const { return *(*this + n); }
//Increment / Decrement
- iterator& operator++()
+ iterator& operator++()
{ this->const_iterator::operator++(); return *this; }
iterator operator++(int)
{ iterator tmp = *this; ++*this; return tmp; }
-
+
iterator& operator--()
{ this->const_iterator::operator--(); return *this; }
@@ -379,7 +379,7 @@
: members_(a)
{ this->priv_initialize_map(num_elements); }
- explicit deque_base(const allocator_type& a)
+ explicit deque_base(const allocator_type& a)
: members_(a)
{}
@@ -402,7 +402,7 @@
private:
deque_base(const deque_base&);
-
+
protected:
void swap_members(deque_base &x)
@@ -423,7 +423,7 @@
ptr_alloc_ptr nstart = this->members_.m_map + (this->members_.m_map_size - num_nodes) / 2;
ptr_alloc_ptr nfinish = nstart + num_nodes;
-
+
BOOST_TRY {
this->priv_create_nodes(nstart, nfinish);
}
@@ -508,16 +508,16 @@
iterator m_finish;
} members_;
- ptr_alloc_t &ptr_alloc()
+ ptr_alloc_t &ptr_alloc()
{ return members_; }
-
- const ptr_alloc_t &ptr_alloc() const
+
+ const ptr_alloc_t &ptr_alloc() const
{ return members_; }
- allocator_type &alloc()
+ allocator_type &alloc()
{ return members_; }
-
- const allocator_type &alloc() const
+
+ const allocator_type &alloc() const
{ return members_; }
};
/// @endcond
@@ -574,7 +574,7 @@
private: // Internal typedefs
BOOST_COPYABLE_AND_MOVABLE(deque)
typedef ptr_alloc_ptr index_pointer;
- static size_type s_buffer_size()
+ static size_type s_buffer_size()
{ return Base::s_buffer_size(); }
typedef container_detail::advanced_insert_aux_int<iterator> advanced_insert_aux_int_t;
typedef repeat_iterator<T, difference_type> r_iterator;
@@ -586,175 +586,175 @@
public:
//! <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 BOOST_CONTAINER_NOEXCEPT
{ return Base::alloc(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
- //!
+ //!
//! <b>Throws</b>: Nothing
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Non-standard extension.
const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
{ return Base::alloc(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
- //!
+ //!
//! <b>Throws</b>: Nothing
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Non-standard extension.
stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
{ return Base::alloc(); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the deque.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
iterator begin() BOOST_CONTAINER_NOEXCEPT
{ 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() BOOST_CONTAINER_NOEXCEPT
{ 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 BOOST_CONTAINER_NOEXCEPT
{ 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 BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_finish; }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed deque.
- //!
+ //! <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() BOOST_CONTAINER_NOEXCEPT
{ return reverse_iterator(this->members_.m_finish); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed deque.
- //!
+ //! of the reversed deque.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
{ return reverse_iterator(this->members_.m_start); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed deque.
- //!
+ //! <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 BOOST_CONTAINER_NOEXCEPT
{ return const_reverse_iterator(this->members_.m_finish); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed deque.
- //!
+ //! of the reversed deque.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
{ 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 BOOST_CONTAINER_NOEXCEPT
{ 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 BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_finish; }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed deque.
- //!
+ //! <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 BOOST_CONTAINER_NOEXCEPT
{ return const_reverse_iterator(this->members_.m_finish); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed deque.
- //!
+ //! of the reversed deque.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
{ return const_reverse_iterator(this->members_.m_start); }
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a reference to the nth element
+ //! <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) BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_start[difference_type(n)]; }
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a const reference to the nth element
+ //! <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 BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_start[difference_type(n)]; }
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a reference to the nth element
+ //! <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
+ //! <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]; }
@@ -763,20 +763,20 @@
//!
//! <b>Effects</b>: Returns a reference to the first
//! element of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reference front() BOOST_CONTAINER_NOEXCEPT
{ return *this->members_.m_start; }
//! <b>Requires</b>: !empty()
//!
- //! <b>Effects</b>: Returns a const reference to the first element
+ //! <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 BOOST_CONTAINER_NOEXCEPT
{ return *this->members_.m_start; }
@@ -785,9 +785,9 @@
//!
//! <b>Effects</b>: Returns a reference to the last
//! element of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reference back() BOOST_CONTAINER_NOEXCEPT
{ return *(end()-1); }
@@ -796,52 +796,52 @@
//!
//! <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 BOOST_CONTAINER_NOEXCEPT
{ 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 BOOST_CONTAINER_NOEXCEPT
{ 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 BOOST_CONTAINER_NOEXCEPT
{ return allocator_traits_type::max_size(this->alloc()); }
//! <b>Effects</b>: Returns true if the deque contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
bool empty() const BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_finish == this->members_.m_start; }
//! <b>Effects</b>: Default constructors a deque.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's default constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- deque()
+ deque()
: Base()
{}
//! <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)
+ explicit deque(const allocator_type& a)
: Base(a)
{}
@@ -850,7 +850,7 @@
//!
//! <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(n, allocator_type())
@@ -865,7 +865,7 @@
//!
//! <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())
@@ -875,7 +875,7 @@
//! <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(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
@@ -890,19 +890,19 @@
//! <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) x)
+ deque(BOOST_RV_REF(deque) x)
: Base(boost::move(static_cast<Base&>(x)))
{ this->swap_members(x); }
//! <b>Effects</b>: Copy constructs a vector using the specified allocator.
//!
//! <b>Postcondition</b>: x == *this.
- //!
+ //!
//! <b>Throws</b>: If allocation
//! throws or T's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements x contains.
deque(const deque& x, const allocator_type &a)
: Base(a)
@@ -919,9 +919,9 @@
//! Otherwise copies values from x to *this.
//!
//! <b>Throws</b>: If allocation or T's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant if a == mx.get_allocator(), linear otherwise.
- deque(BOOST_RV_REF(deque) mx, const allocator_type &a)
+ deque(BOOST_RV_REF(deque) mx, const allocator_type &a)
: Base(a)
{
if(mx.alloc() == a){
@@ -945,7 +945,7 @@
//! <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)
+ : Base(a)
{
//Dispatch depending on integer/iterator
const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
@@ -966,13 +966,13 @@
//! <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>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)
+ deque& operator= (BOOST_COPY_ASSIGN_REF(deque) x)
{
if (&x != this){
allocator_type &this_alloc = this->alloc();
@@ -1132,7 +1132,7 @@
);
++this->members_.m_start.m_cur;
}
- else
+ else
this->priv_pop_front_aux();
}
@@ -1180,7 +1180,7 @@
//!
//! <b>Complexity</b>: Linear to std::distance [first, last).
template <class InpIt>
- void insert(const_iterator pos, InpIt first, InpIt last)
+ void insert(const_iterator pos, InpIt first, InpIt last)
{
//Dispatch depending on integer/iterator
const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
@@ -1340,10 +1340,10 @@
//! <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)
+ void resize(size_type new_size, const value_type& x)
{
const size_type len = size();
- if (new_size < len)
+ if (new_size < len)
this->erase(this->members_.m_start + new_size, this->members_.m_finish);
else
this->insert(this->members_.m_finish, new_size - len, x);
@@ -1355,10 +1355,10 @@
//! <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)
+ void resize(size_type new_size)
{
const size_type len = size();
- if (new_size < len)
+ if (new_size < len)
this->priv_erase_last_n(len - new_size);
else{
size_type n = new_size - this->size();
@@ -1371,7 +1371,7 @@
//!
//! <b>Throws</b>: Nothing.
//!
- //! <b>Complexity</b>: Linear to the elements between pos and the
+ //! <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.
@@ -1396,7 +1396,7 @@
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the distance between first and
- //! last plus the elements between pos and the
+ //! 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) BOOST_CONTAINER_NOEXCEPT
@@ -1486,10 +1486,10 @@
/// @cond
private:
- void priv_range_check(size_type n) const
+ 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)
+ iterator priv_insert(const_iterator position, const value_type &x)
{
if (position == cbegin()){
this->push_front(x);
@@ -1506,7 +1506,7 @@
}
}
- iterator priv_insert(const_iterator position, BOOST_RV_REF(value_type) mx)
+ iterator priv_insert(const_iterator position, BOOST_RV_REF(value_type) mx)
{
if (position == cbegin()) {
this->push_front(boost::move(mx));
@@ -1609,7 +1609,7 @@
}
template <class FwdIt>
- void priv_insert_aux(const_iterator pos, FwdIt first, FwdIt last, std::forward_iterator_tag)
+ void priv_insert_aux(const_iterator pos, FwdIt first, FwdIt last, std::forward_iterator_tag)
{ this->priv_insert_aux(pos, first, last); }
// assign(), a generalized assignment member function. Two
@@ -1629,14 +1629,14 @@
}
template <class Integer>
- void priv_initialize_dispatch(Integer n, Integer x, container_detail::true_)
+ void priv_initialize_dispatch(Integer n, Integer x, container_detail::true_)
{
this->priv_initialize_map(n);
this->priv_fill_initialize(x);
}
template <class InpIt>
- void priv_initialize_dispatch(InpIt first, InpIt last, container_detail::false_)
+ void priv_initialize_dispatch(InpIt first, InpIt last, container_detail::false_)
{
typedef typename std::iterator_traits<InpIt>::iterator_category ItCat;
this->priv_range_initialize(first, last, ItCat());
@@ -1667,7 +1667,7 @@
{ this->priv_fill_assign((size_type) n, (value_type)val); }
template <class InpIt>
- void priv_assign_dispatch(InpIt first, InpIt last, container_detail::false_)
+ void priv_assign_dispatch(InpIt first, InpIt last, container_detail::false_)
{
typedef typename std::iterator_traits<InpIt>::iterator_category ItCat;
this->priv_assign_aux(first, last, ItCat());
@@ -1700,11 +1700,11 @@
}
template <class Integer>
- void priv_insert_dispatch(const_iterator pos, Integer n, Integer x, container_detail::true_)
+ void priv_insert_dispatch(const_iterator pos, Integer n, Integer x, container_detail::true_)
{ 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, container_detail::false_)
+ void priv_insert_dispatch(const_iterator pos,InpIt first, InpIt last, container_detail::false_)
{
typedef typename std::iterator_traits<InpIt>::iterator_category ItCat;
this->priv_insert_aux(pos, first, last, ItCat());
@@ -1739,7 +1739,7 @@
iterator old_start = this->members_.m_start;
pos = this->members_.m_start + elemsbefore;
if (elemsbefore >= difference_type(n)) {
- iterator start_n = this->members_.m_start + difference_type(n);
+ iterator start_n = this->members_.m_start + difference_type(n);
::boost::container::uninitialized_move_alloc
(this->alloc(), this->members_.m_start, start_n, new_start);
this->members_.m_start = new_start;
@@ -1760,7 +1760,7 @@
else {
iterator new_finish = this->priv_reserve_elements_at_back(n);
iterator old_finish = this->members_.m_finish;
- const difference_type elemsafter =
+ const difference_type elemsafter =
difference_type(length) - elemsbefore;
pos = this->members_.m_finish - elemsafter;
if (elemsafter >= difference_type(n)) {
@@ -1814,7 +1814,7 @@
// Precondition: this->members_.m_start and this->members_.m_finish have already been initialized,
// but none of the deque's elements have yet been constructed.
- void priv_fill_initialize(const value_type& value)
+ void priv_fill_initialize(const value_type& value)
{
index_pointer cur;
BOOST_TRY {
@@ -1856,8 +1856,8 @@
index_pointer cur_node;
BOOST_TRY {
- for (cur_node = this->members_.m_start.m_node;
- cur_node < this->members_.m_finish.m_node;
+ for (cur_node = this->members_.m_start.m_node;
+ cur_node < this->members_.m_finish.m_node;
++cur_node) {
FwdIt mid = first;
std::advance(mid, this->s_buffer_size());
@@ -1887,9 +1887,9 @@
);
}
- // Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1. Note that
- // if the deque has at least one element (a precondition for this member
- // function), and if this->members_.m_start.m_cur == this->members_.m_start.m_last, then the deque
+ // Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1. Note that
+ // if the deque has at least one element (a precondition for this member
+ // function), and if this->members_.m_start.m_cur == this->members_.m_start.m_last, then the deque
// must have at least two nodes.
void priv_pop_front_aux()
{
@@ -1900,14 +1900,14 @@
this->priv_deallocate_node(this->members_.m_start.m_first);
this->members_.m_start.priv_set_node(this->members_.m_start.m_node + 1);
this->members_.m_start.m_cur = this->members_.m_start.m_first;
- }
+ }
- iterator priv_reserve_elements_at_front(size_type n)
+ iterator priv_reserve_elements_at_front(size_type n)
{
size_type vacancies = this->members_.m_start.m_cur - this->members_.m_start.m_first;
if (n > vacancies){
size_type new_elems = n-vacancies;
- size_type new_nodes = (new_elems + this->s_buffer_size() - 1) /
+ size_type new_nodes = (new_elems + this->s_buffer_size() - 1) /
this->s_buffer_size();
size_type s = (size_type)(this->members_.m_start.m_node - this->members_.m_map);
if (new_nodes > s){
@@ -1920,7 +1920,7 @@
}
BOOST_CATCH(...) {
for (size_type j = 1; j < i; ++j)
- this->priv_deallocate_node(*(this->members_.m_start.m_node - j));
+ this->priv_deallocate_node(*(this->members_.m_start.m_node - j));
BOOST_RETHROW
}
BOOST_CATCH_END
@@ -1928,7 +1928,7 @@
return this->members_.m_start - difference_type(n);
}
- iterator priv_reserve_elements_at_back(size_type n)
+ iterator priv_reserve_elements_at_back(size_type n)
{
size_type vacancies = (this->members_.m_finish.m_last - this->members_.m_finish.m_cur) - 1;
if (n > vacancies){
@@ -1945,7 +1945,7 @@
}
BOOST_CATCH(...) {
for (size_type j = 1; j < i; ++j)
- this->priv_deallocate_node(*(this->members_.m_finish.m_node + j));
+ this->priv_deallocate_node(*(this->members_.m_finish.m_node + j));
BOOST_RETHROW
}
BOOST_CATCH_END
@@ -1960,7 +1960,7 @@
index_pointer new_nstart;
if (this->members_.m_map_size > 2 * new_num_nodes) {
- new_nstart = this->members_.m_map + (this->members_.m_map_size - new_num_nodes) / 2
+ 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::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart);
@@ -1969,7 +1969,7 @@
(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart + old_num_nodes);
}
else {
- size_type new_map_size =
+ size_type new_map_size =
this->members_.m_map_size + container_detail::max_value(this->members_.m_map_size, nodes_to_add) + 2;
index_pointer new_map = this->priv_allocate_map(new_map_size);
@@ -1998,29 +1998,29 @@
template <class T, class A>
inline bool operator<(const deque<T, A>& x,
- const deque<T, A>& y)
+ const deque<T, A>& y)
{
return lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
}
template <class T, class A>
inline bool operator!=(const deque<T, A>& x,
- const deque<T, A>& y)
+ const deque<T, A>& y)
{ return !(x == y); }
template <class T, class A>
inline bool operator>(const deque<T, A>& x,
- const deque<T, A>& y)
+ const deque<T, A>& y)
{ return y < x; }
template <class T, class A>
inline bool operator<=(const deque<T, A>& x,
- const deque<T, A>& y)
+ const deque<T, A>& y)
{ return !(y < x); }
template <class T, class A>
inline bool operator>=(const deque<T, A>& x,
- const deque<T, A>& y)
+ const deque<T, A>& y)
{ return !(x < y); }
Modified: branches/release/boost/container/detail/adaptive_node_pool_impl.hpp
==============================================================================
--- branches/release/boost/container/detail/adaptive_node_pool_impl.hpp (original)
+++ branches/release/boost/container/detail/adaptive_node_pool_impl.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -51,11 +51,11 @@
, 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
- :
+ :
public hdr_offset_holder,
public multiset_hook_t
{
@@ -89,7 +89,7 @@
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 =
+ 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
@@ -228,7 +228,7 @@
{
priv_invariants();
//If there are no free nodes we allocate a new block
- if (m_block_multiset.empty()){
+ if (m_block_multiset.empty()){
priv_alloc_block(1);
}
//We take the first free node the multiset can't be empty
@@ -248,7 +248,7 @@
priv_invariants();
}
- //!Allocates n nodes.
+ //!Allocates n nodes.
//!Can throw
multiallocation_chain allocate_nodes(const size_type n)
{
@@ -448,7 +448,7 @@
#undef BOOST_CONTAINER_ADAPTIVE_NODE_POOL_CHECK_INVARIANTS
{
//We iterate through the block tree to free the memory
- block_iterator it(m_block_multiset.begin()),
+ block_iterator it(m_block_multiset.begin()),
itend(m_block_multiset.end()), to_deallocate;
if(it != itend){
for(++it; it != itend; ++it){
@@ -559,9 +559,9 @@
++m_totally_free_blocks;
block_info_t *c_info = new(mem_address)block_info_t();
m_block_multiset.insert(m_block_multiset.end(), *c_info);
-
+
mem_address += HdrSize;
- //We initialize all Nodes in Node Block to insert
+ //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(size_type i = 0; i < m_real_num_node; ++i){
@@ -605,7 +605,7 @@
}
{
char *pNode = hdr_addr + HdrSize;
- //We initialize all Nodes in Node Block to insert
+ //We initialize all Nodes in Node Block to insert
//them in the free Node list
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);
Modified: branches/release/boost/container/detail/advanced_insert_int.hpp
==============================================================================
--- branches/release/boost/container/detail/advanced_insert_int.hpp (original)
+++ branches/release/boost/container/detail/advanced_insert_int.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -183,7 +183,7 @@
namespace container_detail {
-//This class template will adapt emplace construction insertions of movable types
+//This class template will adapt emplace construction insertions of movable types
//to advanced_insert_aux_int
template<class A, class Iterator, class ...Args>
struct advanced_insert_aux_non_movable_emplace
@@ -254,7 +254,7 @@
bool used_;
};
-//This class template will adapt emplace construction insertions of movable types
+//This class template will adapt emplace construction insertions of movable types
//to advanced_insert_aux_int
template<class A, class Iterator, class ...Args>
struct advanced_insert_aux_emplace
@@ -323,11 +323,11 @@
#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-#include <boost/container/detail/preprocessor.hpp>
+#include <boost/container/detail/preprocessor.hpp>
#include <boost/container/detail/value_init.hpp>
namespace boost {
-namespace container {
+namespace container {
namespace container_detail {
#define BOOST_PP_LOCAL_MACRO(n) \
Modified: branches/release/boost/container/detail/algorithms.hpp
==============================================================================
--- branches/release/boost/container/detail/algorithms.hpp (original)
+++ branches/release/boost/container/detail/algorithms.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -51,7 +51,7 @@
ei.construct_in_place(a, dest);
}
-} //namespace container {
+} //namespace container {
} //namespace boost {
#include <boost/container/detail/config_end.hpp>
Modified: branches/release/boost/container/detail/allocation_type.hpp
==============================================================================
--- branches/release/boost/container/detail/allocation_type.hpp (original)
+++ branches/release/boost/container/detail/allocation_type.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -23,7 +23,7 @@
/// @cond
enum allocation_type_v
-{
+{
// constants for allocation commands
allocate_new_v = 0x01,
expand_fwd_v = 0x02,
Modified: branches/release/boost/container/detail/destroyers.hpp
==============================================================================
--- branches/release/boost/container/detail/destroyers.hpp (original)
+++ branches/release/boost/container/detail/destroyers.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -24,7 +24,7 @@
#include <boost/container/allocator_traits.hpp>
namespace boost {
-namespace container {
+namespace container {
namespace container_detail {
//!A deleter for scoped_ptr that deallocates the memory
@@ -88,7 +88,7 @@
void increment_size_backwards(size_type inc)
{ m_n += inc; m_p -= inc; }
-
+
~scoped_destructor_n()
{
if(!m_p) return;
@@ -185,8 +185,8 @@
};
-} //namespace container_detail {
-} //namespace container {
+} //namespace container_detail {
+} //namespace container {
} //namespace boost {
#include <boost/container/detail/config_end.hpp>
Modified: branches/release/boost/container/detail/flat_tree.hpp
==============================================================================
--- branches/release/boost/container/detail/flat_tree.hpp (original)
+++ branches/release/boost/container/detail/flat_tree.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -48,24 +48,24 @@
typedef Value first_argument_type;
typedef Value second_argument_type;
typedef bool return_type;
- public:
+ public:
flat_tree_value_compare()
: Compare()
{}
- flat_tree_value_compare(const Compare &pred)
+ flat_tree_value_compare(const Compare &pred)
: Compare(pred)
{}
bool operator()(const Value& lhs, const Value& rhs) const
- {
+ {
KeyOfValue key_extract;
- return Compare::operator()(key_extract(lhs), key_extract(rhs));
+ return Compare::operator()(key_extract(lhs), key_extract(rhs));
}
const Compare &get_comp() const
{ return *this; }
-
+
Compare &get_comp()
{ return *this; }
};
@@ -81,7 +81,7 @@
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
};
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class Compare, class A>
class flat_tree
{
@@ -92,7 +92,7 @@
typedef flat_tree_value_compare<Compare, Value, KeyOfValue> value_compare;
private:
- struct Data
+ struct Data
//Inherit from value_compare to do EBO
: public value_compare
{
@@ -119,12 +119,12 @@
: value_compare(boost::move(static_cast<value_compare&>(d))), m_vect(boost::move(d.m_vect), a)
{}
- Data(const Compare &comp)
+ Data(const Compare &comp)
: value_compare(comp), m_vect()
{}
Data(const Compare &comp,
- const allocator_t &alloc)
+ const allocator_t &alloc)
: value_compare(comp), m_vect(alloc)
{}
@@ -191,7 +191,7 @@
: m_data(comp, a)
{ }
- flat_tree(const flat_tree& x)
+ flat_tree(const flat_tree& x)
: m_data(x.m_data)
{ }
@@ -199,7 +199,7 @@
: m_data(boost::move(x.m_data))
{ }
- flat_tree(const flat_tree& x, const allocator_type &a)
+ flat_tree(const flat_tree& x, const allocator_type &a)
: m_data(x.m_data, a)
{ }
@@ -223,66 +223,66 @@
flat_tree& operator=(BOOST_RV_REF(flat_tree) mx)
{ m_data = boost::move(mx.m_data); return *this; }
- public:
+ public:
// accessors:
- Compare key_comp() const
+ Compare key_comp() const
{ return this->m_data.get_comp(); }
- allocator_type get_allocator() const
+ allocator_type get_allocator() const
{ return this->m_data.m_vect.get_allocator(); }
- const stored_allocator_type &get_stored_allocator() const
+ const stored_allocator_type &get_stored_allocator() const
{ return this->m_data.m_vect.get_stored_allocator(); }
stored_allocator_type &get_stored_allocator()
{ return this->m_data.m_vect.get_stored_allocator(); }
- iterator begin()
+ iterator begin()
{ return this->m_data.m_vect.begin(); }
- const_iterator begin() const
+ const_iterator begin() const
{ return this->cbegin(); }
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return this->m_data.m_vect.begin(); }
- iterator end()
+ iterator end()
{ return this->m_data.m_vect.end(); }
- const_iterator end() const
+ const_iterator end() const
{ return this->cend(); }
- const_iterator cend() const
+ const_iterator cend() const
{ return this->m_data.m_vect.end(); }
- reverse_iterator rbegin()
+ reverse_iterator rbegin()
{ return reverse_iterator(this->end()); }
- const_reverse_iterator rbegin() const
+ const_reverse_iterator rbegin() const
{ return this->crbegin(); }
- const_reverse_iterator crbegin() const
+ const_reverse_iterator crbegin() const
{ return const_reverse_iterator(this->cend()); }
- reverse_iterator rend()
+ reverse_iterator rend()
{ return reverse_iterator(this->begin()); }
- const_reverse_iterator rend() const
- { return this->crend(); }
+ const_reverse_iterator rend() const
+ { return this->crend(); }
- const_reverse_iterator crend() const
- { return const_reverse_iterator(this->cbegin()); }
+ const_reverse_iterator crend() const
+ { return const_reverse_iterator(this->cbegin()); }
- bool empty() const
+ bool empty() const
{ return this->m_data.m_vect.empty(); }
- size_type size() const
+ size_type size() const
{ return this->m_data.m_vect.size(); }
- size_type max_size() const
+ size_type max_size() const
{ return this->m_data.m_vect.max_size(); }
- void swap(flat_tree& other)
+ void swap(flat_tree& other)
{ this->m_data.swap(other.m_data); }
public:
@@ -365,7 +365,7 @@
template <class InIt>
void insert_equal(InIt first, InIt last)
{
- typedef typename
+ typedef typename
std::iterator_traits<InIt>::iterator_category ItCat;
this->priv_insert_equal(first, last, ItCat());
}
@@ -373,11 +373,19 @@
template <class InIt>
void insert_equal(ordered_range_t, InIt first, InIt last)
{
- typedef typename
+ typedef typename
std::iterator_traits<InIt>::iterator_category ItCat;
this->priv_insert_equal(ordered_range_t(), first, last, ItCat());
}
+ template <class InIt>
+ void insert_unique(ordered_unique_range_t, InIt first, InIt last)
+ {
+ typedef typename
+ std::iterator_traits<InIt>::iterator_category ItCat;
+ this->priv_insert_unique(ordered_unique_range_t(), first, last, ItCat());
+ }
+
#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
template <class... Args>
@@ -557,8 +565,8 @@
const Compare &key_comp = this->m_data.get_comp();
iterator i = this->lower_bound(k);
- if (i != this->end() && key_comp(k, KeyOfValue()(*i))){
- i = this->end();
+ if (i != this->end() && key_comp(k, KeyOfValue()(*i))){
+ i = this->end();
}
return i;
}
@@ -568,8 +576,8 @@
const Compare &key_comp = this->m_data.get_comp();
const_iterator i = this->lower_bound(k);
- if (i != this->end() && key_comp(k, KeyOfValue()(*i))){
- i = this->end();
+ if (i != this->end() && key_comp(k, KeyOfValue()(*i))){
+ i = this->end();
}
return i;
}
@@ -599,10 +607,10 @@
std::pair<const_iterator, const_iterator> equal_range(const key_type& k) const
{ return this->priv_equal_range(this->begin(), this->end(), k); }
- size_type capacity() const
+ size_type capacity() const
{ return this->m_data.m_vect.capacity(); }
- void reserve(size_type count)
+ void reserve(size_type count)
{ this->m_data.m_vect.reserve(count); }
private:
@@ -631,12 +639,12 @@
data.position = pos;
}
else{
- data.position =
+ data.position =
this->priv_upper_bound(this->cbegin(), pos, KeyOfValue()(val));
}
}
else{
- data.position =
+ data.position =
this->priv_lower_bound(pos, this->cend(), KeyOfValue()(val));
}
}
@@ -756,7 +764,7 @@
}
else{
first = ++middle;
- len = len - half - 1;
+ len = len - half - 1;
}
}
return first;
@@ -801,28 +809,82 @@
const size_type BurstSize = 16;
size_type positions[BurstSize];
+ //Prereserve all memory so that iterators are not invalidated
+ this->reserve(this->size()+len);
+ const const_iterator beg(this->cbegin());
+ const_iterator pos(beg);
+ //Loop in burst sizes
while(len){
const size_type burst = len < BurstSize ? len : BurstSize;
+ const const_iterator cend(this->cend());
len -= burst;
- const iterator beg(this->cbegin());
- iterator pos;
for(size_type i = 0; i != burst; ++i){
- pos = this->upper_bound(KeyOfValue()(*first));
+ //Get the insertion position for each key
+ pos = const_cast<const flat_tree&>(*this).priv_upper_bound(pos, cend, KeyOfValue()(*first));
positions[i] = static_cast<size_type>(pos - beg);
++first;
}
+ //Insert all in a single step in the precalculated positions
this->m_data.m_vect.insert_ordered_at(burst, positions + burst, first);
+ //Next search position updated
+ pos += burst;
}
}
+ template <class BidirIt>
+ void priv_insert_unique(ordered_unique_range_t, BidirIt first, BidirIt last, std::bidirectional_iterator_tag)
+ {
+ size_type len = static_cast<size_type>(std::distance(first, last));
+ const size_type BurstSize = 16;
+ size_type positions[BurstSize];
+ size_type skips[BurstSize];
+
+ //Prereserve all memory so that iterators are not invalidated
+ this->reserve(this->size()+len);
+ const const_iterator beg(this->cbegin());
+ const_iterator pos(beg);
+ const value_compare &value_comp = this->m_data;
+ //Loop in burst sizes
+ while(len){
+ skips[0u] = 0u;
+ const size_type burst = len < BurstSize ? len : BurstSize;
+ size_type unique_burst = 0u;
+ const const_iterator cend(this->cend());
+ while(unique_burst < burst && len > 0){
+ //Get the insertion position for each key
+ const value_type & val = *first++;
+ --len;
+ pos = const_cast<const flat_tree&>(*this).priv_lower_bound(pos, cend, KeyOfValue()(val));
+ //Check if already present
+ if(pos != cend && !value_comp(*pos, val)){
+ ++skips[unique_burst];
+ continue;
+ }
+
+ //If not present, calculate position
+ positions[unique_burst] = static_cast<size_type>(pos - beg);
+ if(++unique_burst < burst)
+ skips[unique_burst] = 0u;
+ }
+ //Insert all in a single step in the precalculated positions
+ this->m_data.m_vect.insert_ordered_at(unique_burst, positions + unique_burst, skips + unique_burst, first);
+ //Next search position updated
+ pos += unique_burst;
+ }
+ }
+/*
template <class FwdIt>
void priv_insert_equal_forward(ordered_range_t, FwdIt first, FwdIt last, std::forward_iterator_tag)
{ this->priv_insert_equal(first, last, std::forward_iterator_tag()); }
-
+*/
template <class InIt>
void priv_insert_equal(ordered_range_t, InIt first, InIt last, std::input_iterator_tag)
{ this->priv_insert_equal(first, last, std::input_iterator_tag()); }
+ template <class InIt>
+ void priv_insert_unique(ordered_unique_range_t, InIt first, InIt last, std::input_iterator_tag)
+ { this->priv_insert_unique(first, last, std::input_iterator_tag()); }
+/*
template <class FwdIt>
void priv_insert_equal_forward(FwdIt first, FwdIt last, std::forward_iterator_tag)
{
@@ -830,7 +892,7 @@
this->reserve(this->size()+len);
this->priv_insert_equal(first, last, std::input_iterator_tag());
}
-
+*/
template <class InIt>
void priv_insert_equal(InIt first, InIt last, std::input_iterator_tag)
{
@@ -839,59 +901,59 @@
}
};
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class Compare, class A>
-inline bool
-operator==(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
+inline bool
+operator==(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
{
return x.size() == y.size() &&
std::equal(x.begin(), x.end(), y.begin());
}
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class Compare, class A>
-inline bool
-operator<(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
+inline bool
+operator<(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
{
- return std::lexicographical_compare(x.begin(), x.end(),
+ return std::lexicographical_compare(x.begin(), x.end(),
y.begin(), y.end());
}
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class Compare, class A>
-inline bool
-operator!=(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
- const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
+inline bool
+operator!=(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
+ const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
{ return !(x == y); }
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class Compare, class A>
-inline bool
-operator>(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
- const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
+inline bool
+operator>(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
+ const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
{ return y < x; }
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class Compare, class A>
-inline bool
-operator<=(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
- const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
+inline bool
+operator<=(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
+ const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
{ return !(y < x); }
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class Compare, class A>
-inline bool
-operator>=(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
- const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
+inline bool
+operator>=(const flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
+ const flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
{ return !(x < y); }
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class Compare, class A>
-inline void
-swap(flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
+inline void
+swap(flat_tree<Key,Value,KeyOfValue,Compare,A>& x,
flat_tree<Key,Value,KeyOfValue,Compare,A>& y)
{ x.swap(y); }
@@ -901,7 +963,7 @@
/*
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
-template <class K, class V, class KOV,
+template <class K, class V, class KOV,
class C, class A>
struct has_trivial_destructor_after_move<boost::container::container_detail::flat_tree<K, V, KOV, C, A> >
{
Modified: branches/release/boost/container/detail/function_detector.hpp
==============================================================================
--- branches/release/boost/container/detail/function_detector.hpp (original)
+++ branches/release/boost/container/detail/function_detector.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -15,7 +15,7 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright 2007 Alexandre Courpron
//
-// Permission to use, copy, modify, redistribute and sell this software,
+// Permission to use, copy, modify, redistribute and sell this software,
// provided that this copyright notice appears on all copies of the software.
///////////////////////////////////////////////////////////////////////////////
@@ -74,7 +74,7 @@
public : \
static const int check = NotFound + (sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\
};\
-}}} //namespace boost::container::function_detector {
+}}} //namespace boost::container::function_detector {
#define BOOST_CONTAINER_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
::boost::container::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
Modified: branches/release/boost/container/detail/iterators.hpp
==============================================================================
--- branches/release/boost/container/detail/iterators.hpp (original)
+++ branches/release/boost/container/detail/iterators.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -33,7 +33,7 @@
#include <iterator>
namespace boost {
-namespace container {
+namespace container {
template <class T, class Difference = std::ptrdiff_t>
class constant_iterator
@@ -50,9 +50,9 @@
constant_iterator()
: m_ptr(0), m_num(0){}
- constant_iterator& operator++()
+ constant_iterator& operator++()
{ increment(); return *this; }
-
+
constant_iterator operator++(int)
{
constant_iterator result (*this);
@@ -60,9 +60,9 @@
return result;
}
- constant_iterator& operator--()
+ constant_iterator& operator--()
{ decrement(); return *this; }
-
+
constant_iterator operator--(int)
{
constant_iterator result (*this);
@@ -161,9 +161,9 @@
default_construct_iterator()
: m_num(0){}
- default_construct_iterator& operator++()
+ default_construct_iterator& operator++()
{ increment(); return *this; }
-
+
default_construct_iterator operator++(int)
{
default_construct_iterator result (*this);
@@ -171,9 +171,9 @@
return result;
}
- default_construct_iterator& operator--()
+ default_construct_iterator& operator--()
{ decrement(); return *this; }
-
+
default_construct_iterator operator--(int)
{
default_construct_iterator result (*this);
@@ -247,7 +247,7 @@
{ return other.m_num < m_num; }
const T & dereference() const
- {
+ {
static T dummy;
return dummy;
}
@@ -273,9 +273,9 @@
repeat_iterator()
: m_ptr(0), m_num(0){}
- this_type& operator++()
+ this_type& operator++()
{ increment(); return *this; }
-
+
this_type operator++(int)
{
this_type result (*this);
@@ -283,9 +283,9 @@
return result;
}
- this_type& operator--()
+ this_type& operator--()
{ increment(); return *this; }
-
+
this_type operator--(int)
{
this_type result (*this);
@@ -384,9 +384,9 @@
emplace_iterator()
: m_num(0), m_pe(0){}
- this_type& operator++()
+ this_type& operator++()
{ increment(); return *this; }
-
+
this_type operator++(int)
{
this_type result (*this);
@@ -394,9 +394,9 @@
return result;
}
- this_type& operator--()
+ this_type& operator--()
{ decrement(); return *this; }
-
+
this_type operator--(int)
{
this_type result (*this);
@@ -475,7 +475,7 @@
{ return other.m_num < m_num; }
const T & dereference() const
- {
+ {
static T dummy;
return dummy;
}
@@ -539,7 +539,7 @@
#endif
-} //namespace container {
+} //namespace container {
} //namespace boost {
#include <boost/container/detail/config_end.hpp>
Modified: branches/release/boost/container/detail/math_functions.hpp
==============================================================================
--- branches/release/boost/container/detail/math_functions.hpp (original)
+++ branches/release/boost/container/detail/math_functions.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -4,7 +4,7 @@
// (C) Copyright Ion Gaztanaga 2007-2012.
//
// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
+// (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.
@@ -94,7 +94,7 @@
std::size_t n = x;
std::size_t log2 = 0;
-
+
for(std::size_t shift = Bits >> 1; shift; shift >>= 1){
std::size_t tmp = n >> shift;
if (tmp)
Modified: branches/release/boost/container/detail/mpl.hpp
==============================================================================
--- branches/release/boost/container/detail/mpl.hpp (original)
+++ branches/release/boost/container/detail/mpl.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -20,7 +20,7 @@
#include <cstddef>
namespace boost {
-namespace container {
+namespace container {
namespace container_detail {
template <class T, T val>
@@ -109,24 +109,24 @@
template <class Pair>
-struct select1st
-// : public std::unary_function<Pair, typename Pair::first_type>
+struct select1st
+// : public std::unary_function<Pair, typename Pair::first_type>
{
template<class OtherPair>
- const typename Pair::first_type& operator()(const OtherPair& x) const
+ const typename Pair::first_type& operator()(const OtherPair& x) const
{ return x.first; }
- const typename Pair::first_type& operator()(const typename Pair::first_type& x) const
+ const typename Pair::first_type& operator()(const typename Pair::first_type& x) const
{ return x; }
};
// identity is an extension: it is not part of the standard.
template <class T>
-struct identity
-// : public std::unary_function<T,T>
+struct identity
+// : public std::unary_function<T,T>
{
typedef T type;
- const T& operator()(const T& x) const
+ const T& operator()(const T& x) const
{ return x; }
};
@@ -152,8 +152,8 @@
template <> struct unvoid<void> { struct type { }; };
template <> struct unvoid<const void> { struct type { }; };
-} //namespace container_detail {
-} //namespace container {
+} //namespace container_detail {
+} //namespace container {
} //namespace boost {
#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
Modified: branches/release/boost/container/detail/node_alloc_holder.hpp
==============================================================================
--- branches/release/boost/container/detail/node_alloc_holder.hpp (original)
+++ branches/release/boost/container/detail/node_alloc_holder.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -189,11 +189,11 @@
public:
//Constructors for sequence containers
- node_alloc_holder()
+ node_alloc_holder()
: members_()
{}
- explicit node_alloc_holder(const ValAlloc &a)
+ explicit node_alloc_holder(const ValAlloc &a)
: members_(a)
{}
@@ -206,7 +206,7 @@
{ this->icont().swap(x.icont()); }
//Constructors for associative containers
- explicit node_alloc_holder(const ValAlloc &a, const Pred &c)
+ explicit node_alloc_holder(const ValAlloc &a, const Pred &c)
: members_(a, c)
{}
@@ -224,7 +224,7 @@
{ this->icont().swap(x.icont()); }
void copy_assign_alloc(const node_alloc_holder &x)
- {
+ {
container_detail::bool_<allocator_traits_type::propagate_on_container_copy_assignment::value> flag;
container_detail::assign_alloc( static_cast<NodeAlloc &>(this->members_)
, static_cast<const NodeAlloc &>(x.members_), flag);
Modified: branches/release/boost/container/detail/node_pool_impl.hpp
==============================================================================
--- branches/release/boost/container/detail/node_pool_impl.hpp (original)
+++ branches/release/boost/container/detail/node_pool_impl.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -86,12 +86,12 @@
void *allocate_node()
{ return priv_alloc_node(); }
-
+
//!Deallocates an array pointed by ptr. Never throws
void deallocate_node(void *ptr)
{ priv_dealloc_node(ptr); }
- //!Allocates a singly linked list of n nodes ending in null pointer.
+ //!Allocates a singly linked list of n nodes ending in null pointer.
multiallocation_chain allocate_nodes(const size_type n)
{
//Preallocate all needed blocks to fulfill the request
@@ -238,7 +238,7 @@
push_in_list(free_nodes_t &l, typename free_nodes_t::iterator &it)
: slist_(l), last_it_(it)
{}
-
+
void operator()(typename free_nodes_t::pointer p) const
{
slist_.push_front(*p);
@@ -258,10 +258,10 @@
is_between(const void *addr, std::size_t size)
: beg_(static_cast<const char *>(addr)), end_(beg_+size)
{}
-
+
bool operator()(typename free_nodes_t::const_reference v) const
{
- return (beg_ <= reinterpret_cast<const char *>(&v) &&
+ return (beg_ <= reinterpret_cast<const char *>(&v) &&
end_ > reinterpret_cast<const char *>(&v));
}
private:
@@ -299,7 +299,7 @@
{
if(!num_blocks)
return;
- size_type blocksize =
+ size_type blocksize =
get_rounded_size(m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value);
try{
@@ -311,7 +311,7 @@
char *pBlock = pNode;
m_blocklist.push_front(get_block_hook(pBlock, blocksize));
- //We initialize all Nodes in Node Block to insert
+ //We initialize all Nodes in Node Block to insert
//them in the free Node list
for(size_type i = 0; i < m_nodes_per_block; ++i, pNode += m_real_node_size){
m_freelist.push_front(*new (pNode) node_t);
@@ -335,13 +335,13 @@
private:
//!Returns a reference to the block hook placed in the end of the block
static node_t & get_block_hook (void *block, size_type blocksize)
- {
- return *reinterpret_cast<node_t*>(reinterpret_cast<char*>(block) + 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, size_type blocksize)
- {
+ {
return (reinterpret_cast<char*>(hook) - blocksize);
}
Modified: branches/release/boost/container/detail/pair.hpp
==============================================================================
--- branches/release/boost/container/detail/pair.hpp (original)
+++ branches/release/boost/container/detail/pair.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -35,7 +35,7 @@
#endif
namespace boost {
-namespace container {
+namespace container {
namespace container_detail {
template <class T1, class T2>
@@ -313,8 +313,8 @@
swap(x.second, y.second);
}
-} //namespace container_detail {
-} //namespace container {
+} //namespace container_detail {
+} //namespace container {
//Without this specialization recursive flat_(multi)map instantiation fails
Modified: branches/release/boost/container/detail/preprocessor.hpp
==============================================================================
--- branches/release/boost/container/detail/preprocessor.hpp (original)
+++ branches/release/boost/container/detail/preprocessor.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -27,7 +27,7 @@
//#error "This file is not needed when perfect forwarding is available"
#endif //BOOST_CONTAINER_PERFECT_FORWARDING
-#include <boost/preprocessor/iteration/local.hpp>
+#include <boost/preprocessor/iteration/local.hpp>
#include <boost/preprocessor/punctuation/paren_if.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/control/expr_if.hpp>
Modified: branches/release/boost/container/detail/transform_iterator.hpp
==============================================================================
--- branches/release/boost/container/detail/transform_iterator.hpp (original)
+++ branches/release/boost/container/detail/transform_iterator.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -24,7 +24,7 @@
#include <iterator>
namespace boost {
-namespace container {
+namespace container {
template <class PseudoReference>
struct operator_arrow_proxy
@@ -74,7 +74,7 @@
{}
//Constructors
- transform_iterator& operator++()
+ transform_iterator& operator++()
{ increment(); return *this; }
transform_iterator operator++(int)
@@ -168,7 +168,7 @@
return transform_iterator<Iterator, UnaryFunc>(it, fun);
}
-} //namespace container {
+} //namespace container {
} //namespace boost {
#include <boost/container/detail/config_end.hpp>
Modified: branches/release/boost/container/detail/tree.hpp
==============================================================================
--- branches/release/boost/container/detail/tree.hpp (original)
+++ branches/release/boost/container/detail/tree.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -45,7 +45,7 @@
: public KeyCompare
{
typedef Value value_type;
- typedef KeyCompare key_compare;
+ typedef KeyCompare key_compare;
typedef KeyOfValue key_of_value;
typedef Key key_type;
@@ -203,13 +203,13 @@
namespace container_detail {
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class KeyCompare, class A>
class rbtree
: protected container_detail::node_alloc_holder
< A
, typename container_detail::intrusive_rbtree_type
- <A, value_compare_impl<Key, Value, KeyCompare, KeyOfValue>
+ <A, value_compare_impl<Key, Value, KeyCompare, KeyOfValue>
>::type
, KeyCompare
>
@@ -218,7 +218,7 @@
< A, value_compare_impl
<Key, Value, KeyCompare, KeyOfValue>
>::type Icont;
- typedef container_detail::node_alloc_holder
+ typedef container_detail::node_alloc_holder
<A, Icont, KeyCompare> AllocHolder;
typedef typename AllocHolder::NodePtr NodePtr;
typedef rbtree < Key, Value, KeyOfValue
@@ -398,17 +398,17 @@
{}
//Pointer like operators
- const_reference operator*() const
+ const_reference operator*() const
{ return m_it->get_data(); }
- const_pointer operator->() const
+ const_pointer operator->() const
{ return const_pointer(&m_it->get_data()); }
//Increment / Decrement
- const_iterator& operator++()
+ const_iterator& operator++()
{ prot_incr(); return *this; }
- const_iterator operator++(int)
+ const_iterator operator++(int)
{ iiterator tmp = m_it; ++*this; return const_iterator(tmp); }
const_iterator& operator--()
@@ -432,7 +432,7 @@
explicit iterator(iiterator it)
: const_iterator(it)
{}
-
+
iiterator get()
{ return this->m_it; }
@@ -451,12 +451,12 @@
{ return boost::intrusive::pointer_traits<pointer>::pointer_to(this->m_it->get_data()); }
//Increment / Decrement
- iterator& operator++()
+ iterator& operator++()
{ this->prot_incr(); return *this; }
iterator operator++(int)
{ iiterator tmp = this->m_it; ++*this; return iterator(tmp); }
-
+
iterator& operator--()
{ this->prot_decr(); return *this; }
@@ -493,18 +493,18 @@
priv_create_and_insert_ordered_nodes(first, last, alloc_version(), ItCat());
}
- rbtree(const rbtree& x)
+ rbtree(const rbtree& x)
: AllocHolder(x, x.key_comp())
{
this->icont().clone_from
(x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
}
- rbtree(BOOST_RV_REF(rbtree) x)
+ rbtree(BOOST_RV_REF(rbtree) x)
: AllocHolder(::boost::move(static_cast<AllocHolder&>(x)), x.key_comp())
{}
- rbtree(const rbtree& x, const allocator_type &a)
+ rbtree(const rbtree& x, const allocator_type &a)
: AllocHolder(a, x.key_comp())
{
this->icont().clone_from
@@ -593,18 +593,18 @@
return *this;
}
- public:
+ public:
// accessors:
- value_compare value_comp() const
+ value_compare value_comp() const
{ return this->icont().value_comp().value_comp(); }
- key_compare key_comp() const
+ key_compare key_comp() const
{ return this->icont().value_comp().value_comp().key_comp(); }
- allocator_type get_allocator() const
+ allocator_type get_allocator() const
{ return allocator_type(this->node_alloc()); }
- const stored_allocator_type &get_stored_allocator() const
+ const stored_allocator_type &get_stored_allocator() const
{ return this->node_alloc(); }
stored_allocator_type &get_stored_allocator()
@@ -635,46 +635,46 @@
{ return this->crend(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return const_iterator(this->non_const_icont().begin()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ const_iterator cend() const
{ return const_iterator(this->non_const_icont().end()); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const
- { return const_reverse_iterator(cend()); }
+ const_reverse_iterator crbegin() const
+ { return const_reverse_iterator(cend()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const
{ return const_reverse_iterator(cbegin()); }
- bool empty() const
+ bool empty() const
{ return !this->size(); }
- size_type size() const
+ size_type size() const
{ return this->icont().size(); }
- size_type max_size() const
+ size_type max_size() const
{ return AllocHolder::max_size(); }
void swap(ThisType& x)
@@ -688,7 +688,7 @@
std::pair<iterator,bool> insert_unique_check
(const key_type& key, insert_commit_data &data)
{
- std::pair<iiterator, bool> ret =
+ std::pair<iiterator, bool> ret =
this->icont().insert_unique_check(key, KeyNodeCompare(value_comp()), data);
return std::pair<iterator, bool>(iterator(ret.first), ret.second);
}
@@ -696,7 +696,7 @@
std::pair<iterator,bool> insert_unique_check
(const_iterator hint, const key_type& key, insert_commit_data &data)
{
- std::pair<iiterator, bool> ret =
+ std::pair<iiterator, bool> ret =
this->icont().insert_unique_check(hint.get(), key, KeyNodeCompare(value_comp()), data);
return std::pair<iterator, bool>(iterator(ret.first), ret.second);
}
@@ -915,7 +915,7 @@
iterator erase(const_iterator first, const_iterator last)
{ return iterator(AllocHolder::erase_range(first.get(), last.get(), alloc_version())); }
- void clear()
+ void clear()
{ AllocHolder::clear(alloc_version()); }
// set operations:
@@ -941,14 +941,14 @@
{ return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(value_comp()))); }
std::pair<iterator,iterator> equal_range(const key_type& k)
- {
+ {
std::pair<iiterator, iiterator> ret =
this->icont().equal_range(k, KeyNodeCompare(value_comp()));
return std::pair<iterator,iterator>(iterator(ret.first), iterator(ret.second));
}
std::pair<const_iterator, const_iterator> equal_range(const key_type& k) const
- {
+ {
std::pair<iiterator, iiterator> ret =
this->non_const_icont().equal_range(k, KeyNodeCompare(value_comp()));
return std::pair<const_iterator,const_iterator>
@@ -1060,63 +1060,63 @@
}
};
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class KeyCompare, class A>
-inline bool
-operator==(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
+inline bool
+operator==(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y)
{
return x.size() == y.size() &&
std::equal(x.begin(), x.end(), y.begin());
}
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class KeyCompare, class A>
-inline bool
-operator<(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
+inline bool
+operator<(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y)
{
- return std::lexicographical_compare(x.begin(), x.end(),
+ return std::lexicographical_compare(x.begin(), x.end(),
y.begin(), y.end());
}
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class KeyCompare, class A>
-inline bool
-operator!=(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
+inline bool
+operator!=(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y) {
return !(x == y);
}
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class KeyCompare, class A>
-inline bool
-operator>(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
+inline bool
+operator>(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y) {
return y < x;
}
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class KeyCompare, class A>
-inline bool
-operator<=(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
+inline bool
+operator<=(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y) {
return !(y < x);
}
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class KeyCompare, class A>
-inline bool
-operator>=(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
+inline bool
+operator>=(const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
const rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y) {
return !(x < y);
}
-template <class Key, class Value, class KeyOfValue,
+template <class Key, class Value, class KeyOfValue,
class KeyCompare, class A>
-inline void
-swap(rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
+inline void
+swap(rbtree<Key,Value,KeyOfValue,KeyCompare,A>& x,
rbtree<Key,Value,KeyOfValue,KeyCompare,A>& y)
{
x.swap(y);
@@ -1127,7 +1127,7 @@
/*
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
-template <class K, class V, class KOV,
+template <class K, class V, class KOV,
class C, class A>
struct has_trivial_destructor_after_move
<boost::container::container_detail::rbtree<K, V, KOV, C, A> >
Modified: branches/release/boost/container/detail/type_traits.hpp
==============================================================================
--- branches/release/boost/container/detail/type_traits.hpp (original)
+++ branches/release/boost/container/detail/type_traits.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -24,7 +24,7 @@
#include <boost/move/move.hpp>
namespace boost {
-namespace container {
+namespace container {
namespace container_detail {
struct nat{};
@@ -202,7 +202,7 @@
};
} // namespace container_detail
-} //namespace container {
+} //namespace container {
} //namespace boost {
#include <boost/container/detail/config_end.hpp>
Modified: branches/release/boost/container/detail/utilities.hpp
==============================================================================
--- branches/release/boost/container/detail/utilities.hpp (original)
+++ branches/release/boost/container/detail/utilities.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -150,7 +150,7 @@
&& !::boost::is_fundamental<_TypeT>::value
};
-};
+};
*/
template<class T>
@@ -233,7 +233,7 @@
template
<typename A,
typename F, // F models ForwardIterator
- typename T>
+ typename T>
void uninitialized_fill_alloc(A &a, F f, F l, const T &t)
{
while (f != l) {
Modified: branches/release/boost/container/detail/value_init.hpp
==============================================================================
--- branches/release/boost/container/detail/value_init.hpp (original)
+++ branches/release/boost/container/detail/value_init.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -21,7 +21,7 @@
#include <boost/container/detail/workaround.hpp>
namespace boost {
-namespace container {
+namespace container {
namespace container_detail {
template<class T>
@@ -36,8 +36,8 @@
T m_t;
};
-} //namespace container_detail {
-} //namespace container {
+} //namespace container_detail {
+} //namespace container {
} //namespace boost {
#include <boost/container/detail/config_end.hpp>
Modified: branches/release/boost/container/detail/variadic_templates_tools.hpp
==============================================================================
--- branches/release/boost/container/detail/variadic_templates_tools.hpp (original)
+++ branches/release/boost/container/detail/variadic_templates_tools.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -21,7 +21,7 @@
#include <cstddef> //std::size_t
namespace boost {
-namespace container {
+namespace container {
namespace container_detail {
template<typename... Values>
@@ -136,7 +136,7 @@
template<std::size_t Num, typename Tuple = index_tuple<> >
struct build_number_seq;
-template<std::size_t Num, int... Indexes>
+template<std::size_t Num, int... Indexes>
struct build_number_seq<Num, index_tuple<Indexes...> >
: build_number_seq<Num - 1, index_tuple<Indexes..., sizeof...(Indexes)> >
{};
Modified: branches/release/boost/container/detail/version_type.hpp
==============================================================================
--- branches/release/boost/container/detail/version_type.hpp (original)
+++ branches/release/boost/container/detail/version_type.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -38,7 +38,7 @@
namespace impl{
-template <class T,
+template <class T,
bool = container_detail::is_convertible<version_type<T, 0>, typename T::version>::value>
struct extract_version
{
Modified: branches/release/boost/container/flat_map.hpp
==============================================================================
--- branches/release/boost/container/flat_map.hpp (original)
+++ branches/release/boost/container/flat_map.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -47,11 +47,11 @@
class flat_map;
template <class Key, class T, class Pred, class A>
-inline bool operator==(const flat_map<Key,T,Pred,A>& x,
+inline bool operator==(const flat_map<Key,T,Pred,A>& x,
const flat_map<Key,T,Pred,A>& y);
template <class Key, class T, class Pred, class A>
-inline bool operator<(const flat_map<Key,T,Pred,A>& x,
+inline bool operator<(const flat_map<Key,T,Pred,A>& x,
const flat_map<Key,T,Pred,A>& y);
namespace container_detail{
@@ -73,12 +73,12 @@
/// @endcond
//! A flat_map is a kind of associative container that supports unique keys (contains at
-//! most one of each key value) and provides for fast retrieval of values of another
+//! most one of each key value) and provides for fast retrieval of values of another
//! type T based on the keys. The flat_map class supports random-access iterators.
-//!
-//! A flat_map satisfies all of the requirements of a container and of a reversible
-//! container and of an associative container. A flat_map also provides
-//! most operations described for unique keys. For a
+//!
+//! A flat_map satisfies all of the requirements of a container and of a reversible
+//! container and of an associative container. A flat_map also provides
+//! most operations described for unique keys. For a
//! flat_map<Key,T> the key_type is Key and the value_type is std::pair<Key,T>
//! (unlike std::map<Key, T> which value_type is std::pair<<b>const</b> Key, T>).
//!
@@ -86,35 +86,35 @@
//!
//! A is the allocator to allocate the value_types
//! (e.g. <i>allocator< std::pair<Key, T> ></i>).
-//!
+//!
//! flat_map is similar to std::map but it's implemented like an ordered vector.
//! This means that inserting a new element into a flat_map invalidates
//! previous iterators and references
//!
-//! Erasing an element of a flat_map invalidates iterators and references
+//! Erasing an element of a flat_map invalidates iterators and references
//! pointing to elements that come after (their keys are bigger) the erased element.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class Key, class T, class Pred = std::less< std::pair< Key, T> >, class A = std::allocator<T> >
#else
template <class Key, class T, class Pred, class A>
#endif
-class flat_map
+class flat_map
{
/// @cond
private:
BOOST_COPYABLE_AND_MOVABLE(flat_map)
//This is the tree that we should store if pair was movable
- typedef container_detail::flat_tree<Key,
- std::pair<Key, T>,
- container_detail::select1st< std::pair<Key, T> >,
- Pred,
+ typedef container_detail::flat_tree<Key,
+ std::pair<Key, T>,
+ container_detail::select1st< std::pair<Key, T> >,
+ Pred,
A> tree_t;
//This is the real tree stored here. It's based on a movable pair
- typedef container_detail::flat_tree<Key,
- container_detail::pair<Key, T>,
- container_detail::select1st<container_detail::pair<Key, T> >,
- Pred,
+ typedef container_detail::flat_tree<Key,
+ container_detail::pair<Key, T>,
+ container_detail::select1st<container_detail::pair<Key, T> >,
+ Pred,
typename allocator_traits<A>::template portable_rebind_alloc
<container_detail::pair<Key, T> >::type> impl_tree_t;
impl_tree_t m_flat_tree; // flat tree representing flat_map
@@ -165,7 +165,7 @@
get_flat_tree_iterators
<pointer>::const_reverse_iterator const_reverse_iterator;
typedef A allocator_type;
-
+
//!Standard extension
typedef A stored_allocator_type;
@@ -174,61 +174,63 @@
public:
//! <b>Effects</b>: Default constructs an empty flat_map.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- flat_map()
+ flat_map()
: m_flat_tree() {}
//! <b>Effects</b>: Constructs an empty flat_map using the specified
//! comparison object and allocator.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- explicit flat_map(const Pred& comp, const allocator_type& a = allocator_type())
+ explicit flat_map(const Pred& comp, const allocator_type& a = allocator_type())
: m_flat_tree(comp, container_detail::force<impl_allocator_type>(a)) {}
- //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and
+ //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and
//! allocator, and inserts elements from the range [first ,last ).
- //!
- //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
+ //!
+ //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first.
template <class InputIterator>
flat_map(InputIterator first, InputIterator last, const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
- : m_flat_tree(comp, container_detail::force<impl_allocator_type>(a))
+ : m_flat_tree(comp, container_detail::force<impl_allocator_type>(a))
{ m_flat_tree.insert_unique(first, last); }
- //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and
+ //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and
//! allocator, and inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
- //!
+ //!
//! <b>Complexity</b>: Linear in N.
+ //!
+ //! <b>Note</b>: Non-standard extension.
template <class InputIterator>
flat_map( ordered_unique_range_t, InputIterator first, InputIterator last
, const Pred& comp = Pred(), const allocator_type& a = allocator_type())
- : m_flat_tree(ordered_range, first, last, comp, a)
+ : m_flat_tree(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Copy constructs a flat_map.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- flat_map(const flat_map& x)
+ flat_map(const flat_map& x)
: m_flat_tree(x.m_flat_tree) {}
//! <b>Effects</b>: Move constructs a flat_map.
//! Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Postcondition</b>: x is emptied.
- flat_map(BOOST_RV_REF(flat_map) x)
+ flat_map(BOOST_RV_REF(flat_map) x)
: m_flat_tree(boost::move(x.m_flat_tree))
{}
//! <b>Effects</b>: Copy constructs a flat_map using the specified allocator.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
flat_map(const flat_map& x, const allocator_type &a)
: m_flat_tree(x.m_flat_tree, a)
@@ -236,194 +238,194 @@
//! <b>Effects</b>: Move constructs a flat_map using the specified allocator.
//! Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Constant if x.get_allocator() == a, linear otherwise.
- flat_map(BOOST_RV_REF(flat_map) x, const allocator_type &a)
+ flat_map(BOOST_RV_REF(flat_map) x, const allocator_type &a)
: m_flat_tree(boost::move(x.m_flat_tree), a)
{}
//! <b>Effects</b>: Makes *this a copy of x.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
flat_map& 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.
//! Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Construct.
- //!
+ //!
//! <b>Postcondition</b>: x is emptied.
flat_map& 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.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- key_compare key_comp() const
+ key_compare key_comp() const
{ return container_detail::force<key_compare>(m_flat_tree.key_comp()); }
//! <b>Effects</b>: Returns an object of value_compare constructed out
//! of the comparison object.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- value_compare value_comp() const
+ value_compare value_comp() const
{ return value_compare(container_detail::force<key_compare>(m_flat_tree.key_comp())); }
//! <b>Effects</b>: Returns a copy of the Allocator that
//! was passed to the object's constructor.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- allocator_type get_allocator() const
+ allocator_type get_allocator() const
{ return container_detail::force<allocator_type>(m_flat_tree.get_allocator()); }
- const stored_allocator_type &get_stored_allocator() const
+ const stored_allocator_type &get_stored_allocator() const
{ return container_detail::force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
stored_allocator_type &get_stored_allocator()
{ return container_detail::force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator begin()
+ iterator begin()
{ return container_detail::force_copy<iterator>(m_flat_tree.begin()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const
{ return container_detail::force<const_iterator>(m_flat_tree.begin()); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator end()
+ iterator end()
{ return container_detail::force_copy<iterator>(m_flat_tree.end()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator end() const
+ const_iterator end() const
{ return container_detail::force<const_iterator>(m_flat_tree.end()); }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rbegin()
+ reverse_iterator rbegin()
{ return container_detail::force<reverse_iterator>(m_flat_tree.rbegin()); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const
+ const_reverse_iterator rbegin() const
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.rbegin()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rend()
+ reverse_iterator rend()
{ return container_detail::force<reverse_iterator>(m_flat_tree.rend()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const
+ const_reverse_iterator rend() const
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.rend()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return container_detail::force<const_iterator>(m_flat_tree.cbegin()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ const_iterator cend() const
{ return container_detail::force<const_iterator>(m_flat_tree.cend()); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const
+ const_reverse_iterator crbegin() const
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.crbegin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.crend()); }
//! <b>Effects</b>: Returns true if the container contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- bool empty() const
+ bool empty() const
{ return m_flat_tree.empty(); }
//! <b>Effects</b>: Returns the number of the elements contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const
{ return m_flat_tree.size(); }
//! <b>Effects</b>: Returns the largest possible size of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type max_size() const
+ size_type max_size() const
{ return m_flat_tree.max_size(); }
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
- //! Effects: If there is no key equivalent to x in the flat_map, inserts
+ //! Effects: If there is no key equivalent to x in the flat_map, inserts
//! value_type(x, T()) into the flat_map.
- //!
+ //!
//! Returns: A reference to the mapped_type corresponding to x in *this.
- //!
+ //!
//! Complexity: Logarithmic.
mapped_type &operator[](const key_type& k);
- //! Effects: If there is no key equivalent to x in the flat_map, inserts
+ //! Effects: If there is no key equivalent to x in the flat_map, inserts
//! value_type(move(x), T()) into the flat_map (the key is move-constructed)
- //!
+ //!
//! Returns: A reference to the mapped_type corresponding to x in *this.
- //!
+ //!
//! Complexity: Logarithmic.
mapped_type &operator[](key_type &&k) ;
@@ -463,10 +465,10 @@
void swap(flat_map& x)
{ m_flat_tree.swap(x.m_flat_tree); }
- //! <b>Effects</b>: Inserts x if and only if there is no element in the container
+ //! <b>Effects</b>: Inserts x if and only if there is no element in the container
//! with key equivalent to the key of x.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
@@ -474,14 +476,14 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- std::pair<iterator,bool> insert(const value_type& x)
+ std::pair<iterator,bool> insert(const value_type& x)
{ return container_detail::force<std::pair<iterator,bool> >(
m_flat_tree.insert_unique(container_detail::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.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
@@ -489,14 +491,14 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
+ std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
{ return container_detail::force<std::pair<iterator,bool> >(
m_flat_tree.insert_unique(boost::move(container_detail::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.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
@@ -504,13 +506,13 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- std::pair<iterator,bool> insert(BOOST_RV_REF(movable_value_type) x)
+ std::pair<iterator,bool> insert(BOOST_RV_REF(movable_value_type) x)
{
return container_detail::force<std::pair<iterator,bool> >
(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
+ //! <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.
//! p is a hint pointing to where the insert should start to search.
//!
@@ -558,7 +560,7 @@
//! <b>Requires</b>: first, last are not iterators into *this.
//!
- //! <b>Effects</b>: inserts each element from the range [first,last) if and only
+ //! <b>Effects</b>: inserts each element from the range [first,last) if and only
//! if there is no element with key equivalent to the key of that element.
//!
//! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
@@ -566,16 +568,33 @@
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class InputIterator>
- void insert(InputIterator first, InputIterator last)
+ void insert(InputIterator first, InputIterator last)
{ m_flat_tree.insert_unique(first, last); }
+ //! <b>Requires</b>: first, last are not iterators into *this.
+ //!
+ //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
+ //! unique values.
+ //!
+ //! <b>Effects</b>: inserts each element from the range [first,last) if and only
+ //! if there is no element with key equivalent to the key of that element. This
+ //! function is more efficient than the normal range creation for ordered ranges.
+ //!
+ //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
+ //! search time plus N*size() insertion time.
+ //!
+ //! <b>Note</b>: If an element is inserted it might invalidate elements.
+ template <class InputIterator>
+ void insert(ordered_unique_range_t, InputIterator first, InputIterator last)
+ { m_flat_tree.insert_unique(ordered_unique_range, first, last); }
+
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object x of type T constructed with
- //! std::forward<Args>(args)... if and only if there is no element in the container
+ //! std::forward<Args>(args)... if and only if there is no element in the container
//! with key equivalent to the key of x.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
@@ -588,7 +607,7 @@
{ return container_detail::force_copy< std::pair<iterator, bool> >(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
+ //! std::forward<Args>(args)... in the container if and only if there is
//! no element in the container with key equivalent to the key of x.
//! p is a hint pointing to where the insert should start to search.
//!
@@ -627,14 +646,14 @@
//! <b>Effects</b>: Erases the element pointed to by position.
//!
//! <b>Returns</b>: Returns an iterator pointing to the element immediately
- //! following q prior to the element being erased. If no such element exists,
+ //! following q prior to the element being erased. If no such element exists,
//! returns end().
//!
//! <b>Complexity</b>: Linear to the elements with keys bigger than position
//!
//! <b>Note</b>: Invalidates elements with keys
//! not less than the erased element.
- iterator erase(const_iterator position)
+ iterator erase(const_iterator position)
{ return container_detail::force_copy<iterator>(m_flat_tree.erase(container_detail::force<impl_const_iterator>(position))); }
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
@@ -643,7 +662,7 @@
//!
//! <b>Complexity</b>: Logarithmic search time plus erasure time
//! linear to the elements with bigger keys.
- size_type erase(const key_type& x)
+ size_type erase(const key_type& x)
{ return m_flat_tree.erase(x); }
//! <b>Effects</b>: Erases all the elements in the range [first, last).
@@ -663,7 +682,7 @@
//! <b>Postcondition</b>: size() == 0.
//!
//! <b>Complexity</b>: linear in size().
- void clear()
+ void clear()
{ m_flat_tree.clear(); }
//! <b>Effects</b>: Tries to deallocate the excess of memory created
@@ -679,81 +698,81 @@
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator find(const key_type& x)
+ iterator find(const key_type& x)
{ return container_detail::force_copy<iterator>(m_flat_tree.find(x)); }
//! <b>Returns</b>: A const_iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.s
- const_iterator find(const key_type& x) const
+ const_iterator find(const key_type& x) const
{ return container_detail::force<const_iterator>(m_flat_tree.find(x)); }
//! <b>Returns</b>: The number of elements with key equivalent to x.
//!
//! <b>Complexity</b>: log(size())+count(k)
- size_type count(const key_type& x) const
+ size_type count(const key_type& x) const
{ return m_flat_tree.find(x) == m_flat_tree.end() ? 0 : 1; }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- iterator lower_bound(const key_type& x)
+ iterator lower_bound(const key_type& x)
{ return container_detail::force_copy<iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator lower_bound(const key_type& x) const
+ const_iterator lower_bound(const key_type& x) const
{ return container_detail::force<const_iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- iterator upper_bound(const key_type& x)
+ iterator upper_bound(const key_type& x)
{ return container_detail::force_copy<iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator upper_bound(const key_type& x) const
+ const_iterator upper_bound(const key_type& x) const
{ return container_detail::force<const_iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<iterator,iterator> equal_range(const key_type& x)
+ std::pair<iterator,iterator> equal_range(const key_type& x)
{ return container_detail::force_copy<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const
+ std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const
{ return container_detail::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
//! <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
+ size_type capacity() const
{ return m_flat_tree.capacity(); }
//! <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 or T's copy constructor throws.
//!
//! <b>Note</b>: If capacity() is less than "count", iterators and references to
//! to values might be invalidated.
- void reserve(size_type count)
+ void reserve(size_type count)
{ m_flat_tree.reserve(count); }
/// @cond
@@ -775,7 +794,7 @@
}
return (*i).second;
}
- mapped_type &priv_subscript(BOOST_RV_REF(key_type) mk)
+ mapped_type &priv_subscript(BOOST_RV_REF(key_type) mk)
{
key_type &k = mk;
iterator i = lower_bound(k);
@@ -790,38 +809,38 @@
};
template <class Key, class T, class Pred, class A>
-inline bool operator==(const flat_map<Key,T,Pred,A>& x,
- const flat_map<Key,T,Pred,A>& y)
+inline bool operator==(const flat_map<Key,T,Pred,A>& x,
+ const flat_map<Key,T,Pred,A>& y)
{ return x.m_flat_tree == y.m_flat_tree; }
template <class Key, class T, class Pred, class A>
-inline bool operator<(const flat_map<Key,T,Pred,A>& x,
- const flat_map<Key,T,Pred,A>& y)
+inline bool operator<(const flat_map<Key,T,Pred,A>& x,
+ const flat_map<Key,T,Pred,A>& y)
{ return x.m_flat_tree < y.m_flat_tree; }
template <class Key, class T, class Pred, class A>
-inline bool operator!=(const flat_map<Key,T,Pred,A>& x,
- const flat_map<Key,T,Pred,A>& y)
+inline bool operator!=(const flat_map<Key,T,Pred,A>& x,
+ const flat_map<Key,T,Pred,A>& y)
{ return !(x == y); }
template <class Key, class T, class Pred, class A>
-inline bool operator>(const flat_map<Key,T,Pred,A>& x,
- const flat_map<Key,T,Pred,A>& y)
+inline bool operator>(const flat_map<Key,T,Pred,A>& x,
+ const flat_map<Key,T,Pred,A>& y)
{ return y < x; }
template <class Key, class T, class Pred, class A>
-inline bool operator<=(const flat_map<Key,T,Pred,A>& x,
- const flat_map<Key,T,Pred,A>& y)
+inline bool operator<=(const flat_map<Key,T,Pred,A>& x,
+ const flat_map<Key,T,Pred,A>& y)
{ return !(y < x); }
template <class Key, class T, class Pred, class A>
-inline bool operator>=(const flat_map<Key,T,Pred,A>& x,
- const flat_map<Key,T,Pred,A>& y)
+inline bool operator>=(const flat_map<Key,T,Pred,A>& x,
+ const flat_map<Key,T,Pred,A>& y)
{ return !(x < y); }
template <class Key, class T, class Pred, class A>
-inline void swap(flat_map<Key,T,Pred,A>& x,
- flat_map<Key,T,Pred,A>& y)
+inline void swap(flat_map<Key,T,Pred,A>& x,
+ flat_map<Key,T,Pred,A>& y)
{ x.swap(y); }
/// @cond
@@ -847,21 +866,21 @@
class flat_multimap;
template <class Key, class T, class Pred, class A>
-inline bool operator==(const flat_multimap<Key,T,Pred,A>& x,
+inline bool operator==(const flat_multimap<Key,T,Pred,A>& x,
const flat_multimap<Key,T,Pred,A>& y);
template <class Key, class T, class Pred, class A>
-inline bool operator<(const flat_multimap<Key,T,Pred,A>& x,
+inline bool operator<(const flat_multimap<Key,T,Pred,A>& x,
const flat_multimap<Key,T,Pred,A>& y);
/// @endcond
-//! A flat_multimap is a kind of associative container that supports equivalent keys
-//! (possibly containing multiple copies of the same key value) and provides for
-//! fast retrieval of values of another type T based on the keys. The flat_multimap
+//! A flat_multimap is a kind of associative container that supports equivalent keys
+//! (possibly containing multiple copies of the same key value) and provides for
+//! fast retrieval of values of another type T based on the keys. The flat_multimap
//! class supports random-access iterators.
-//!
-//! A flat_multimap satisfies all of the requirements of a container and of a reversible
-//! container and of an associative container. For a
+//!
+//! A flat_multimap satisfies all of the requirements of a container and of a reversible
+//! container and of an associative container. For a
//! flat_multimap<Key,T> the key_type is Key and the value_type is std::pair<Key,T>
//! (unlike std::multimap<Key, T> which value_type is std::pair<<b>const</b> Key, T>).
//!
@@ -874,21 +893,21 @@
#else
template <class Key, class T, class Pred, class A>
#endif
-class flat_multimap
+class flat_multimap
{
/// @cond
private:
BOOST_COPYABLE_AND_MOVABLE(flat_multimap)
- typedef container_detail::flat_tree<Key,
- std::pair<Key, T>,
- container_detail::select1st< std::pair<Key, T> >,
- Pred,
+ typedef container_detail::flat_tree<Key,
+ std::pair<Key, T>,
+ container_detail::select1st< std::pair<Key, T> >,
+ Pred,
A> tree_t;
//This is the real tree stored here. It's based on a movable pair
- typedef container_detail::flat_tree<Key,
- container_detail::pair<Key, T>,
- container_detail::select1st<container_detail::pair<Key, T> >,
- Pred,
+ typedef container_detail::flat_tree<Key,
+ container_detail::pair<Key, T>,
+ container_detail::select1st<container_detail::pair<Key, T> >,
+ Pred,
typename allocator_traits<A>::template portable_rebind_alloc
<container_detail::pair<Key, T> >::type> impl_tree_t;
impl_tree_t m_flat_tree; // flat tree representing flat_map
@@ -943,14 +962,14 @@
typedef impl_value_type movable_value_type;
//! <b>Effects</b>: Default constructs an empty flat_map.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- flat_multimap()
+ flat_multimap()
: m_flat_tree() {}
//! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison
//! object and allocator.
- //!
+ //!
//! <b>Complexity</b>: Constant.
explicit flat_multimap(const Pred& comp,
const allocator_type& a = allocator_type())
@@ -958,49 +977,51 @@
//! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object
//! and allocator, and inserts elements from the range [first ,last ).
- //!
- //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
+ //!
+ //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first.
template <class InputIterator>
flat_multimap(InputIterator first, InputIterator last,
const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
- : m_flat_tree(comp, container_detail::force<impl_allocator_type>(a))
+ : m_flat_tree(comp, container_detail::force<impl_allocator_type>(a))
{ m_flat_tree.insert_equal(first, last); }
- //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object and
+ //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object and
//! allocator, and inserts elements from the ordered range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
- //!
+ //!
//! <b>Complexity</b>: Linear in N.
+ //!
+ //! <b>Note</b>: Non-standard extension.
template <class InputIterator>
flat_multimap(ordered_range_t, InputIterator first, InputIterator last,
const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
- : m_flat_tree(ordered_range, first, last, comp, a)
+ : m_flat_tree(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Copy constructs a flat_multimap.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- flat_multimap(const flat_multimap& x)
+ flat_multimap(const flat_multimap& x)
: m_flat_tree(x.m_flat_tree) { }
//! <b>Effects</b>: Move constructs a flat_multimap. Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Postcondition</b>: x is emptied.
- flat_multimap(BOOST_RV_REF(flat_multimap) x)
+ flat_multimap(BOOST_RV_REF(flat_multimap) x)
: m_flat_tree(boost::move(x.m_flat_tree))
{ }
//! <b>Effects</b>: Copy constructs a flat_multimap using the specified allocator.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- flat_multimap(const flat_multimap& x, const allocator_type &a)
+ flat_multimap(const flat_multimap& x, const allocator_type &a)
: m_flat_tree(x.m_flat_tree, a)
{}
@@ -1008,173 +1029,173 @@
//! Constructs *this using x's resources.
//!
//! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
- flat_multimap(BOOST_RV_REF(flat_multimap) x, const allocator_type &a)
+ flat_multimap(BOOST_RV_REF(flat_multimap) x, const allocator_type &a)
: m_flat_tree(boost::move(x.m_flat_tree), a)
{ }
//! <b>Effects</b>: Makes *this a copy of x.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- flat_multimap& operator=(BOOST_COPY_ASSIGN_REF(flat_multimap) x)
+ flat_multimap& 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& operator=(BOOST_RV_REF(flat_multimap) mx)
+ flat_multimap& 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.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- key_compare key_comp() const
+ key_compare key_comp() const
{ return container_detail::force<key_compare>(m_flat_tree.key_comp()); }
//! <b>Effects</b>: Returns an object of value_compare constructed out
//! of the comparison object.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- value_compare value_comp() const
+ value_compare value_comp() const
{ return value_compare(container_detail::force<key_compare>(m_flat_tree.key_comp())); }
//! <b>Effects</b>: Returns a copy of the Allocator that
//! was passed to the object's constructor.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- allocator_type get_allocator() const
+ allocator_type get_allocator() const
{ return container_detail::force<allocator_type>(m_flat_tree.get_allocator()); }
- const stored_allocator_type &get_stored_allocator() const
+ const stored_allocator_type &get_stored_allocator() const
{ return container_detail::force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
stored_allocator_type &get_stored_allocator()
{ return container_detail::force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator begin()
+ iterator begin()
{ return container_detail::force_copy<iterator>(m_flat_tree.begin()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const
{ return container_detail::force<const_iterator>(m_flat_tree.begin()); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator end()
+ iterator end()
{ return container_detail::force_copy<iterator>(m_flat_tree.end()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator end() const
+ const_iterator end() const
{ return container_detail::force<const_iterator>(m_flat_tree.end()); }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rbegin()
+ reverse_iterator rbegin()
{ return container_detail::force<reverse_iterator>(m_flat_tree.rbegin()); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const
+ const_reverse_iterator rbegin() const
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.rbegin()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rend()
+ reverse_iterator rend()
{ return container_detail::force<reverse_iterator>(m_flat_tree.rend()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const
+ const_reverse_iterator rend() const
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.rend()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return container_detail::force<const_iterator>(m_flat_tree.cbegin()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ const_iterator cend() const
{ return container_detail::force<const_iterator>(m_flat_tree.cend()); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const
+ const_reverse_iterator crbegin() const
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.crbegin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const
{ return container_detail::force<const_reverse_iterator>(m_flat_tree.crend()); }
//! <b>Effects</b>: Returns true if the container contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- bool empty() const
+ bool empty() const
{ return m_flat_tree.empty(); }
//! <b>Effects</b>: Returns the number of the elements contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const
{ return m_flat_tree.size(); }
//! <b>Effects</b>: Returns the largest possible size of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type max_size() const
+ size_type max_size() const
{ return m_flat_tree.max_size(); }
//! <b>Effects</b>: Swaps the contents of *this and x.
@@ -1186,33 +1207,33 @@
{ m_flat_tree.swap(x.m_flat_tree); }
//! <b>Effects</b>: Inserts x and returns the iterator pointing to the
- //! newly inserted element.
+ //! newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- iterator insert(const value_type& x)
+ iterator insert(const value_type& x)
{ return container_detail::force_copy<iterator>(m_flat_tree.insert_equal(container_detail::force<impl_value_type>(x))); }
- //! <b>Effects</b>: Inserts a new value move-constructed from x and returns
- //! the iterator pointing to the newly inserted element.
+ //! <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 search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- iterator insert(BOOST_RV_REF(value_type) x)
+ iterator insert(BOOST_RV_REF(value_type) x)
{ return container_detail::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.
+ //! <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 search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- iterator insert(BOOST_RV_REF(impl_value_type) x)
+ iterator insert(BOOST_RV_REF(impl_value_type) x)
{ return container_detail::force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); }
//! <b>Effects</b>: Inserts a copy of x in the container.
@@ -1226,7 +1247,7 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- iterator insert(const_iterator position, const value_type& x)
+ iterator insert(const_iterator position, const value_type& x)
{ return container_detail::force_copy<iterator>
(m_flat_tree.insert_equal(container_detail::force<impl_const_iterator>(position), container_detail::force<impl_value_type>(x))); }
@@ -1241,7 +1262,7 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
+ iterator insert(const_iterator position, BOOST_RV_REF(value_type) x)
{
return container_detail::force_copy<iterator>
(m_flat_tree.insert_equal(container_detail::force<impl_const_iterator>(position)
@@ -1259,7 +1280,7 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x)
+ iterator insert(const_iterator position, BOOST_RV_REF(impl_value_type) x)
{
return container_detail::force_copy<iterator>(
m_flat_tree.insert_equal(container_detail::force<impl_const_iterator>(position), boost::move(x)));
@@ -1274,14 +1295,30 @@
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class InputIterator>
- void insert(InputIterator first, InputIterator last)
+ void insert(InputIterator first, InputIterator last)
{ m_flat_tree.insert_equal(first, last); }
+ //! <b>Requires</b>: first, last are not iterators into *this.
+ //!
+ //! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
+ //!
+ //! <b>Effects</b>: inserts each element from the range [first,last) if and only
+ //! if there is no element with key equivalent to the key of that element. This
+ //! function is more efficient than the normal range creation for ordered ranges.
+ //!
+ //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
+ //! search time plus N*size() insertion time.
+ //!
+ //! <b>Note</b>: If an element is inserted it might invalidate elements.
+ template <class InputIterator>
+ void insert(ordered_range_t, InputIterator first, InputIterator last)
+ { m_flat_tree.insert_equal(ordered_range, first, last); }
+
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... and returns the iterator pointing to the
- //! newly inserted element.
+ //! newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
@@ -1333,14 +1370,14 @@
//! <b>Effects</b>: Erases the element pointed to by position.
//!
//! <b>Returns</b>: Returns an iterator pointing to the element immediately
- //! following q prior to the element being erased. If no such element exists,
+ //! following q prior to the element being erased. If no such element exists,
//! returns end().
//!
//! <b>Complexity</b>: Linear to the elements with keys bigger than position
//!
//! <b>Note</b>: Invalidates elements with keys
//! not less than the erased element.
- iterator erase(const_iterator position)
+ iterator erase(const_iterator position)
{ return container_detail::force_copy<iterator>(m_flat_tree.erase(container_detail::force<impl_const_iterator>(position))); }
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
@@ -1349,7 +1386,7 @@
//!
//! <b>Complexity</b>: Logarithmic search time plus erasure time
//! linear to the elements with bigger keys.
- size_type erase(const key_type& x)
+ size_type erase(const key_type& x)
{ return m_flat_tree.erase(x); }
//! <b>Effects</b>: Erases all the elements in the range [first, last).
@@ -1369,7 +1406,7 @@
//! <b>Postcondition</b>: size() == 0.
//!
//! <b>Complexity</b>: linear in size().
- void clear()
+ void clear()
{ m_flat_tree.clear(); }
//! <b>Effects</b>: Tries to deallocate the excess of memory created
@@ -1392,75 +1429,75 @@
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- const_iterator find(const key_type& x) const
+ const_iterator find(const key_type& x) const
{ return container_detail::force<const_iterator>(m_flat_tree.find(x)); }
//! <b>Returns</b>: The number of elements with key equivalent to x.
//!
//! <b>Complexity</b>: log(size())+count(k)
- size_type count(const key_type& x) const
+ size_type count(const key_type& x) const
{ return m_flat_tree.count(x); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- iterator lower_bound(const key_type& x)
+ iterator lower_bound(const key_type& x)
{return container_detail::force_copy<iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Returns</b>: A const iterator pointing to the first element with key
//! not less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator lower_bound(const key_type& x) const
+ const_iterator lower_bound(const key_type& x) const
{ return container_detail::force<const_iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- iterator upper_bound(const key_type& x)
+ iterator upper_bound(const key_type& x)
{return container_detail::force_copy<iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Returns</b>: A const iterator pointing to the first element with key
//! not less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator upper_bound(const key_type& x) const
+ const_iterator upper_bound(const key_type& x) const
{ return container_detail::force<const_iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<iterator,iterator> equal_range(const key_type& x)
+ std::pair<iterator,iterator> equal_range(const key_type& x)
{ return container_detail::force<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<const_iterator,const_iterator>
- equal_range(const key_type& x) const
+ std::pair<const_iterator,const_iterator>
+ equal_range(const key_type& x) const
{ return container_detail::force<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
//! <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
+ size_type capacity() const
{ return m_flat_tree.capacity(); }
//! <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 or T's copy constructor throws.
//!
//! <b>Note</b>: If capacity() is less than "count", iterators and references to
//! to values might be invalidated.
- void reserve(size_type count)
+ void reserve(size_type count)
{ m_flat_tree.reserve(count); }
/// @cond
@@ -1475,37 +1512,37 @@
};
template <class Key, class T, class Pred, class A>
-inline bool operator==(const flat_multimap<Key,T,Pred,A>& x,
- const flat_multimap<Key,T,Pred,A>& y)
+inline bool operator==(const flat_multimap<Key,T,Pred,A>& x,
+ const flat_multimap<Key,T,Pred,A>& y)
{ return x.m_flat_tree == y.m_flat_tree; }
template <class Key, class T, class Pred, class A>
-inline bool operator<(const flat_multimap<Key,T,Pred,A>& x,
- const flat_multimap<Key,T,Pred,A>& y)
+inline bool operator<(const flat_multimap<Key,T,Pred,A>& x,
+ const flat_multimap<Key,T,Pred,A>& y)
{ return x.m_flat_tree < y.m_flat_tree; }
template <class Key, class T, class Pred, class A>
-inline bool operator!=(const flat_multimap<Key,T,Pred,A>& x,
- const flat_multimap<Key,T,Pred,A>& y)
+inline bool operator!=(const flat_multimap<Key,T,Pred,A>& x,
+ const flat_multimap<Key,T,Pred,A>& y)
{ return !(x == y); }
template <class Key, class T, class Pred, class A>
-inline bool operator>(const flat_multimap<Key,T,Pred,A>& x,
- const flat_multimap<Key,T,Pred,A>& y)
+inline bool operator>(const flat_multimap<Key,T,Pred,A>& x,
+ const flat_multimap<Key,T,Pred,A>& y)
{ return y < x; }
template <class Key, class T, class Pred, class A>
-inline bool operator<=(const flat_multimap<Key,T,Pred,A>& x,
- const flat_multimap<Key,T,Pred,A>& y)
+inline bool operator<=(const flat_multimap<Key,T,Pred,A>& x,
+ const flat_multimap<Key,T,Pred,A>& y)
{ return !(y < x); }
template <class Key, class T, class Pred, class A>
-inline bool operator>=(const flat_multimap<Key,T,Pred,A>& x,
- const flat_multimap<Key,T,Pred,A>& y)
+inline bool operator>=(const flat_multimap<Key,T,Pred,A>& x,
+ const flat_multimap<Key,T,Pred,A>& y)
{ return !(x < y); }
template <class Key, class T, class Pred, class A>
-inline void swap(flat_multimap<Key,T,Pred,A>& x, flat_multimap<Key,T,Pred,A>& y)
+inline void swap(flat_multimap<Key,T,Pred,A>& x, flat_multimap<Key,T,Pred,A>& y)
{ x.swap(y); }
}}
@@ -1522,7 +1559,7 @@
static const bool value = has_trivial_destructor<A>::value && has_trivial_destructor<C>::value;
};
*/
-} //namespace boost {
+} //namespace boost {
/// @endcond
Modified: branches/release/boost/container/flat_set.hpp
==============================================================================
--- branches/release/boost/container/flat_set.hpp (original)
+++ branches/release/boost/container/flat_set.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -45,31 +45,31 @@
class flat_set;
template <class T, class Pred, class A>
-inline bool operator==(const flat_set<T,Pred,A>& x,
+inline bool operator==(const flat_set<T,Pred,A>& x,
const flat_set<T,Pred,A>& y);
template <class T, class Pred, class A>
-inline bool operator<(const flat_set<T,Pred,A>& x,
+inline bool operator<(const flat_set<T,Pred,A>& x,
const flat_set<T,Pred,A>& y);
/// @endcond
-//! flat_set is a Sorted Associative Container that stores objects of type Key.
-//! flat_set is a Simple Associative Container, meaning that its value type,
-//! as well as its key type, is Key. It is also a Unique Associative Container,
-//! meaning that no two elements are the same.
-//!
+//! flat_set is a Sorted Associative Container that stores objects of type Key.
+//! flat_set is a Simple Associative Container, meaning that its value type,
+//! as well as its key type, is Key. It is also a Unique Associative Container,
+//! meaning that no two elements are the same.
+//!
//! flat_set is similar to std::set but it's implemented like an ordered vector.
//! This means that inserting a new element into a flat_set invalidates
//! previous iterators and references
//!
-//! Erasing an element of a flat_set invalidates iterators and references
+//! Erasing an element of a flat_set invalidates iterators and references
//! pointing to elements that come after (their keys are bigger) the erased element.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Pred = std::less<T>, class A = std::allocator<T> >
#else
template <class T, class Pred, class A>
#endif
-class flat_set
+class flat_set
{
/// @cond
private:
@@ -101,7 +101,7 @@
typedef typename tree_t::stored_allocator_type stored_allocator_type;
//! <b>Effects</b>: Default constructs an empty flat_set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
explicit flat_set()
: m_flat_tree()
@@ -109,58 +109,60 @@
//! <b>Effects</b>: Constructs an empty flat_set using the specified
//! comparison object and allocator.
- //!
+ //!
//! <b>Complexity</b>: Constant.
explicit flat_set(const Pred& comp,
const allocator_type& a = allocator_type())
: m_flat_tree(comp, a)
{}
- //! <b>Effects</b>: Constructs an empty set using the specified comparison object and
+ //! <b>Effects</b>: Constructs an empty set using the specified comparison object and
//! allocator, and inserts elements from the range [first ,last ).
- //!
- //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
+ //!
+ //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first.
template <class InputIterator>
- flat_set(InputIterator first, InputIterator last,
+ flat_set(InputIterator first, InputIterator last,
const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
- : m_flat_tree(comp, a)
+ : m_flat_tree(comp, a)
{ m_flat_tree.insert_unique(first, last); }
- //! <b>Effects</b>: Constructs an empty flat_set using the specified comparison object and
+ //! <b>Effects</b>: Constructs an empty flat_set using the specified comparison object and
//! allocator, and inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
- //!
+ //!
//! <b>Complexity</b>: Linear in N.
+ //!
+ //! <b>Note</b>: Non-standard extension.
template <class InputIterator>
- flat_set(ordered_unique_range_t, InputIterator first, InputIterator last,
+ flat_set(ordered_unique_range_t, InputIterator first, InputIterator last,
const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
- : m_flat_tree(ordered_range, first, last, comp, a)
+ : m_flat_tree(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Copy constructs a set.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- flat_set(const flat_set& x)
+ flat_set(const flat_set& x)
: m_flat_tree(x.m_flat_tree)
{}
//! <b>Effects</b>: Move constructs a set. Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Postcondition</b>: x is emptied.
- flat_set(BOOST_RV_REF(flat_set) mx)
+ flat_set(BOOST_RV_REF(flat_set) mx)
: m_flat_tree(boost::move(mx.m_flat_tree))
{}
//! <b>Effects</b>: Copy constructs a set using the specified allocator.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
flat_set(const flat_set& x, const allocator_type &a)
: m_flat_tree(x.m_flat_tree, a)
@@ -168,175 +170,175 @@
//! <b>Effects</b>: Move constructs a set using the specified allocator.
//! Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Constant if a == mx.get_allocator(), linear otherwise
- flat_set(BOOST_RV_REF(flat_set) mx, const allocator_type &a)
+ flat_set(BOOST_RV_REF(flat_set) mx, const allocator_type &a)
: m_flat_tree(boost::move(mx.m_flat_tree), a)
{}
//! <b>Effects</b>: Makes *this a copy of x.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
flat_set& 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 the previous value of xx.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
flat_set& 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.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- key_compare key_comp() const
+ key_compare key_comp() const
{ return m_flat_tree.key_comp(); }
//! <b>Effects</b>: Returns an object of value_compare constructed out
//! of the comparison object.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- value_compare value_comp() const
+ value_compare value_comp() const
{ return m_flat_tree.key_comp(); }
//! <b>Effects</b>: Returns a copy of the Allocator that
//! was passed to the object's constructor.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- allocator_type get_allocator() const
+ allocator_type get_allocator() const
{ return m_flat_tree.get_allocator(); }
- const stored_allocator_type &get_stored_allocator() const
+ const stored_allocator_type &get_stored_allocator() const
{ return m_flat_tree.get_stored_allocator(); }
stored_allocator_type &get_stored_allocator()
{ return m_flat_tree.get_stored_allocator(); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator begin()
+ iterator begin()
{ return m_flat_tree.begin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const
{ return m_flat_tree.begin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return m_flat_tree.cbegin(); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator end()
+ iterator end()
{ return m_flat_tree.end(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator end() const
+ const_iterator end() const
{ return m_flat_tree.end(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ const_iterator cend() const
{ return m_flat_tree.cend(); }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rbegin()
- { return m_flat_tree.rbegin(); }
+ reverse_iterator rbegin()
+ { return m_flat_tree.rbegin(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const
- { return m_flat_tree.rbegin(); }
+ const_reverse_iterator rbegin() const
+ { return m_flat_tree.rbegin(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const
- { return m_flat_tree.crbegin(); }
+ const_reverse_iterator crbegin() const
+ { return m_flat_tree.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reverse_iterator rend()
{ return m_flat_tree.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const
+ const_reverse_iterator rend() const
{ return m_flat_tree.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const
{ return m_flat_tree.crend(); }
//! <b>Effects</b>: Returns true if the container contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- bool empty() const
+ bool empty() const
{ return m_flat_tree.empty(); }
//! <b>Effects</b>: Returns the number of the elements contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const
{ return m_flat_tree.size(); }
//! <b>Effects</b>: Returns the largest possible size of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type max_size() const
+ size_type max_size() const
{ return m_flat_tree.max_size(); }
//! <b>Effects</b>: Swaps the contents of *this and x.
@@ -347,10 +349,10 @@
void swap(flat_set& x)
{ m_flat_tree.swap(x.m_flat_tree); }
- //! <b>Effects</b>: Inserts x if and only if there is no element in the container
+ //! <b>Effects</b>: Inserts x if and only if there is no element in the container
//! with key equivalent to the key of x.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
@@ -358,7 +360,7 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- std::pair<iterator, bool> insert(insert_const_ref_type x)
+ std::pair<iterator, bool> insert(insert_const_ref_type x)
{ return priv_insert(x); }
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -373,7 +375,7 @@
//! <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.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
@@ -381,10 +383,10 @@
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) 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
+ //! <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.
//! p is a hint pointing to where the insert should start to search.
//!
@@ -395,7 +397,7 @@
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- iterator insert(const_iterator p, insert_const_ref_type x)
+ iterator insert(const_iterator p, insert_const_ref_type x)
{ return priv_insert(p, x); }
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -416,12 +418,12 @@
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_RV_REF(value_type) 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>: first, last are not iterators into *this.
//!
- //! <b>Effects</b>: inserts each element from the range [first,last) if and only
+ //! <b>Effects</b>: inserts each element from the range [first,last) if and only
//! if there is no element with key equivalent to the key of that element.
//!
//! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
@@ -429,16 +431,31 @@
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class InputIterator>
- void insert(InputIterator first, InputIterator last)
+ void insert(InputIterator first, InputIterator last)
{ m_flat_tree.insert_unique(first, last); }
+ //! <b>Requires</b>: first, last are not iterators into *this and
+ //! must be ordered according to the predicate and must be
+ //! unique values.
+ //!
+ //! <b>Effects</b>: inserts each element from the range [first,last) .This function
+ //! is more efficient than the normal range creation for ordered ranges.
+ //!
+ //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
+ //! search time plus N*size() insertion time.
+ //!
+ //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
+ template <class InputIterator>
+ void insert(ordered_unique_range_t, InputIterator first, InputIterator last)
+ { m_flat_tree.insert_unique(ordered_unique_range, first, last); }
+
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object x of type T constructed with
- //! std::forward<Args>(args)... if and only if there is no element in the container
+ //! std::forward<Args>(args)... if and only if there is no element in the container
//! with key equivalent to the key of x.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
@@ -451,7 +468,7 @@
{ 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
+ //! std::forward<Args>(args)... in the container if and only if there is
//! no element in the container with key equivalent to the key of x.
//! p is a hint pointing to where the insert should start to search.
//!
@@ -487,14 +504,14 @@
//! <b>Effects</b>: Erases the element pointed to by position.
//!
//! <b>Returns</b>: Returns an iterator pointing to the element immediately
- //! following q prior to the element being erased. If no such element exists,
+ //! following q prior to the element being erased. If no such element exists,
//! returns end().
//!
//! <b>Complexity</b>: Linear to the elements with keys bigger than position
//!
//! <b>Note</b>: Invalidates elements with keys
//! not less than the erased element.
- iterator erase(const_iterator position)
+ iterator erase(const_iterator position)
{ return m_flat_tree.erase(position); }
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
@@ -503,7 +520,7 @@
//!
//! <b>Complexity</b>: Logarithmic search time plus erasure time
//! linear to the elements with bigger keys.
- size_type erase(const key_type& x)
+ size_type erase(const key_type& x)
{ return m_flat_tree.erase(x); }
//! <b>Effects</b>: Erases all the elements in the range [first, last).
@@ -514,7 +531,7 @@
//!
//! <b>Complexity</b>: Logarithmic search time plus erasure time
//! linear to the elements with bigger keys.
- iterator erase(const_iterator first, const_iterator last)
+ iterator erase(const_iterator first, const_iterator last)
{ return m_flat_tree.erase(first, last); }
//! <b>Effects</b>: erase(a.begin(),a.end()).
@@ -522,7 +539,7 @@
//! <b>Postcondition</b>: size() == 0.
//!
//! <b>Complexity</b>: linear in size().
- void clear()
+ void clear()
{ m_flat_tree.clear(); }
//! <b>Effects</b>: Tries to deallocate the excess of memory created
@@ -538,34 +555,34 @@
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator find(const key_type& x)
+ iterator find(const key_type& x)
{ return m_flat_tree.find(x); }
//! <b>Returns</b>: A const_iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.s
- const_iterator find(const key_type& x) const
+ const_iterator find(const key_type& x) const
{ return m_flat_tree.find(x); }
//! <b>Returns</b>: The number of elements with key equivalent to x.
//!
//! <b>Complexity</b>: log(size())+count(k)
- size_type count(const key_type& x) const
+ size_type count(const key_type& x) const
{ return m_flat_tree.find(x) == m_flat_tree.end() ? 0 : 1; }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- iterator lower_bound(const key_type& x)
+ iterator lower_bound(const key_type& x)
{ return m_flat_tree.lower_bound(x); }
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator lower_bound(const key_type& x) const
+ const_iterator lower_bound(const key_type& x) const
{ return m_flat_tree.lower_bound(x); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
@@ -579,42 +596,42 @@
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator upper_bound(const key_type& x) const
+ const_iterator upper_bound(const key_type& x) const
{ return m_flat_tree.upper_bound(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<const_iterator, const_iterator>
- equal_range(const key_type& x) const
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& x) const
{ return m_flat_tree.equal_range(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<iterator,iterator>
- equal_range(const key_type& x)
+ std::pair<iterator,iterator>
+ equal_range(const key_type& x)
{ return m_flat_tree.equal_range(x); }
//! <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
+ size_type capacity() const
{ return m_flat_tree.capacity(); }
//! <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 or T's copy constructor throws.
//!
//! <b>Note</b>: If capacity() is less than "count", iterators and references to
//! to values might be invalidated.
- void reserve(size_type count)
+ void reserve(size_type count)
{ m_flat_tree.reserve(count); }
/// @cond
@@ -625,46 +642,46 @@
friend bool operator< (const flat_set<K1,C1,A1>&, const flat_set<K1,C1,A1>&);
private:
- std::pair<iterator, bool> priv_insert(const T &x)
+ std::pair<iterator, bool> priv_insert(const T &x)
{ return m_flat_tree.insert_unique(x); }
- iterator priv_insert(const_iterator p, const T &x)
+ iterator priv_insert(const_iterator p, const T &x)
{ return m_flat_tree.insert_unique(p, x); }
/// @endcond
};
template <class T, class Pred, class A>
-inline bool operator==(const flat_set<T,Pred,A>& x,
- const flat_set<T,Pred,A>& y)
+inline bool operator==(const flat_set<T,Pred,A>& x,
+ const flat_set<T,Pred,A>& y)
{ return x.m_flat_tree == y.m_flat_tree; }
template <class T, class Pred, class A>
-inline bool operator<(const flat_set<T,Pred,A>& x,
- const flat_set<T,Pred,A>& y)
+inline bool operator<(const flat_set<T,Pred,A>& x,
+ const flat_set<T,Pred,A>& y)
{ return x.m_flat_tree < y.m_flat_tree; }
template <class T, class Pred, class A>
-inline bool operator!=(const flat_set<T,Pred,A>& x,
- const flat_set<T,Pred,A>& y)
+inline bool operator!=(const flat_set<T,Pred,A>& x,
+ const flat_set<T,Pred,A>& y)
{ return !(x == y); }
template <class T, class Pred, class A>
-inline bool operator>(const flat_set<T,Pred,A>& x,
- const flat_set<T,Pred,A>& y)
+inline bool operator>(const flat_set<T,Pred,A>& x,
+ const flat_set<T,Pred,A>& y)
{ return y < x; }
template <class T, class Pred, class A>
-inline bool operator<=(const flat_set<T,Pred,A>& x,
- const flat_set<T,Pred,A>& y)
+inline bool operator<=(const flat_set<T,Pred,A>& x,
+ const flat_set<T,Pred,A>& y)
{ return !(y < x); }
template <class T, class Pred, class A>
-inline bool operator>=(const flat_set<T,Pred,A>& x,
- const flat_set<T,Pred,A>& y)
+inline bool operator>=(const flat_set<T,Pred,A>& x,
+ const flat_set<T,Pred,A>& y)
{ return !(x < y); }
template <class T, class Pred, class A>
-inline void swap(flat_set<T,Pred,A>& x, flat_set<T,Pred,A>& y)
+inline void swap(flat_set<T,Pred,A>& x, flat_set<T,Pred,A>& y)
{ x.swap(y); }
/// @cond
@@ -691,31 +708,31 @@
class flat_multiset;
template <class T, class Pred, class A>
-inline bool operator==(const flat_multiset<T,Pred,A>& x,
+inline bool operator==(const flat_multiset<T,Pred,A>& x,
const flat_multiset<T,Pred,A>& y);
template <class T, class Pred, class A>
-inline bool operator<(const flat_multiset<T,Pred,A>& x,
+inline bool operator<(const flat_multiset<T,Pred,A>& x,
const flat_multiset<T,Pred,A>& y);
/// @endcond
-//! flat_multiset is a Sorted Associative Container that stores objects of type Key.
-//! flat_multiset is a Simple Associative Container, meaning that its value type,
+//! flat_multiset is a Sorted Associative Container that stores objects of type Key.
+//! flat_multiset is a Simple Associative Container, meaning that its value type,
//! as well as its key type, is Key.
//! flat_Multiset can store multiple copies of the same key value.
-//!
+//!
//! flat_multiset is similar to std::multiset but it's implemented like an ordered vector.
//! This means that inserting a new element into a flat_multiset invalidates
//! previous iterators and references
//!
-//! Erasing an element of a flat_multiset invalidates iterators and references
+//! Erasing an element of a flat_multiset invalidates iterators and references
//! pointing to elements that come after (their keys are equal or bigger) the erased element.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Pred = std::less<T>, class A = std::allocator<T> >
#else
template <class T, class Pred, class A>
#endif
-class flat_multiset
+class flat_multiset
{
/// @cond
private:
@@ -746,7 +763,7 @@
typedef typename tree_t::stored_allocator_type stored_allocator_type;
//! <b>Effects</b>: Default constructs an empty flat_multiset.
- //!
+ //!
//! <b>Complexity</b>: Constant.
explicit flat_multiset()
: m_flat_tree()
@@ -760,41 +777,43 @@
flat_multiset(InputIterator first, InputIterator last,
const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
- : m_flat_tree(comp, a)
+ : m_flat_tree(comp, a)
{ m_flat_tree.insert_equal(first, last); }
- //! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and
+ //! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and
//! allocator, and inserts elements from the ordered range [first ,last ). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
- //!
+ //!
//! <b>Complexity</b>: Linear in N.
+ //!
+ //! <b>Note</b>: Non-standard extension.
template <class InputIterator>
flat_multiset(ordered_range_t, InputIterator first, InputIterator last,
const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
- : m_flat_tree(ordered_range, first, last, comp, a)
+ : m_flat_tree(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Copy constructs a flat_multiset.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- flat_multiset(const flat_multiset& x)
+ flat_multiset(const flat_multiset& x)
: m_flat_tree(x.m_flat_tree)
{}
//! <b>Effects</b>: Move constructs a flat_multiset. Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Postcondition</b>: x is emptied.
- flat_multiset(BOOST_RV_REF(flat_multiset) mx)
+ flat_multiset(BOOST_RV_REF(flat_multiset) mx)
: m_flat_tree(boost::move(mx.m_flat_tree))
{}
//! <b>Effects</b>: Copy constructs a flat_multiset using the specified allocator.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
flat_multiset(const flat_multiset& x, const allocator_type &a)
: m_flat_tree(x.m_flat_tree, a)
@@ -802,175 +821,175 @@
//! <b>Effects</b>: Move constructs a flat_multiset using the specified allocator.
//! Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Constant if a == mx.get_allocator(), linear otherwise
- flat_multiset(BOOST_RV_REF(flat_multiset) mx, const allocator_type &a)
+ flat_multiset(BOOST_RV_REF(flat_multiset) mx, const allocator_type &a)
: m_flat_tree(boost::move(mx.m_flat_tree), a)
{}
//! <b>Effects</b>: Makes *this a copy of x.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x)
+ flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) 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_multiset& operator=(BOOST_RV_REF(flat_multiset) mx)
+ flat_multiset& 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.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- key_compare key_comp() const
+ key_compare key_comp() const
{ return m_flat_tree.key_comp(); }
//! <b>Effects</b>: Returns an object of value_compare constructed out
//! of the comparison object.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- value_compare value_comp() const
+ value_compare value_comp() const
{ return m_flat_tree.key_comp(); }
//! <b>Effects</b>: Returns a copy of the Allocator that
//! was passed to the object's constructor.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- allocator_type get_allocator() const
+ allocator_type get_allocator() const
{ return m_flat_tree.get_allocator(); }
- const stored_allocator_type &get_stored_allocator() const
+ const stored_allocator_type &get_stored_allocator() const
{ return m_flat_tree.get_stored_allocator(); }
stored_allocator_type &get_stored_allocator()
{ return m_flat_tree.get_stored_allocator(); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator begin()
+ iterator begin()
{ return m_flat_tree.begin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const
{ return m_flat_tree.begin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return m_flat_tree.cbegin(); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator end()
+ iterator end()
{ return m_flat_tree.end(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator end() const
+ const_iterator end() const
{ return m_flat_tree.end(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ const_iterator cend() const
{ return m_flat_tree.cend(); }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rbegin()
- { return m_flat_tree.rbegin(); }
+ reverse_iterator rbegin()
+ { return m_flat_tree.rbegin(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const
- { return m_flat_tree.rbegin(); }
+ const_reverse_iterator rbegin() const
+ { return m_flat_tree.rbegin(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const
- { return m_flat_tree.crbegin(); }
+ const_reverse_iterator crbegin() const
+ { return m_flat_tree.crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reverse_iterator rend()
{ return m_flat_tree.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const
+ const_reverse_iterator rend() const
{ return m_flat_tree.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const
{ return m_flat_tree.crend(); }
//! <b>Effects</b>: Returns true if the container contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- bool empty() const
+ bool empty() const
{ return m_flat_tree.empty(); }
//! <b>Effects</b>: Returns the number of the elements contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const
{ return m_flat_tree.size(); }
//! <b>Effects</b>: Returns the largest possible size of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type max_size() const
+ size_type max_size() const
{ return m_flat_tree.max_size(); }
//! <b>Effects</b>: Swaps the contents of *this and x.
@@ -982,13 +1001,13 @@
{ m_flat_tree.swap(x.m_flat_tree); }
//! <b>Effects</b>: Inserts x and returns the iterator pointing to the
- //! newly inserted element.
+ //! newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- iterator insert(insert_const_ref_type x)
+ iterator insert(insert_const_ref_type x)
{ return priv_insert(x); }
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -1001,13 +1020,13 @@
#endif
//! <b>Effects</b>: Inserts a new value_type move constructed from x
- //! and returns the iterator pointing to the newly inserted element.
+ //! and returns the iterator pointing to the newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- iterator insert(BOOST_RV_REF(value_type) 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.
@@ -1020,7 +1039,7 @@
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- iterator insert(const_iterator p, insert_const_ref_type x)
+ iterator insert(const_iterator p, insert_const_ref_type x)
{ return priv_insert(p, x); }
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -1043,7 +1062,7 @@
//! right before p) plus insertion linear to the elements with bigger keys than x.
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
- iterator insert(const_iterator position, BOOST_RV_REF(value_type) 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>: first, last are not iterators into *this.
@@ -1055,14 +1074,28 @@
//!
//! <b>Note</b>: If an element is inserted it might invalidate elements.
template <class InputIterator>
- void insert(InputIterator first, InputIterator last)
+ void insert(InputIterator first, InputIterator last)
{ m_flat_tree.insert_equal(first, last); }
+ //! <b>Requires</b>: first, last are not iterators into *this and
+ //! must be ordered according to the predicate.
+ //!
+ //! <b>Effects</b>: inserts each element from the range [first,last) .This function
+ //! is more efficient than the normal range creation for ordered ranges.
+ //!
+ //! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
+ //! search time plus N*size() insertion time.
+ //!
+ //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements.
+ template <class InputIterator>
+ void insert(ordered_range_t, InputIterator first, InputIterator last)
+ { m_flat_tree.insert_equal(ordered_range, first, last); }
+
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... and returns the iterator pointing to the
- //! newly inserted element.
+ //! newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic search time plus linear insertion
//! to the elements with bigger keys than x.
@@ -1108,14 +1141,14 @@
//! <b>Effects</b>: Erases the element pointed to by position.
//!
//! <b>Returns</b>: Returns an iterator pointing to the element immediately
- //! following q prior to the element being erased. If no such element exists,
+ //! following q prior to the element being erased. If no such element exists,
//! returns end().
//!
//! <b>Complexity</b>: Linear to the elements with keys bigger than position
//!
//! <b>Note</b>: Invalidates elements with keys
//! not less than the erased element.
- iterator erase(const_iterator position)
+ iterator erase(const_iterator position)
{ return m_flat_tree.erase(position); }
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
@@ -1124,7 +1157,7 @@
//!
//! <b>Complexity</b>: Logarithmic search time plus erasure time
//! linear to the elements with bigger keys.
- size_type erase(const key_type& x)
+ size_type erase(const key_type& x)
{ return m_flat_tree.erase(x); }
//! <b>Effects</b>: Erases all the elements in the range [first, last).
@@ -1135,7 +1168,7 @@
//!
//! <b>Complexity</b>: Logarithmic search time plus erasure time
//! linear to the elements with bigger keys.
- iterator erase(const_iterator first, const_iterator last)
+ iterator erase(const_iterator first, const_iterator last)
{ return m_flat_tree.erase(first, last); }
//! <b>Effects</b>: erase(a.begin(),a.end()).
@@ -1143,7 +1176,7 @@
//! <b>Postcondition</b>: size() == 0.
//!
//! <b>Complexity</b>: linear in size().
- void clear()
+ void clear()
{ m_flat_tree.clear(); }
//! <b>Effects</b>: Tries to deallocate the excess of memory created
@@ -1159,34 +1192,34 @@
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator find(const key_type& x)
+ iterator find(const key_type& x)
{ return m_flat_tree.find(x); }
//! <b>Returns</b>: A const_iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.s
- const_iterator find(const key_type& x) const
+ const_iterator find(const key_type& x) const
{ return m_flat_tree.find(x); }
//! <b>Returns</b>: The number of elements with key equivalent to x.
//!
//! <b>Complexity</b>: log(size())+count(k)
- size_type count(const key_type& x) const
+ size_type count(const key_type& x) const
{ return m_flat_tree.count(x); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- iterator lower_bound(const key_type& x)
+ iterator lower_bound(const key_type& x)
{ return m_flat_tree.lower_bound(x); }
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator lower_bound(const key_type& x) const
+ const_iterator lower_bound(const key_type& x) const
{ return m_flat_tree.lower_bound(x); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
@@ -1200,42 +1233,42 @@
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator upper_bound(const key_type& x) const
+ const_iterator upper_bound(const key_type& x) const
{ return m_flat_tree.upper_bound(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<const_iterator, const_iterator>
- equal_range(const key_type& x) const
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& x) const
{ return m_flat_tree.equal_range(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<iterator,iterator>
- equal_range(const key_type& x)
+ std::pair<iterator,iterator>
+ equal_range(const key_type& x)
{ return m_flat_tree.equal_range(x); }
//! <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
+ size_type capacity() const
{ return m_flat_tree.capacity(); }
//! <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 or T's copy constructor throws.
//!
//! <b>Note</b>: If capacity() is less than "count", iterators and references to
//! to values might be invalidated.
- void reserve(size_type count)
+ void reserve(size_type count)
{ m_flat_tree.reserve(count); }
/// @cond
@@ -1246,46 +1279,46 @@
friend bool operator< (const flat_multiset<K1,C1,A1>&,
const flat_multiset<K1,C1,A1>&);
private:
- iterator priv_insert(const T &x)
+ iterator priv_insert(const T &x)
{ return m_flat_tree.insert_equal(x); }
- iterator priv_insert(const_iterator p, const T &x)
+ iterator priv_insert(const_iterator p, const T &x)
{ return m_flat_tree.insert_equal(p, x); }
/// @endcond
};
template <class T, class Pred, class A>
-inline bool operator==(const flat_multiset<T,Pred,A>& x,
- const flat_multiset<T,Pred,A>& y)
+inline bool operator==(const flat_multiset<T,Pred,A>& x,
+ const flat_multiset<T,Pred,A>& y)
{ return x.m_flat_tree == y.m_flat_tree; }
template <class T, class Pred, class A>
-inline bool operator<(const flat_multiset<T,Pred,A>& x,
- const flat_multiset<T,Pred,A>& y)
+inline bool operator<(const flat_multiset<T,Pred,A>& x,
+ const flat_multiset<T,Pred,A>& y)
{ return x.m_flat_tree < y.m_flat_tree; }
template <class T, class Pred, class A>
-inline bool operator!=(const flat_multiset<T,Pred,A>& x,
- const flat_multiset<T,Pred,A>& y)
+inline bool operator!=(const flat_multiset<T,Pred,A>& x,
+ const flat_multiset<T,Pred,A>& y)
{ return !(x == y); }
template <class T, class Pred, class A>
-inline bool operator>(const flat_multiset<T,Pred,A>& x,
- const flat_multiset<T,Pred,A>& y)
+inline bool operator>(const flat_multiset<T,Pred,A>& x,
+ const flat_multiset<T,Pred,A>& y)
{ return y < x; }
template <class T, class Pred, class A>
-inline bool operator<=(const flat_multiset<T,Pred,A>& x,
- const flat_multiset<T,Pred,A>& y)
+inline bool operator<=(const flat_multiset<T,Pred,A>& x,
+ const flat_multiset<T,Pred,A>& y)
{ return !(y < x); }
template <class T, class Pred, class A>
-inline bool operator>=(const flat_multiset<T,Pred,A>& x,
- const flat_multiset<T,Pred,A>& y)
+inline bool operator>=(const flat_multiset<T,Pred,A>& x,
+ const flat_multiset<T,Pred,A>& y)
{ return !(x < y); }
template <class T, class Pred, class A>
-inline void swap(flat_multiset<T,Pred,A>& x, flat_multiset<T,Pred,A>& y)
+inline void swap(flat_multiset<T,Pred,A>& x, flat_multiset<T,Pred,A>& y)
{ x.swap(y); }
/// @cond
Modified: branches/release/boost/container/list.hpp
==============================================================================
--- branches/release/boost/container/list.hpp (original)
+++ branches/release/boost/container/list.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -32,7 +32,7 @@
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
#else
//Preprocessor library to emulate perfect forwarding
-#include <boost/container/detail/preprocessor.hpp>
+#include <boost/container/detail/preprocessor.hpp>
#endif
#include <stdexcept>
@@ -98,26 +98,26 @@
/// @endcond
//! A list is a doubly linked list. That is, it is a Sequence that supports both
-//! forward and backward traversal, and (amortized) constant time insertion and
-//! removal of elements at the beginning or the end, or in the middle. Lists have
-//! the important property that insertion and splicing do not invalidate iterators
-//! to list elements, and that even removal invalidates only the iterators that point
-//! to the elements that are removed. The ordering of iterators may be changed
-//! (that is, list<T>::iterator might have a different predecessor or successor
-//! after a list operation than it did before), but the iterators themselves will
-//! not be invalidated or made to point to different elements unless that invalidation
+//! forward and backward traversal, and (amortized) constant time insertion and
+//! removal of elements at the beginning or the end, or in the middle. Lists have
+//! the important property that insertion and splicing do not invalidate iterators
+//! to list elements, and that even removal invalidates only the iterators that point
+//! to the elements that are removed. The ordering of iterators may be changed
+//! (that is, list<T>::iterator might have a different predecessor or successor
+//! after a list operation than it did before), but the iterators themselves will
+//! not be invalidated or made to point to different elements unless that invalidation
//! or mutation is explicit.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class A = std::allocator<T> >
#else
template <class T, class A>
#endif
-class list
+class list
: protected container_detail::node_alloc_holder
<A, typename container_detail::intrusive_list_type<A>::type>
{
/// @cond
- typedef typename
+ typedef typename
container_detail::intrusive_list_type<A>::type Icont;
typedef list <T, A> ThisType;
typedef container_detail::node_alloc_holder<A, Icont> AllocHolder;
@@ -192,11 +192,11 @@
/// @endcond
public:
- //! Const iterator used to iterate through a list.
+ //! Const iterator used to iterate through a list.
class const_iterator
/// @cond
- : public std::iterator<std::bidirectional_iterator_tag,
- value_type, list_difference_type,
+ : public std::iterator<std::bidirectional_iterator_tag,
+ value_type, list_difference_type,
list_const_pointer, list_const_reference>
{
@@ -220,17 +220,17 @@
{}
//Pointer like operators
- const_reference operator*() const
+ const_reference operator*() const
{ return m_it->m_data; }
- const_pointer operator->() const
+ const_pointer operator->() const
{ return const_pointer(&m_it->m_data); }
//Increment / Decrement
- const_iterator& operator++()
+ const_iterator& operator++()
{ prot_incr(); return *this; }
- const_iterator operator++(int)
+ const_iterator operator++(int)
{ typename Icont::iterator tmp = m_it; ++*this; return const_iterator(tmp); }
const_iterator& operator--()
@@ -259,7 +259,7 @@
explicit iterator(typename Icont::iterator it)
: const_iterator(it)
{}
-
+
typename Icont::iterator get()
{ return this->m_it; }
@@ -276,12 +276,12 @@
pointer operator->() const { return pointer(&this->m_it->m_data); }
//Increment / Decrement
- iterator& operator++()
+ iterator& operator++()
{ this->prot_incr(); return *this; }
iterator operator++(int)
{ typename Icont::iterator tmp = this->m_it; ++*this; return iterator(tmp); }
-
+
iterator& operator--()
{ this->prot_decr(); return *this; }
@@ -290,24 +290,24 @@
};
/// @endcond
- //! Iterator used to iterate backwards through a list.
+ //! Iterator used to iterate backwards through a list.
typedef std::reverse_iterator<iterator> reverse_iterator;
- //! Const iterator used to iterate backwards through a list.
+ //! Const iterator used to iterate backwards through a list.
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
//! <b>Effects</b>: Default constructs a list.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's default constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- list()
+ list()
: AllocHolder()
{}
//! <b>Effects</b>: Constructs a list taking the allocator as parameter.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant.
explicit list(const allocator_type &a)
: AllocHolder(a)
@@ -318,7 +318,7 @@
//!
//! <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 list(size_type n)
: AllocHolder(A())
@@ -329,7 +329,7 @@
//!
//! <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.
list(size_type n, const T& value, const A& a = A())
: AllocHolder(a)
@@ -338,18 +338,18 @@
//! <b>Effects</b>: Copy constructs a list.
//!
//! <b>Postcondition</b>: x == *this.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's default constructor or copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements x contains.
- list(const list& x)
+ list(const list& x)
: AllocHolder(x)
{ this->insert(this->cbegin(), x.begin(), x.end()); }
//! <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.
list(BOOST_RV_REF(list) x)
: AllocHolder(boost::move(static_cast<AllocHolder&>(x)))
@@ -358,11 +358,11 @@
//! <b>Effects</b>: Copy constructs a list using the specified allocator.
//!
//! <b>Postcondition</b>: x == *this.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's default constructor or copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements x contains.
- list(const list& x, const allocator_type &a)
+ list(const list& x, const allocator_type &a)
: AllocHolder(a)
{ this->insert(this->cbegin(), x.begin(), x.end()); }
@@ -370,7 +370,7 @@
//! Moves mx's resources to *this.
//!
//! <b>Throws</b>: If allocation or value_type's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
list(BOOST_RV_REF(list) x, const allocator_type &a)
: AllocHolder(a)
@@ -405,14 +405,14 @@
{} //AllocHolder clears the list
//! <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 allocator_type(this->node_alloc()); }
- const stored_allocator_type &get_stored_allocator() const
+ const stored_allocator_type &get_stored_allocator() const
{ return this->node_alloc(); }
stored_allocator_type &get_stored_allocator()
@@ -427,129 +427,129 @@
{ AllocHolder::clear(alloc_version()); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
iterator begin()
{ return iterator(this->icont().begin()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator begin() const
{ return this->cbegin(); }
//! <b>Effects</b>: Returns an iterator to the end of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
iterator end()
{ return iterator(this->icont().end()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator end() const
{ return this->cend(); }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed list.
- //!
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reverse_iterator rbegin()
{ return reverse_iterator(end()); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed list.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rbegin() const
{ return this->crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed list.
- //!
+ //! of the reversed list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reverse_iterator rend()
{ return reverse_iterator(begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed list.
- //!
+ //! of the reversed list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rend() const
{ return this->crend(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator cbegin() const
{ return const_iterator(this->non_const_icont().begin()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator cend() const
{ return const_iterator(this->non_const_icont().end()); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed list.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crbegin() const
{ return const_reverse_iterator(this->cend()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed list.
- //!
+ //! of the reversed list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crend() const
{ return const_reverse_iterator(this->cbegin()); }
//! <b>Effects</b>: Returns true if the list contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- bool empty() const
+ bool empty() const
{ return !this->size(); }
//! <b>Effects</b>: Returns the number of the elements contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const
{ return this->icont().size(); }
//! <b>Effects</b>: Returns the largest possible size of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type max_size() const
+ size_type max_size() const
{ return AllocHolder::max_size(); }
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -597,7 +597,7 @@
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Amortized constant time.
- void pop_front()
+ void pop_front()
{ this->erase(this->cbegin()); }
//! <b>Effects</b>: Removes the last element from the list.
@@ -605,51 +605,51 @@
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Amortized constant time.
- void pop_back()
+ void pop_back()
{ const_iterator tmp = this->cend(); this->erase(--tmp); }
//! <b>Requires</b>: !empty()
//!
- //! <b>Effects</b>: Returns a reference to the first element
+ //! <b>Effects</b>: Returns a reference to the first element
//! from the beginning of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reference front()
+ reference front()
{ return *this->begin(); }
//! <b>Requires</b>: !empty()
//!
- //! <b>Effects</b>: Returns a const reference to the first element
+ //! <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
+ const_reference front() const
{ return *this->begin(); }
//! <b>Requires</b>: !empty()
//!
- //! <b>Effects</b>: Returns a reference to the first element
+ //! <b>Effects</b>: Returns a reference to the first element
//! from the beginning of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reference back()
+ reference back()
{ return *(--this->end()); }
//! <b>Requires</b>: !empty()
//!
- //! <b>Effects</b>: Returns a const reference to the first element
+ //! <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 back() const
+ const_reference back() const
{ return *(--this->end()); }
//! <b>Effects</b>: Inserts or erases elements at the end such that
@@ -662,7 +662,7 @@
{
const_iterator iend = this->cend();
size_type len = this->size();
-
+
if(len > new_size){
size_type to_erase = len - new_size;
while(to_erase--){
@@ -685,7 +685,7 @@
{
const_iterator iend = this->end();
size_type len = this->size();
-
+
if(len > new_size){
size_type to_erase = len - new_size;
const_iterator ifirst;
@@ -719,8 +719,8 @@
//! <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>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.
//!
@@ -791,7 +791,7 @@
//!
//! <b>Complexity</b>: Linear to std::distance [first, last).
template <class InpIt>
- void insert(const_iterator p, InpIt first, InpIt last)
+ void insert(const_iterator p, InpIt first, InpIt last)
{
const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
typedef container_detail::bool_<aux_boolean> Result;
@@ -900,7 +900,7 @@
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Amortized constant time.
- iterator erase(const_iterator p)
+ iterator erase(const_iterator p)
{ return iterator(this->icont().erase_and_dispose(p.get(), Destroyer(this->node_alloc()))); }
//! <b>Requires</b>: first and last must be valid iterator to elements in *this.
@@ -918,7 +918,7 @@
//! <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)
+ 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.
@@ -928,7 +928,7 @@
//!
//! <b>Complexity</b>: Linear to n.
template <class InpIt>
- void assign(InpIt first, InpIt last)
+ void assign(InpIt first, InpIt last)
{
const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
typedef container_detail::bool_<aux_boolean> Result;
@@ -945,7 +945,7 @@
//! are not equal.
//!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, ThisType& x) BOOST_CONTAINER_NOEXCEPT
@@ -956,16 +956,16 @@
//! <b>Requires</b>: p must point to an element contained
//! by this list. i must point to an element contained in list x.
- //!
- //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
+ //!
+ //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! before the the element pointed by p. No destructors or copy constructors are called.
- //! If p == i or p == ++i, this function is a null operation.
- //!
+ //! If p == i or p == ++i, this function is a null operation.
+ //!
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
//! are not equal.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, ThisType &x, const_iterator i) BOOST_CONTAINER_NOEXCEPT
@@ -976,15 +976,15 @@
//! <b>Requires</b>: p must point to an element contained
//! by this list. first and last must point to elements contained in list x.
- //!
- //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
+ //!
+ //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
//! before the the element pointed by p. No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
//! are not equal.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements transferred.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
@@ -996,15 +996,15 @@
//! <b>Requires</b>: p must point to an element contained
//! by this list. first and last must point to elements contained in list x.
//! n == std::distance(first, last)
- //!
- //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
+ //!
+ //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
//! before the the element pointed by p. No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
//! are not equal.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, ThisType &x, const_iterator first, const_iterator last, size_type n) BOOST_CONTAINER_NOEXCEPT
@@ -1013,22 +1013,22 @@
this->icont().splice(p.get(), x.icont(), first.get(), last.get(), n);
}
- //! <b>Effects</b>: Reverses the order of elements in the list.
- //!
+ //! <b>Effects</b>: Reverses the order of elements in the list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: This function is linear time.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated
void reverse()
- { this->icont().reverse(); }
+ { this->icont().reverse(); }
//! <b>Effects</b>: Removes all the elements that compare equal to value.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
void remove(const T& value)
@@ -1036,11 +1036,11 @@
//! <b>Effects</b>: Removes all the elements for which a specified
//! predicate is satisfied.
- //!
+ //!
//! <b>Throws</b>: If pred throws.
- //!
+ //!
//! <b>Complexity</b>: Linear time. It performs exactly size() calls to the predicate.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template <class Pred>
@@ -1050,25 +1050,25 @@
this->icont().remove_and_dispose_if(Predicate(pred), Destroyer(this->node_alloc()));
}
- //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
+ //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that are equal from the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear time (size()-1 comparisons calls to pred()).
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
void unique()
{ this->unique(value_equal()); }
- //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
+ //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that satisfy some binary predicate from the list.
- //!
+ //!
//! <b>Throws</b>: If pred throws.
- //!
+ //!
//! <b>Complexity</b>: Linear time (size()-1 comparisons equality comparisons).
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template <class BinaryPredicate>
@@ -1078,15 +1078,15 @@
this->icont().unique_and_dispose(Predicate(binary_pred), Destroyer(this->node_alloc()));
}
- //! <b>Requires</b>: The lists x and *this must be distinct.
+ //! <b>Requires</b>: The lists x and *this must be distinct.
//!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
- //! in order into *this according to std::less<value_type>. The merge is stable;
- //! that is, if an element from *this is equivalent to one from x, then the element
- //! from *this will precede the one from x.
- //!
+ //! in order into *this according to std::less<value_type>. The merge is stable;
+ //! that is, if an element from *this is equivalent to one from x, then the element
+ //! from *this will precede the one from x.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
void merge(list<T, A>& x)
@@ -1094,17 +1094,17 @@
//! <b>Requires</b>: p must be a comparison function that induces a strict weak
//! ordering and both *this and x must be sorted according to that ordering
- //! The lists x and *this must be distinct.
- //!
+ //! The lists x and *this must be distinct.
+ //!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
- //! in order into *this. The merge is stable; that is, if an element from *this is
- //! equivalent to one from x, then the element from *this will precede the one from x.
- //!
+ //! in order into *this. The merge is stable; that is, if an element from *this is
+ //! equivalent to one from x, then the element from *this will precede the one from x.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
- //!
+ //!
//! <b>Note</b>: Iterators and references to *this are not invalidated.
template <class StrictWeakOrdering>
void merge(list &x, StrictWeakOrdering comp)
@@ -1118,25 +1118,25 @@
}
}
- //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
+ //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
- //!
+ //!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
void sort()
{ this->sort(value_less()); }
- //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
+ //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
- //!
+ //!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
template <class StrictWeakOrdering>
@@ -1151,25 +1151,25 @@
/// @cond
private:
- iterator priv_insert(const_iterator p, const T &x)
+ iterator priv_insert(const_iterator p, const T &x)
{
NodePtr tmp = AllocHolder::create_node(x);
return iterator(this->icont().insert(p.get(), *tmp));
}
- iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x)
+ 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)
+ 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)
+ void priv_push_front (const T &x)
{ this->insert(this->cbegin(), x); }
void priv_push_front (BOOST_RV_REF(T) x)
@@ -1251,10 +1251,10 @@
{ this->priv_create_and_insert_nodes(p, first, last); }
template<class Integer>
- void priv_insert_dispatch(const_iterator p, Integer n, Integer x, container_detail::true_)
+ void priv_insert_dispatch(const_iterator p, Integer n, Integer x, container_detail::true_)
{ this->insert(p, (size_type)n, x); }
- void priv_fill_assign(size_type n, const T& val)
+ void priv_fill_assign(size_type n, const T& val)
{
iterator i = this->begin(), iend = this->end();
@@ -1328,25 +1328,25 @@
}
template <class T, class A>
-inline bool operator!=(const list<T,A>& x, const list<T,A>& y)
+inline bool operator!=(const list<T,A>& x, const list<T,A>& y)
{
return !(x == y);
}
template <class T, class A>
-inline bool operator>(const list<T,A>& x, const list<T,A>& y)
+inline bool operator>(const list<T,A>& x, const list<T,A>& y)
{
return y < x;
}
template <class T, class A>
-inline bool operator<=(const list<T,A>& x, const list<T,A>& y)
+inline bool operator<=(const list<T,A>& x, const list<T,A>& y)
{
return !(y < x);
}
template <class T, class A>
-inline bool operator>=(const list<T,A>& x, const list<T,A>& y)
+inline bool operator>=(const list<T,A>& x, const list<T,A>& y)
{
return !(x < y);
}
Modified: branches/release/boost/container/map.hpp
==============================================================================
--- branches/release/boost/container/map.hpp (original)
+++ branches/release/boost/container/map.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -47,20 +47,20 @@
/// @cond
// Forward declarations of operators == and <, needed for friend declarations.
template <class Key, class T, class Pred, class A>
-inline bool operator==(const map<Key,T,Pred,A>& x,
+inline bool operator==(const map<Key,T,Pred,A>& x,
const map<Key,T,Pred,A>& y);
template <class Key, class T, class Pred, class A>
-inline bool operator<(const map<Key,T,Pred,A>& x,
+inline bool operator<(const map<Key,T,Pred,A>& x,
const map<Key,T,Pred,A>& y);
/// @endcond
-//! A map is a kind of associative container that supports unique keys (contains at
-//! most one of each key value) and provides for fast retrieval of values of another
+//! A map is a kind of associative container that supports unique keys (contains at
+//! most one of each key value) and provides for fast retrieval of values of another
//! type T based on the keys. The map class supports bidirectional iterators.
-//!
-//! A map satisfies all of the requirements of a container and of a reversible
-//! container and of an associative container. For a
+//!
+//! A map satisfies all of the requirements of a container and of a reversible
+//! container and of an associative container. For a
//! map<Key,T> the key_type is Key and the value_type is std::pair<const Key,T>.
//!
//! Pred is the ordering function for Keys (e.g. <i>std::less<Key></i>).
@@ -72,15 +72,15 @@
#else
template <class Key, class T, class Pred, class A>
#endif
-class map
+class map
{
/// @cond
private:
BOOST_COPYABLE_AND_MOVABLE(map)
- typedef container_detail::rbtree<Key,
- std::pair<const Key, T>,
- container_detail::select1st< std::pair<const Key, T> >,
- Pred,
+ typedef container_detail::rbtree<Key,
+ std::pair<const Key, T>,
+ container_detail::select1st< std::pair<const Key, T> >,
+ Pred,
A> tree_t;
tree_t m_tree; // red-black tree representing map
@@ -112,7 +112,7 @@
/// @cond
class value_compare_impl
: public Pred,
- public std::binary_function<value_type, value_type, bool>
+ public std::binary_function<value_type, value_type, bool>
{
friend class map<Key,T,Pred,A>;
protected :
@@ -126,7 +126,7 @@
typedef value_compare_impl value_compare;
//! <b>Effects</b>: Default constructs an empty map.
- //!
+ //!
//! <b>Complexity</b>: Constant.
map()
: m_tree()
@@ -135,9 +135,9 @@
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
- //! <b>Effects</b>: Constructs an empty map using the specified comparison object
+ //! <b>Effects</b>: Constructs an empty map using the specified comparison object
//! and allocator.
- //!
+ //!
//! <b>Complexity</b>: Constant.
explicit map(const Pred& comp,
const allocator_type& a = allocator_type())
@@ -147,41 +147,41 @@
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
- //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
+ //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
//! allocator, and inserts elements from the range [first ,last ).
- //!
- //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
+ //!
+ //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first.
template <class InputIterator>
map(InputIterator first, InputIterator last, const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
- : m_tree(first, last, comp, a, true)
+ : m_tree(first, last, comp, a, true)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
- //! <b>Effects</b>: Constructs an empty map using the specified comparison object and
+ //! <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
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
- //!
+ //!
//! <b>Complexity</b>: Linear in N.
template <class InputIterator>
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)
+ : m_tree(ordered_range, first, last, comp, a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Copy constructs a map.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- map(const map& x)
+ map(const map& x)
: m_tree(x.m_tree)
{
//Allocator type must be std::pair<CONST Key, T>
@@ -189,11 +189,11 @@
}
//! <b>Effects</b>: Move constructs a map. Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Postcondition</b>: x is emptied.
- map(BOOST_RV_REF(map) x)
+ map(BOOST_RV_REF(map) x)
: m_tree(boost::move(x.m_tree))
{
//Allocator type must be std::pair<CONST Key, T>
@@ -201,9 +201,9 @@
}
//! <b>Effects</b>: Copy constructs a map using the specified allocator.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- map(const map& x, const allocator_type &a)
+ map(const map& x, const allocator_type &a)
: m_tree(x.m_tree, a)
{
//Allocator type must be std::pair<CONST Key, T>
@@ -214,9 +214,9 @@
//! Constructs *this using x's resources.
//!
//! <b>Complexity</b>: Constant if x == x.get_allocator(), linear otherwise.
- //!
+ //!
//! <b>Postcondition</b>: x is emptied.
- map(BOOST_RV_REF(map) x, const allocator_type &a)
+ map(BOOST_RV_REF(map) x, const allocator_type &a)
: m_tree(boost::move(x.m_tree), a)
{
//Allocator type must be std::pair<CONST Key, T>
@@ -224,184 +224,184 @@
}
//! <b>Effects</b>: Makes *this a copy of x.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
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_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.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- key_compare key_comp() const
+ key_compare key_comp() const
{ return m_tree.key_comp(); }
//! <b>Effects</b>: Returns an object of value_compare constructed out
//! of the comparison object.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- value_compare value_comp() const
+ value_compare value_comp() const
{ return value_compare(m_tree.key_comp()); }
//! <b>Effects</b>: Returns a copy of the Allocator that
//! was passed to the object's constructor.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- allocator_type get_allocator() const
+ allocator_type get_allocator() const
{ return m_tree.get_allocator(); }
- const stored_allocator_type &get_stored_allocator() const
+ const stored_allocator_type &get_stored_allocator() const
{ return m_tree.get_stored_allocator(); }
stored_allocator_type &get_stored_allocator()
{ return m_tree.get_stored_allocator(); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator begin()
+ iterator begin()
{ return m_tree.begin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const
{ return this->cbegin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return m_tree.begin(); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator end()
+ iterator end()
{ return m_tree.end(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator end() const
+ const_iterator end() const
{ return this->cend(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ const_iterator cend() const
{ return m_tree.end(); }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rbegin()
+ reverse_iterator rbegin()
{ return m_tree.rbegin(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const
+ const_reverse_iterator rbegin() const
{ return this->crbegin(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const
+ const_reverse_iterator crbegin() const
{ return m_tree.rbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rend()
+ reverse_iterator rend()
{ return m_tree.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const
+ const_reverse_iterator rend() const
{ return this->crend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const
{ return m_tree.rend(); }
//! <b>Effects</b>: Returns true if the container contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- bool empty() const
+ bool empty() const
{ return m_tree.empty(); }
//! <b>Effects</b>: Returns the number of the elements contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const
{ return m_tree.size(); }
//! <b>Effects</b>: Returns the largest possible size of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type max_size() const
+ size_type max_size() const
{ return m_tree.max_size(); }
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
- //! Effects: If there is no key equivalent to x in the map, inserts
+ //! Effects: If there is no key equivalent to x in the map, inserts
//! value_type(x, T()) into the map.
- //!
+ //!
//! Returns: A reference to the mapped_type corresponding to x in *this.
- //!
+ //!
//! Complexity: Logarithmic.
mapped_type& operator[](const key_type &k);
- //! Effects: If there is no key equivalent to x in the map, inserts
+ //! Effects: If there is no key equivalent to x in the map, inserts
//! 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.
mapped_type& operator[](key_type &&k);
#else
@@ -440,62 +440,62 @@
void swap(map& x)
{ m_tree.swap(x.m_tree); }
- //! <b>Effects</b>: Inserts x if and only if there is no element in the container
+ //! <b>Effects</b>: Inserts x if and only if there is no element in the container
//! with key equivalent to the key of x.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(const value_type& x)
+ std::pair<iterator,bool> insert(const value_type& x)
{ return m_tree.insert_unique(x); }
- //! <b>Effects</b>: Inserts a new value_type created from the pair if and only if
+ //! <b>Effects</b>: Inserts a new value_type created from the pair if and only if
//! there is no element in the container with key equivalent to the key of x.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(const nonconst_value_type& x)
+ std::pair<iterator,bool> insert(const nonconst_value_type& x)
{ return m_tree.insert_unique(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.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(BOOST_RV_REF(nonconst_value_type) 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.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(BOOST_RV_REF(nonconst_impl_value_type) 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
+ //! <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.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) 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
+ //! <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.
//! p is a hint pointing to where the insert should start to search.
//!
@@ -507,7 +507,7 @@
iterator insert(iterator position, const value_type& x)
{ return m_tree.insert_unique(position, x); }
- //! <b>Effects</b>: Move constructs a new value from x if and only if there is
+ //! <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.
//! p is a hint pointing to where the insert should start to search.
//!
@@ -519,7 +519,7 @@
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
+ //! <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.
//! p is a hint pointing to where the insert should start to search.
//!
@@ -551,22 +551,22 @@
//! <b>Requires</b>: first, last are not iterators into *this.
//!
- //! <b>Effects</b>: inserts each element from the range [first,last) if and only
+ //! <b>Effects</b>: inserts each element from the range [first,last) if and only
//! if there is no element with key equivalent to the key of that element.
//!
//! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
template <class InputIterator>
- void insert(InputIterator first, InputIterator last)
+ void insert(InputIterator first, InputIterator last)
{ m_tree.insert_unique(first, last); }
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object x of type T constructed with
- //! std::forward<Args>(args)... in the container if and only if there is
+ //! std::forward<Args>(args)... in the container if and only if there is
//! no element in the container with an equivalent key.
//! p is a hint pointing to where the insert should start to search.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
@@ -577,7 +577,7 @@
{ 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
+ //! std::forward<Args>(args)... in the container if and only if there is
//! no element in the container with an equivalent key.
//! p is a hint pointing to where the insert should start to search.
//!
@@ -611,11 +611,11 @@
//! <b>Effects</b>: Erases the element pointed to by position.
//!
//! <b>Returns</b>: Returns an iterator pointing to the element immediately
- //! following q prior to the element being erased. If no such element exists,
+ //! following q prior to the element being erased. If no such element exists,
//! returns end().
//!
//! <b>Complexity</b>: Amortized constant time
- iterator erase(const_iterator position)
+ iterator erase(const_iterator position)
{ return m_tree.erase(position); }
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
@@ -623,7 +623,7 @@
//! <b>Returns</b>: Returns the number of erased elements.
//!
//! <b>Complexity</b>: log(size()) + count(k)
- size_type erase(const key_type& x)
+ size_type erase(const key_type& x)
{ return m_tree.erase(x); }
//! <b>Effects</b>: Erases all the elements in the range [first, last).
@@ -639,67 +639,67 @@
//! <b>Postcondition</b>: size() == 0.
//!
//! <b>Complexity</b>: linear in size().
- void clear()
+ void clear()
{ m_tree.clear(); }
//! <b>Returns</b>: An iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator find(const key_type& x)
+ iterator find(const key_type& x)
{ return m_tree.find(x); }
//! <b>Returns</b>: A const_iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- const_iterator find(const key_type& x) const
+ const_iterator find(const key_type& x) const
{ return m_tree.find(x); }
//! <b>Returns</b>: The number of elements with key equivalent to x.
//!
//! <b>Complexity</b>: log(size())+count(k)
- size_type count(const key_type& x) const
+ size_type count(const key_type& x) const
{ return m_tree.find(x) == m_tree.end() ? 0 : 1; }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- iterator lower_bound(const key_type& x)
+ iterator lower_bound(const key_type& x)
{ return m_tree.lower_bound(x); }
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator lower_bound(const key_type& x) const
+ const_iterator lower_bound(const key_type& x) const
{ return m_tree.lower_bound(x); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- iterator upper_bound(const key_type& x)
+ iterator upper_bound(const key_type& x)
{ return m_tree.upper_bound(x); }
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator upper_bound(const key_type& x) const
+ const_iterator upper_bound(const key_type& x) const
{ return m_tree.upper_bound(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<iterator,iterator> equal_range(const key_type& x)
+ std::pair<iterator,iterator> equal_range(const key_type& x)
{ return m_tree.equal_range(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const
+ std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const
{ return m_tree.equal_range(x); }
/// @cond
@@ -723,7 +723,7 @@
return (*i).second;
}
- mapped_type& priv_subscript(BOOST_RV_REF(key_type) mk)
+ mapped_type& priv_subscript(BOOST_RV_REF(key_type) mk)
{
key_type &k = mk;
//we can optimize this
@@ -741,37 +741,37 @@
};
template <class Key, class T, class Pred, class A>
-inline bool operator==(const map<Key,T,Pred,A>& x,
- const map<Key,T,Pred,A>& y)
+inline bool operator==(const map<Key,T,Pred,A>& x,
+ const map<Key,T,Pred,A>& y)
{ return x.m_tree == y.m_tree; }
template <class Key, class T, class Pred, class A>
-inline bool operator<(const map<Key,T,Pred,A>& x,
- const map<Key,T,Pred,A>& y)
+inline bool operator<(const map<Key,T,Pred,A>& x,
+ const map<Key,T,Pred,A>& y)
{ return x.m_tree < y.m_tree; }
template <class Key, class T, class Pred, class A>
-inline bool operator!=(const map<Key,T,Pred,A>& x,
- const map<Key,T,Pred,A>& y)
+inline bool operator!=(const map<Key,T,Pred,A>& x,
+ const map<Key,T,Pred,A>& y)
{ return !(x == y); }
template <class Key, class T, class Pred, class A>
-inline bool operator>(const map<Key,T,Pred,A>& x,
- const map<Key,T,Pred,A>& y)
+inline bool operator>(const map<Key,T,Pred,A>& x,
+ const map<Key,T,Pred,A>& y)
{ return y < x; }
template <class Key, class T, class Pred, class A>
-inline bool operator<=(const map<Key,T,Pred,A>& x,
- const map<Key,T,Pred,A>& y)
+inline bool operator<=(const map<Key,T,Pred,A>& x,
+ const map<Key,T,Pred,A>& y)
{ return !(y < x); }
template <class Key, class T, class Pred, class A>
-inline bool operator>=(const map<Key,T,Pred,A>& x,
- const map<Key,T,Pred,A>& y)
+inline bool operator>=(const map<Key,T,Pred,A>& x,
+ const map<Key,T,Pred,A>& y)
{ return !(x < y); }
template <class Key, class T, class Pred, class A>
-inline void swap(map<Key,T,Pred,A>& x, map<Key,T,Pred,A>& y)
+inline void swap(map<Key,T,Pred,A>& x, map<Key,T,Pred,A>& y)
{ x.swap(y); }
/// @cond
@@ -779,11 +779,11 @@
// Forward declaration of operators < and ==, needed for friend declaration.
template <class Key, class T, class Pred, class A>
-inline bool operator==(const multimap<Key,T,Pred,A>& x,
+inline bool operator==(const multimap<Key,T,Pred,A>& x,
const multimap<Key,T,Pred,A>& y);
template <class Key, class T, class Pred, class A>
-inline bool operator<(const multimap<Key,T,Pred,A>& x,
+inline bool operator<(const multimap<Key,T,Pred,A>& x,
const multimap<Key,T,Pred,A>& y);
} //namespace container {
@@ -800,14 +800,14 @@
/// @endcond
-//! A multimap is a kind of associative container that supports equivalent keys
-//! (possibly containing multiple copies of the same key value) and provides for
+//! A multimap is a kind of associative container that supports equivalent keys
+//! (possibly containing multiple copies of the same key value) and provides for
//! fast retrieval of values of another type T based on the keys. The multimap class
//! supports bidirectional iterators.
-//!
-//! A multimap satisfies all of the requirements of a container and of a reversible
-//! container and of an associative container. For a
-//! map<Key,T> the key_type is Key and the value_type is std::pair<const Key,T>.
+//!
+//! A multimap satisfies all of the requirements of a container and of a reversible
+//! container and of an associative container. For a
+//! map<Key,T> the key_type is Key and the value_type is std::pair<const Key,T>.
//!
//! Pred is the ordering function for Keys (e.g. <i>std::less<Key></i>).
//!
@@ -818,15 +818,15 @@
#else
template <class Key, class T, class Pred, class A>
#endif
-class multimap
+class multimap
{
/// @cond
private:
BOOST_COPYABLE_AND_MOVABLE(multimap)
- typedef container_detail::rbtree<Key,
- std::pair<const Key, T>,
- container_detail::select1st< std::pair<const Key, T> >,
- Pred,
+ typedef container_detail::rbtree<Key,
+ std::pair<const Key, T>,
+ container_detail::select1st< std::pair<const Key, T> >,
+ Pred,
A> tree_t;
tree_t m_tree; // red-black tree representing map
typedef typename container_detail::
@@ -859,7 +859,7 @@
/// @cond
class value_compare_impl
: public Pred,
- public std::binary_function<value_type, value_type, bool>
+ public std::binary_function<value_type, value_type, bool>
{
friend class multimap<Key,T,Pred,A>;
protected :
@@ -873,7 +873,7 @@
typedef value_compare_impl value_compare;
//! <b>Effects</b>: Default constructs an empty multimap.
- //!
+ //!
//! <b>Complexity</b>: Constant.
multimap()
: m_tree()
@@ -884,7 +884,7 @@
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison
//! object and allocator.
- //!
+ //!
//! <b>Complexity</b>: Constant.
explicit multimap(const Pred& comp, const allocator_type& a = allocator_type())
: m_tree(comp, a)
@@ -895,36 +895,36 @@
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison object
//! and allocator, and inserts elements from the range [first ,last ).
- //!
- //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
+ //!
+ //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first.
template <class InputIterator>
multimap(InputIterator first, InputIterator last,
const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
- : m_tree(first, last, comp, a, false)
+ : m_tree(first, last, comp, a, false)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
- //! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
+ //! <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
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
- //!
+ //!
//! <b>Complexity</b>: Linear in N.
template <class InputIterator>
multimap(ordered_range_t ordered_range, InputIterator first, InputIterator last, const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
- : m_tree(ordered_range, first, last, comp, a)
+ : m_tree(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Copy constructs a multimap.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- multimap(const multimap& x)
+ multimap(const multimap& x)
: m_tree(x.m_tree)
{
//Allocator type must be std::pair<CONST Key, T>
@@ -932,11 +932,11 @@
}
//! <b>Effects</b>: Move constructs a multimap. Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Postcondition</b>: x is emptied.
- multimap(BOOST_RV_REF(multimap) x)
+ multimap(BOOST_RV_REF(multimap) x)
: m_tree(boost::move(x.m_tree))
{
//Allocator type must be std::pair<CONST Key, T>
@@ -944,9 +944,9 @@
}
//! <b>Effects</b>: Copy constructs a multimap.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- multimap(const multimap& x, const allocator_type &a)
+ multimap(const multimap& x, const allocator_type &a)
: m_tree(x.m_tree, a)
{
//Allocator type must be std::pair<CONST Key, T>
@@ -956,7 +956,7 @@
//! <b>Effects</b>: Move constructs a multimap using the specified allocator.
//! Constructs *this using x's resources.
//! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
- //!
+ //!
//! <b>Postcondition</b>: x is emptied.
multimap(BOOST_RV_REF(multimap) x, const allocator_type &a)
: m_tree(boost::move(x.m_tree), a)
@@ -966,168 +966,168 @@
}
//! <b>Effects</b>: Makes *this a copy of x.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- multimap& operator=(BOOST_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_RV_REF(multimap) x)
+ 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.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- key_compare key_comp() const
+ key_compare key_comp() const
{ return m_tree.key_comp(); }
//! <b>Effects</b>: Returns an object of value_compare constructed out
//! of the comparison object.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- value_compare value_comp() const
+ value_compare value_comp() const
{ return value_compare(m_tree.key_comp()); }
//! <b>Effects</b>: Returns a copy of the Allocator that
//! was passed to the object's constructor.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- allocator_type get_allocator() const
+ allocator_type get_allocator() const
{ return m_tree.get_allocator(); }
- const stored_allocator_type &get_stored_allocator() const
+ const stored_allocator_type &get_stored_allocator() const
{ return m_tree.get_stored_allocator(); }
stored_allocator_type &get_stored_allocator()
{ return m_tree.get_stored_allocator(); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator begin()
+ iterator begin()
{ return m_tree.begin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const
{ return this->cbegin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return m_tree.begin(); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator end()
+ iterator end()
{ return m_tree.end(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator end() const
+ const_iterator end() const
{ return this->cend(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ const_iterator cend() const
{ return m_tree.end(); }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rbegin()
+ reverse_iterator rbegin()
{ return m_tree.rbegin(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const
+ const_reverse_iterator rbegin() const
{ return this->crbegin(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const
+ const_reverse_iterator crbegin() const
{ return m_tree.rbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rend()
+ reverse_iterator rend()
{ return m_tree.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const
+ const_reverse_iterator rend() const
{ return this->crend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const
{ return m_tree.rend(); }
//! <b>Effects</b>: Returns true if the container contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- bool empty() const
+ bool empty() const
{ return m_tree.empty(); }
//! <b>Effects</b>: Returns the number of the elements contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const
{ return m_tree.size(); }
//! <b>Effects</b>: Returns the largest possible size of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type max_size() const
+ size_type max_size() const
{ return m_tree.max_size(); }
//! <b>Effects</b>: Swaps the contents of *this and x.
@@ -1139,31 +1139,31 @@
{ m_tree.swap(x.m_tree); }
//! <b>Effects</b>: Inserts x and returns the iterator pointing to the
- //! newly inserted element.
+ //! newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator insert(const value_type& x)
+ iterator insert(const value_type& x)
{ return m_tree.insert_equal(x); }
- //! <b>Effects</b>: Inserts a new value constructed from x and returns
- //! the iterator pointing to the newly inserted element.
+ //! <b>Effects</b>: Inserts a new value constructed from x and returns
+ //! the iterator pointing to the newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator insert(const nonconst_value_type& x)
+ iterator insert(const nonconst_value_type& x)
{ return m_tree.insert_equal(x); }
- //! <b>Effects</b>: Inserts a new value move-constructed from x and returns
- //! the iterator pointing to the newly inserted element.
+ //! <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_RV_REF(nonconst_value_type) 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>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_RV_REF(nonconst_impl_value_type) 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.
@@ -1216,7 +1216,7 @@
//!
//! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
template <class InputIterator>
- void insert(InputIterator first, InputIterator last)
+ void insert(InputIterator first, InputIterator last)
{ m_tree.insert_equal(first, last); }
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -1268,11 +1268,11 @@
//! <b>Effects</b>: Erases the element pointed to by position.
//!
//! <b>Returns</b>: Returns an iterator pointing to the element immediately
- //! following q prior to the element being erased. If no such element exists,
+ //! following q prior to the element being erased. If no such element exists,
//! returns end().
//!
//! <b>Complexity</b>: Amortized constant time
- iterator erase(const_iterator position)
+ iterator erase(const_iterator position)
{ return m_tree.erase(position); }
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
@@ -1280,7 +1280,7 @@
//! <b>Returns</b>: Returns the number of erased elements.
//!
//! <b>Complexity</b>: log(size()) + count(k)
- size_type erase(const key_type& x)
+ size_type erase(const key_type& x)
{ return m_tree.erase(x); }
//! <b>Effects</b>: Erases all the elements in the range [first, last).
@@ -1296,68 +1296,68 @@
//! <b>Postcondition</b>: size() == 0.
//!
//! <b>Complexity</b>: linear in size().
- void clear()
+ void clear()
{ m_tree.clear(); }
//! <b>Returns</b>: An iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator find(const key_type& x)
+ iterator find(const key_type& x)
{ return m_tree.find(x); }
//! <b>Returns</b>: A const iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- const_iterator find(const key_type& x) const
+ const_iterator find(const key_type& x) const
{ return m_tree.find(x); }
//! <b>Returns</b>: The number of elements with key equivalent to x.
//!
//! <b>Complexity</b>: log(size())+count(k)
- size_type count(const key_type& x) const
+ size_type count(const key_type& x) const
{ return m_tree.count(x); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- iterator lower_bound(const key_type& x)
+ iterator lower_bound(const key_type& x)
{return m_tree.lower_bound(x); }
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator lower_bound(const key_type& x) const
+ const_iterator lower_bound(const key_type& x) const
{ return m_tree.lower_bound(x); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- iterator upper_bound(const key_type& x)
+ iterator upper_bound(const key_type& x)
{ return m_tree.upper_bound(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<iterator,iterator> equal_range(const key_type& x)
+ std::pair<iterator,iterator> equal_range(const key_type& x)
{ return m_tree.equal_range(x); }
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator upper_bound(const key_type& x) const
+ const_iterator upper_bound(const key_type& x) const
{ return m_tree.upper_bound(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<const_iterator,const_iterator>
- equal_range(const key_type& x) const
+ std::pair<const_iterator,const_iterator>
+ equal_range(const key_type& x) const
{ return m_tree.equal_range(x); }
/// @cond
@@ -1372,37 +1372,37 @@
};
template <class Key, class T, class Pred, class A>
-inline bool operator==(const multimap<Key,T,Pred,A>& x,
- const multimap<Key,T,Pred,A>& y)
+inline bool operator==(const multimap<Key,T,Pred,A>& x,
+ const multimap<Key,T,Pred,A>& y)
{ return x.m_tree == y.m_tree; }
template <class Key, class T, class Pred, class A>
-inline bool operator<(const multimap<Key,T,Pred,A>& x,
- const multimap<Key,T,Pred,A>& y)
+inline bool operator<(const multimap<Key,T,Pred,A>& x,
+ const multimap<Key,T,Pred,A>& y)
{ return x.m_tree < y.m_tree; }
template <class Key, class T, class Pred, class A>
-inline bool operator!=(const multimap<Key,T,Pred,A>& x,
- const multimap<Key,T,Pred,A>& y)
+inline bool operator!=(const multimap<Key,T,Pred,A>& x,
+ const multimap<Key,T,Pred,A>& y)
{ return !(x == y); }
template <class Key, class T, class Pred, class A>
-inline bool operator>(const multimap<Key,T,Pred,A>& x,
- const multimap<Key,T,Pred,A>& y)
+inline bool operator>(const multimap<Key,T,Pred,A>& x,
+ const multimap<Key,T,Pred,A>& y)
{ return y < x; }
template <class Key, class T, class Pred, class A>
-inline bool operator<=(const multimap<Key,T,Pred,A>& x,
- const multimap<Key,T,Pred,A>& y)
+inline bool operator<=(const multimap<Key,T,Pred,A>& x,
+ const multimap<Key,T,Pred,A>& y)
{ return !(y < x); }
template <class Key, class T, class Pred, class A>
-inline bool operator>=(const multimap<Key,T,Pred,A>& x,
- const multimap<Key,T,Pred,A>& y)
+inline bool operator>=(const multimap<Key,T,Pred,A>& x,
+ const multimap<Key,T,Pred,A>& y)
{ return !(x < y); }
template <class Key, class T, class Pred, class A>
-inline void swap(multimap<Key,T,Pred,A>& x, multimap<Key,T,Pred,A>& y)
+inline void swap(multimap<Key,T,Pred,A>& x, multimap<Key,T,Pred,A>& y)
{ x.swap(y); }
/// @cond
Modified: branches/release/boost/container/scoped_allocator.hpp
==============================================================================
--- branches/release/boost/container/scoped_allocator.hpp (original)
+++ branches/release/boost/container/scoped_allocator.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -75,36 +75,36 @@
//!
static const allocator_arg_t allocator_arg = allocator_arg_t();
-//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed
-//! with an allocator as its last constructor argument. Ideally, all constructors of T (including the
-//! copy and move constructors) should have a variant that accepts a final argument of
-//! allocator_type.
+//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed
+//! with an allocator as its last constructor argument. Ideally, all constructors of T (including the
+//! copy and move constructors) should have a variant that accepts a final argument of
+//! allocator_type.
//!
-//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type,
-//! allocator_type and at least one constructor for which allocator_type is the last
-//! parameter. If not all constructors of T can be called with a final allocator_type argument,
-//! and if T is used in a context where a container must call such a constructor, then the program is
-//! ill-formed.
+//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type,
+//! allocator_type and at least one constructor for which allocator_type is the last
+//! parameter. If not all constructors of T can be called with a final allocator_type argument,
+//! and if T is used in a context where a container must call such a constructor, then the program is
+//! ill-formed.
//!
-//! [Example:
-//! template <class T, class A = allocator<T> >
-//! class Z {
-//! public:
-//! typedef A allocator_type;
+//! [Example:
+//! template <class T, class A = allocator<T> >
+//! class Z {
+//! public:
+//! typedef A allocator_type;
//!
-//! // Default constructor with optional allocator suffix
-//! Z(const allocator_type& a = allocator_type());
+//! // Default constructor with optional allocator suffix
+//! Z(const allocator_type& a = allocator_type());
//!
-//! // Copy constructor and allocator-extended copy constructor
-//! Z(const Z& zz);
-//! Z(const Z& zz, const allocator_type& a);
-//! };
+//! // Copy constructor and allocator-extended copy constructor
+//! Z(const Z& zz);
+//! Z(const Z& zz, const allocator_type& a);
+//! };
//!
-//! // Specialize trait for class template Z
-//! template <class T, class A = allocator<T> >
-//! struct constructible_with_allocator_suffix<Z<T,A> >
+//! // Specialize trait for class template Z
+//! template <class T, class A = allocator<T> >
+//! struct constructible_with_allocator_suffix<Z<T,A> >
//! : ::boost::true_type { };
-//! -- end example]
+//! -- end example]
//!
//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)"
//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as
@@ -117,44 +117,44 @@
template <class T>
struct constructible_with_allocator_suffix
: ::boost::false_type
-{};
+{};
-//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed
-//! with allocator_arg and T::allocator_type as its first two constructor arguments.
-//! Ideally, all constructors of T (including the copy and move constructors) should have a variant
+//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed
+//! with allocator_arg and T::allocator_type as its first two constructor arguments.
+//! Ideally, all constructors of T (including the copy and move constructors) should have a variant
//! that accepts these two initial arguments.
//!
-//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type,
-//! allocator_type and at least one constructor for which allocator_arg_t is the first
-//! parameter and allocator_type is the second parameter. If not all constructors of T can be
-//! called with these initial arguments, and if T is used in a context where a container must call such
+//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type,
+//! allocator_type and at least one constructor for which allocator_arg_t is the first
+//! parameter and allocator_type is the second parameter. If not all constructors of T can be
+//! called with these initial arguments, and if T is used in a context where a container must call such
//! a constructor, then the program is ill-formed.
//!
-//! [Example:
-//! template <class T, class A = allocator<T> >
-//! class Y {
-//! public:
-//! typedef A allocator_type;
-//!
-//! // Default constructor with and allocator-extended default constructor
-//! Y();
-//! Y(allocator_arg_t, const allocator_type& a);
-//!
-//! // Copy constructor and allocator-extended copy constructor
-//! Y(const Y& yy);
-//! Y(allocator_arg_t, const allocator_type& a, const Y& yy);
-//!
-//! // Variadic constructor and allocator-extended variadic constructor
-//! template<class ...Args> Y(Args&& args...);
-//! template<class ...Args>
-//! Y(allocator_arg_t, const allocator_type& a, Args&&... args);
-//! };
-//!
-//! // Specialize trait for class template Y
-//! template <class T, class A = allocator<T> >
-//! struct constructible_with_allocator_prefix<Y<T,A> >
-//! : ::boost::true_type { };
-//!
+//! [Example:
+//! template <class T, class A = allocator<T> >
+//! class Y {
+//! public:
+//! typedef A allocator_type;
+//!
+//! // Default constructor with and allocator-extended default constructor
+//! Y();
+//! Y(allocator_arg_t, const allocator_type& a);
+//!
+//! // Copy constructor and allocator-extended copy constructor
+//! Y(const Y& yy);
+//! Y(allocator_arg_t, const allocator_type& a, const Y& yy);
+//!
+//! // Variadic constructor and allocator-extended variadic constructor
+//! template<class ...Args> Y(Args&& args...);
+//! template<class ...Args>
+//! Y(allocator_arg_t, const allocator_type& a, Args&&... args);
+//! };
+//!
+//! // Specialize trait for class template Y
+//! template <class T, class A = allocator<T> >
+//! struct constructible_with_allocator_prefix<Y<T,A> >
+//! : ::boost::true_type { };
+//!
//! -- end example]
//!
//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)"
@@ -166,7 +166,7 @@
//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used
//! to detect if a type should be constructed with suffix or prefix allocator arguments.
template <class T>
-struct constructible_with_allocator_prefix
+struct constructible_with_allocator_prefix
: ::boost::false_type
{};
@@ -201,12 +201,12 @@
///@endcond
-//! <b>Remark</b>: Automatically detects if T has a nested allocator_type that is convertible from
-//! Alloc. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may
+//! <b>Remark</b>: Automatically detects if T has a nested allocator_type that is convertible from
+//! Alloc. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may
//! specialize this type to derive from true_type for a T of user-defined type if T does not
-//! have a nested allocator_type but is nonetheless constructible using the specified Alloc.
+//! have a nested allocator_type but is nonetheless constructible using the specified Alloc.
//!
-//! <b>Result</b>: derived from true_type if Convertible<Alloc,T::allocator_type> and
+//! <b>Result</b>: derived from true_type if Convertible<Alloc,T::allocator_type> and
//! derived from false_type otherwise.
template <typename T, typename Alloc>
struct uses_allocator
@@ -340,7 +340,7 @@
//!
//Generate N+1 template parameters so that we can specialize N
- template<class T
+ template<class T
BOOST_PP_ENUM_TRAILING( BOOST_PP_ADD(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1)
, BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
, void)
@@ -379,7 +379,7 @@
#include BOOST_PP_LOCAL_ITERATE()
//Finally just inherit from the implementation to define he trait
- template< class T
+ template< class T
BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS
, BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
, void)
@@ -388,14 +388,14 @@
: boost::integral_constant
< bool
, is_constructible_impl
- < T
+ < T
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, P)
, void>::value
>
{};
//Finally just inherit from the implementation to define he trait
- template <class T
+ template <class T
,class InnerAlloc
BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 2)
, BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
@@ -408,7 +408,7 @@
>
{};
/*
- template <class T
+ template <class T
,class InnerAlloc
BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1)
, BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
@@ -443,7 +443,7 @@
#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
- template < class T
+ template < class T
, class InnerAlloc
BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
, BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
@@ -453,7 +453,7 @@
: constructible_with_allocator_prefix<T>
{};
/*
- template < class T
+ template < class T
, class InnerAlloc
BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
, BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT
@@ -954,7 +954,7 @@
scoped_allocator_adaptor_base(internal_type_t, BOOST_FWD_REF(OuterA2) outerAlloc, const inner_allocator_type &)
: outer_allocator_type(::boost::forward<OuterA2>(outerAlloc))
{}
-
+
public:
scoped_allocator_adaptor_base &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)
{
@@ -991,36 +991,36 @@
#if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
//! This class is a C++03-compatible implementation of std::scoped_allocator_adaptor.
- //! The class template scoped_allocator_adaptor is an allocator template that specifies
- //! the memory resource (the outer allocator) to be used by a container (as any other
- //! allocator does) and also specifies an inner allocator resource to be passed to
+ //! The class template scoped_allocator_adaptor is an allocator template that specifies
+ //! the memory resource (the outer allocator) to be used by a container (as any other
+ //! allocator does) and also specifies an inner allocator resource to be passed to
//! the constructor of every element within the container.
//!
- //! This adaptor is
- //! instantiated with one outer and zero or more inner allocator types. If
- //! instantiated with only one allocator type, the inner allocator becomes the
- //! scoped_allocator_adaptor itself, thus using the same allocator resource for the
- //! container and every element within the container and, if the elements themselves
- //! are containers, each of their elements recursively. If instantiated with more than
+ //! This adaptor is
+ //! instantiated with one outer and zero or more inner allocator types. If
+ //! instantiated with only one allocator type, the inner allocator becomes the
+ //! scoped_allocator_adaptor itself, thus using the same allocator resource for the
+ //! container and every element within the container and, if the elements themselves
+ //! are containers, each of their elements recursively. If instantiated with more than
//! one allocator, the first allocator is the outer allocator for use by the container,
- //! the second allocator is passed to the constructors of the container's elements,
- //! and, if the elements themselves are containers, the third allocator is passed to
- //! the elements' elements, and so on. If containers are nested to a depth greater
- //! than the number of allocators, the last allocator is used repeatedly, as in the
- //! single-allocator case, for any remaining recursions.
+ //! the second allocator is passed to the constructors of the container's elements,
+ //! and, if the elements themselves are containers, the third allocator is passed to
+ //! the elements' elements, and so on. If containers are nested to a depth greater
+ //! than the number of allocators, the last allocator is used repeatedly, as in the
+ //! single-allocator case, for any remaining recursions.
//!
//! [<b>Note</b>: The
- //! scoped_allocator_adaptor is derived from the outer allocator type so it can be
+ //! scoped_allocator_adaptor is derived from the outer allocator type so it can be
//! substituted for the outer allocator type in most expressions. -end note]
//!
- //! In the construct member functions, `OUTERMOST(x)` is x if x does not have
+ //! In the construct member functions, `OUTERMOST(x)` is x if x does not have
//! an `outer_allocator()` member function and
//! `OUTERMOST(x.outer_allocator())` otherwise; `OUTERMOST_ALLOC_TRAITS(x)` is
//! `allocator_traits<decltype(OUTERMOST(x))>`.
//!
//! [<b>Note</b>: `OUTERMOST(x)` and
- //! `OUTERMOST_ALLOC_TRAITS(x)` are recursive operations. It is incumbent upon
- //! the definition of `outer_allocator()` to ensure that the recursion terminates.
+ //! `OUTERMOST_ALLOC_TRAITS(x)` are recursive operations. It is incumbent upon
+ //! the definition of `outer_allocator()` to ensure that the recursion terminates.
//! It will terminate for all instantiations of scoped_allocator_adaptor. -end note]
template <typename OuterAlloc, typename ...InnerAllocs>
class scoped_allocator_adaptor
@@ -1120,7 +1120,7 @@
: base_type(other.base())
{}
- //! <b>Effects</b>: move constructs each allocator within the adaptor with
+ //! <b>Effects</b>: move constructs each allocator within the adaptor with
//! the corresponding allocator from other.
scoped_allocator_adaptor(BOOST_RV_REF(scoped_allocator_adaptor) other)
: base_type(::boost::move(other.base()))
@@ -1131,7 +1131,7 @@
//! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2.
//!
//! <b>Effects</b>: initializes the OuterAlloc base class with boost::forward<OuterA2>(outerAlloc) and inner
- //! with innerAllocs...(hence recursively initializing each allocator within the adaptor with the
+ //! with innerAllocs...(hence recursively initializing each allocator within the adaptor with the
//! corresponding allocator from the argument list).
template <class OuterA2>
scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs & ...innerAllocs)
@@ -1169,7 +1169,7 @@
//! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2.
//!
- //! <b>Effects</b>: initializes each allocator within the adaptor with the corresponding allocator
+ //! <b>Effects</b>: initializes each allocator within the adaptor with the corresponding allocator
//! rvalue from other.
template <class OuterA2>
scoped_allocator_adaptor(BOOST_RV_REF_BEG scoped_allocator_adaptor<OuterA2
@@ -1221,7 +1221,7 @@
return outer_traits_type::max_size(this->outer_allocator());
}
- //! <b>Effects</b>:
+ //! <b>Effects</b>:
//! calls `OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p)`.
template <class T>
void destroy(T* p)
@@ -1230,14 +1230,14 @@
::destroy(get_outermost_allocator(this->outer_allocator()), p);
}
- //! <b>Returns</b>:
+ //! <b>Returns</b>:
//! `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)`.
pointer allocate(size_type n)
{
return outer_traits_type::allocate(this->outer_allocator(), n);
}
- //! <b>Returns</b>:
+ //! <b>Returns</b>:
//! `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)`.
pointer allocate(size_type n, const_void_pointer hint)
{
@@ -1252,7 +1252,7 @@
}
//! <b>Returns</b>: A new scoped_allocator_adaptor object where each allocator
- //! A in the adaptor is initialized from the result of calling
+ //! A in the adaptor is initialized from the result of calling
//! `allocator_traits<A>::select_on_container_copy_construction()` on
//! the corresponding allocator in *this.
scoped_allocator_adaptor select_on_container_copy_construction() const
@@ -1275,21 +1275,21 @@
//! 1) If `uses_allocator<T, inner_allocator_type>::value` is false calls
//! `OUTERMOST_ALLOC_TRAITS(*this)::construct
//! (OUTERMOST(*this), p, std::forward<Args>(args)...)`.
- //!
- //! 2) Otherwise, if `uses_allocator<T, inner_allocator_type>::value` is true and
+ //!
+ //! 2) Otherwise, if `uses_allocator<T, inner_allocator_type>::value` is true and
//! `is_constructible<T, allocator_arg_t, inner_allocator_type, Args...>::value` is true, calls
//! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, allocator_arg,
//! inner_allocator(), std::forward<Args>(args)...)`.
- //!
+ //!
//! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't
//! be implemented so that condition will be replaced by
//! constructible_with_allocator_prefix<T>::value. -end note]
//!
- //! 3) Otherwise, if uses_allocator<T, inner_allocator_type>::value is true and
- //! `is_constructible<T, Args..., inner_allocator_type>::value` is true, calls
- //! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p,
+ //! 3) Otherwise, if uses_allocator<T, inner_allocator_type>::value is true and
+ //! `is_constructible<T, Args..., inner_allocator_type>::value` is true, calls
+ //! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p,
//! std::forward<Args>(args)..., inner_allocator())`.
- //!
+ //!
//! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't be
//! implemented so that condition will be replaced by
//! `constructible_with_allocator_suffix<T>::value`. -end note]
@@ -1352,7 +1352,7 @@
template <class T1, class T2, class U, class V>
void construct(container_detail::pair<T1, T2>* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
{ this->construct_pair(p, ::boost::forward<U>(x), ::boost::forward<V>(y)); }
-
+
template <class T1, class T2, class U, class V>
void construct(std::pair<T1, T2>* p, const std::pair<U, V>& x)
{ this->construct_pair(p, x); }
@@ -1361,7 +1361,7 @@
void construct( container_detail::pair<T1, T2>* p
, const container_detail::pair<U, V>& x)
{ this->construct_pair(p, x); }
-
+
template <class T1, class T2, class U, class V>
void construct( std::pair<T1, T2>* p
, BOOST_RV_REF_BEG std::pair<U, V> BOOST_RV_REF_END x)
@@ -1461,7 +1461,7 @@
#endif
>& b)
{
- #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
const bool has_zero_inner = sizeof...(InnerAllocs) == 0u;
#else
const bool has_zero_inner =
Modified: branches/release/boost/container/set.hpp
==============================================================================
--- branches/release/boost/container/set.hpp (original)
+++ branches/release/boost/container/set.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -42,32 +42,32 @@
/// @cond
// Forward declarations of operators < and ==, needed for friend declaration.
template <class T, class Pred, class A>
-inline bool operator==(const set<T,Pred,A>& x,
+inline bool operator==(const set<T,Pred,A>& x,
const set<T,Pred,A>& y);
template <class T, class Pred, class A>
-inline bool operator<(const set<T,Pred,A>& x,
+inline bool operator<(const set<T,Pred,A>& x,
const set<T,Pred,A>& y);
/// @endcond
-//! A set is a kind of associative container that supports unique keys (contains at
-//! most one of each key value) and provides for fast retrieval of the keys themselves.
-//! Class set supports bidirectional iterators.
-//!
-//! A set satisfies all of the requirements of a container and of a reversible container
-//! , and of an associative container. A set also provides most operations described in
+//! A set is a kind of associative container that supports unique keys (contains at
+//! most one of each key value) and provides for fast retrieval of the keys themselves.
+//! Class set supports bidirectional iterators.
+//!
+//! A set satisfies all of the requirements of a container and of a reversible container
+//! , and of an associative container. A set also provides most operations described in
//! for unique keys.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Pred = std::less<T>, class A = std::allocator<T> >
#else
template <class T, class Pred, class A>
#endif
-class set
+class set
{
/// @cond
private:
BOOST_COPYABLE_AND_MOVABLE(set)
- typedef container_detail::rbtree<T, T,
+ typedef container_detail::rbtree<T, T,
container_detail::identity<T>, Pred, A> tree_t;
tree_t m_tree; // red-black tree representing set
typedef typename container_detail::
@@ -95,66 +95,66 @@
typedef typename tree_t::stored_allocator_type stored_allocator_type;
//! <b>Effects</b>: Default constructs an empty set.
- //!
+ //!
//! <b>Complexity</b>: Constant.
set()
: m_tree()
{}
- //! <b>Effects</b>: Constructs an empty set using the specified comparison object
+ //! <b>Effects</b>: Constructs an empty set using the specified comparison object
//! and allocator.
- //!
+ //!
//! <b>Complexity</b>: Constant.
explicit set(const Pred& comp,
const allocator_type& a = allocator_type())
: m_tree(comp, a)
{}
- //! <b>Effects</b>: Constructs an empty set using the specified comparison object and
+ //! <b>Effects</b>: Constructs an empty set using the specified comparison object and
//! allocator, and inserts elements from the range [first ,last ).
- //!
- //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
+ //!
+ //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first.
template <class InputIterator>
set(InputIterator first, InputIterator last, const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
- : m_tree(first, last, comp, a, true)
+ : m_tree(first, last, comp, a, true)
{}
- //! <b>Effects</b>: Constructs an empty set using the specified comparison object and
+ //! <b>Effects</b>: Constructs an empty set using the specified comparison object and
//! allocator, and inserts elements from the ordered unique range [first ,last). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be
//! unique values.
- //!
+ //!
//! <b>Complexity</b>: Linear in N.
template <class InputIterator>
set( 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)
+ : m_tree(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Copy constructs a set.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- set(const set& x)
+ set(const set& x)
: m_tree(x.m_tree)
{}
//! <b>Effects</b>: Move constructs a set. Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Postcondition</b>: x is emptied.
- set(BOOST_RV_REF(set) x)
+ set(BOOST_RV_REF(set) x)
: m_tree(boost::move(x.m_tree))
{}
//! <b>Effects</b>: Copy constructs a set using the specified allocator.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- set(const set& x, const allocator_type &a)
+ set(const set& x, const allocator_type &a)
: m_tree(x.m_tree, a)
{}
@@ -162,7 +162,7 @@
//! Constructs *this using x's resources.
//!
//! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
- set(BOOST_RV_REF(set) x, const allocator_type &a)
+ set(BOOST_RV_REF(set) x, const allocator_type &a)
: m_tree(boost::move(x.m_tree), a)
{}
@@ -173,162 +173,162 @@
{ m_tree = x.m_tree; return *this; }
//! <b>Effects</b>: this->swap(x.get()).
- //!
+ //!
//! <b>Complexity</b>: Constant.
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.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- key_compare key_comp() const
+ key_compare key_comp() const
{ return m_tree.key_comp(); }
//! <b>Effects</b>: Returns an object of value_compare constructed out
//! of the comparison object.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- value_compare value_comp() const
+ value_compare value_comp() const
{ return m_tree.key_comp(); }
//! <b>Effects</b>: Returns a copy of the Allocator that
//! was passed to the object's constructor.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- allocator_type get_allocator() const
+ allocator_type get_allocator() const
{ return m_tree.get_allocator(); }
- const stored_allocator_type &get_stored_allocator() const
+ const stored_allocator_type &get_stored_allocator() const
{ return m_tree.get_stored_allocator(); }
stored_allocator_type &get_stored_allocator()
{ return m_tree.get_stored_allocator(); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant
- iterator begin()
+ iterator begin()
{ return m_tree.begin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const
{ return m_tree.begin(); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator end()
+ iterator end()
{ return m_tree.end(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator end() const
+ const_iterator end() const
{ return m_tree.end(); }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rbegin()
- { return m_tree.rbegin(); }
+ reverse_iterator rbegin()
+ { return m_tree.rbegin(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const
- { return m_tree.rbegin(); }
+ const_reverse_iterator rbegin() const
+ { return m_tree.rbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rend()
+ reverse_iterator rend()
{ return m_tree.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const
+ const_reverse_iterator rend() const
{ return m_tree.rend(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return m_tree.cbegin(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ const_iterator cend() const
{ return m_tree.cend(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const
- { return m_tree.crbegin(); }
+ const_reverse_iterator crbegin() const
+ { return m_tree.crbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const
{ return m_tree.crend(); }
//! <b>Effects</b>: Returns true if the container contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- bool empty() const
+ bool empty() const
{ return m_tree.empty(); }
//! <b>Effects</b>: Returns the number of the elements contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const
{ return m_tree.size(); }
//! <b>Effects</b>: Returns the largest possible size of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type max_size() const
+ size_type max_size() const
{ return m_tree.max_size(); }
//! <b>Effects</b>: Swaps the contents of *this and x.
@@ -339,15 +339,15 @@
void swap(set& x)
{ m_tree.swap(x.m_tree); }
- //! <b>Effects</b>: Inserts x if and only if there is no element in the container
+ //! <b>Effects</b>: Inserts x if and only if there is no element in the container
//! with key equivalent to the key of x.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(insert_const_ref_type x)
+ std::pair<iterator,bool> insert(insert_const_ref_type x)
{ return priv_insert(x); }
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -360,18 +360,18 @@
{ return priv_insert(u); }
#endif
- //! <b>Effects</b>: Move constructs a new value from x if and only if there is
+ //! <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.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
//! <b>Complexity</b>: Logarithmic.
- std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) 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
+ //! <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.
//! p is a hint pointing to where the insert should start to search.
//!
@@ -380,7 +380,7 @@
//!
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p.
- iterator insert(const_iterator p, insert_const_ref_type x)
+ iterator insert(const_iterator p, insert_const_ref_type x)
{ return priv_insert(p, x); }
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -399,28 +399,28 @@
//! <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_RV_REF(value_type) x)
+ iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
{ return m_tree.insert_unique(p, boost::move(x)); }
//! <b>Requires</b>: first, last are not iterators into *this.
//!
- //! <b>Effects</b>: inserts each element from the range [first,last) if and only
+ //! <b>Effects</b>: inserts each element from the range [first,last) if and only
//! if there is no element with key equivalent to the key of that element.
//!
//! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
template <class InputIterator>
- void insert(InputIterator first, InputIterator last)
+ void insert(InputIterator first, InputIterator last)
{ m_tree.insert_unique(first, last); }
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object x of type T constructed with
- //! std::forward<Args>(args)... if and only if there is
+ //! std::forward<Args>(args)... if and only if there is
//! no element in the container with equivalent value.
//! and returns the iterator pointing to the
//! newly inserted element.
//!
- //! <b>Returns</b>: The bool component of the returned pair is true if and only
+ //! <b>Returns</b>: The bool component of the returned pair is true if and only
//! if the insertion takes place, and the iterator component of the pair
//! points to the element with key equivalent to the key of x.
//!
@@ -433,7 +433,7 @@
{ 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
+ //! std::forward<Args>(args)... if and only if there is
//! no element in the container with equivalent value.
//! p is a hint pointing to where the insert
//! should start to search.
@@ -466,11 +466,11 @@
//! <b>Effects</b>: Erases the element pointed to by p.
//!
//! <b>Returns</b>: Returns an iterator pointing to the element immediately
- //! following q prior to the element being erased. If no such element exists,
+ //! following q prior to the element being erased. If no such element exists,
//! returns end().
//!
//! <b>Complexity</b>: Amortized constant time
- iterator erase(const_iterator p)
+ iterator erase(const_iterator p)
{ return m_tree.erase(p); }
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
@@ -478,7 +478,7 @@
//! <b>Returns</b>: Returns the number of erased elements.
//!
//! <b>Complexity</b>: log(size()) + count(k)
- size_type erase(const key_type& x)
+ size_type erase(const key_type& x)
{ return m_tree.erase(x); }
//! <b>Effects</b>: Erases all the elements in the range [first, last).
@@ -486,7 +486,7 @@
//! <b>Returns</b>: Returns last.
//!
//! <b>Complexity</b>: log(size())+N where N is the distance from first to last.
- iterator erase(const_iterator first, const_iterator last)
+ iterator erase(const_iterator first, const_iterator last)
{ return m_tree.erase(first, last); }
//! <b>Effects</b>: erase(a.begin(),a.end()).
@@ -494,41 +494,41 @@
//! <b>Postcondition</b>: size() == 0.
//!
//! <b>Complexity</b>: linear in size().
- void clear()
+ void clear()
{ m_tree.clear(); }
//! <b>Returns</b>: An iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator find(const key_type& x)
+ iterator find(const key_type& x)
{ return m_tree.find(x); }
//! <b>Returns</b>: A const_iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- const_iterator find(const key_type& x) const
+ const_iterator find(const key_type& x) const
{ return m_tree.find(x); }
//! <b>Returns</b>: The number of elements with key equivalent to x.
//!
//! <b>Complexity</b>: log(size())+count(k)
- size_type count(const key_type& x) const
+ size_type count(const key_type& x) const
{ return m_tree.find(x) == m_tree.end() ? 0 : 1; }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- iterator lower_bound(const key_type& x)
+ iterator lower_bound(const key_type& x)
{ return m_tree.lower_bound(x); }
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator lower_bound(const key_type& x) const
+ const_iterator lower_bound(const key_type& x) const
{ return m_tree.lower_bound(x); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
@@ -542,21 +542,21 @@
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator upper_bound(const key_type& x) const
+ const_iterator upper_bound(const key_type& x) const
{ return m_tree.upper_bound(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<iterator,iterator>
- equal_range(const key_type& x)
+ std::pair<iterator,iterator>
+ equal_range(const key_type& x)
{ return m_tree.equal_range(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<const_iterator, const_iterator>
- equal_range(const key_type& x) const
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& x) const
{ return m_tree.equal_range(x); }
/// @cond
@@ -567,47 +567,47 @@
friend bool operator< (const set<K1,C1,A1>&, const set<K1,C1,A1>&);
private:
- std::pair<iterator, bool> priv_insert(const T &x)
+ std::pair<iterator, bool> priv_insert(const T &x)
{ return m_tree.insert_unique(x); }
- iterator priv_insert(const_iterator p, const T &x)
+ iterator priv_insert(const_iterator p, const T &x)
{ return m_tree.insert_unique(p, x); }
/// @endcond
};
template <class T, class Pred, class A>
-inline bool operator==(const set<T,Pred,A>& x,
- const set<T,Pred,A>& y)
+inline bool operator==(const set<T,Pred,A>& x,
+ const set<T,Pred,A>& y)
{ return x.m_tree == y.m_tree; }
template <class T, class Pred, class A>
-inline bool operator<(const set<T,Pred,A>& x,
- const set<T,Pred,A>& y)
+inline bool operator<(const set<T,Pred,A>& x,
+ const set<T,Pred,A>& y)
{ return x.m_tree < y.m_tree; }
template <class T, class Pred, class A>
-inline bool operator!=(const set<T,Pred,A>& x,
- const set<T,Pred,A>& y)
+inline bool operator!=(const set<T,Pred,A>& x,
+ const set<T,Pred,A>& y)
{ return !(x == y); }
template <class T, class Pred, class A>
-inline bool operator>(const set<T,Pred,A>& x,
- const set<T,Pred,A>& y)
+inline bool operator>(const set<T,Pred,A>& x,
+ const set<T,Pred,A>& y)
{ return y < x; }
template <class T, class Pred, class A>
-inline bool operator<=(const set<T,Pred,A>& x,
- const set<T,Pred,A>& y)
+inline bool operator<=(const set<T,Pred,A>& x,
+ const set<T,Pred,A>& y)
{ return !(y < x); }
template <class T, class Pred, class A>
-inline bool operator>=(const set<T,Pred,A>& x,
- const set<T,Pred,A>& y)
+inline bool operator>=(const set<T,Pred,A>& x,
+ const set<T,Pred,A>& y)
{ return !(x < y); }
template <class T, class Pred, class A>
-inline void swap(set<T,Pred,A>& x, set<T,Pred,A>& y)
+inline void swap(set<T,Pred,A>& x, set<T,Pred,A>& y)
{ x.swap(y); }
/// @cond
@@ -627,32 +627,32 @@
// Forward declaration of operators < and ==, needed for friend declaration.
template <class T, class Pred, class A>
-inline bool operator==(const multiset<T,Pred,A>& x,
+inline bool operator==(const multiset<T,Pred,A>& x,
const multiset<T,Pred,A>& y);
template <class T, class Pred, class A>
-inline bool operator<(const multiset<T,Pred,A>& x,
+inline bool operator<(const multiset<T,Pred,A>& x,
const multiset<T,Pred,A>& y);
/// @endcond
-//! A multiset is a kind of associative container that supports equivalent keys
-//! (possibly contains multiple copies of the same key value) and provides for
+//! A multiset is a kind of associative container that supports equivalent keys
+//! (possibly contains multiple copies of the same key value) and provides for
//! fast retrieval of the keys themselves. Class multiset supports bidirectional iterators.
-//!
-//! A multiset satisfies all of the requirements of a container and of a reversible
-//! container, and of an associative container). multiset also provides most operations
+//!
+//! A multiset satisfies all of the requirements of a container and of a reversible
+//! container, and of an associative container). multiset also provides most operations
//! described for duplicate keys.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Pred = std::less<T>, class A = std::allocator<T> >
#else
template <class T, class Pred, class A>
#endif
-class multiset
+class multiset
{
/// @cond
private:
BOOST_COPYABLE_AND_MOVABLE(multiset)
- typedef container_detail::rbtree<T, T,
+ typedef container_detail::rbtree<T, T,
container_detail::identity<T>, Pred, A> tree_t;
tree_t m_tree; // red-black tree representing multiset
typedef typename container_detail::
@@ -681,7 +681,7 @@
//! <b>Effects</b>: Constructs an empty multiset using the specified comparison
//! object and allocator.
- //!
+ //!
//! <b>Complexity</b>: Constant.
multiset()
: m_tree()
@@ -689,7 +689,7 @@
//! <b>Effects</b>: Constructs an empty multiset using the specified comparison
//! object and allocator.
- //!
+ //!
//! <b>Complexity</b>: Constant.
explicit multiset(const Pred& comp,
const allocator_type& a = allocator_type())
@@ -698,226 +698,226 @@
//! <b>Effects</b>: Constructs an empty multiset using the specified comparison object
//! and allocator, and inserts elements from the range [first ,last ).
- //!
- //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
+ //!
+ //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using
//! comp and otherwise N logN, where N is last - first.
template <class InputIterator>
multiset(InputIterator first, InputIterator last,
const Pred& comp = Pred(),
const allocator_type& a = allocator_type())
- : m_tree(first, last, comp, a, false)
+ : m_tree(first, last, comp, a, false)
{}
- //! <b>Effects</b>: Constructs an empty multiset using the specified comparison object and
+ //! <b>Effects</b>: Constructs an empty multiset using the specified comparison object and
//! allocator, and inserts elements from the ordered range [first ,last ). This function
//! is more efficient than the normal range creation for ordered ranges.
//!
//! <b>Requires</b>: [first ,last) must be ordered according to the predicate.
- //!
+ //!
//! <b>Complexity</b>: Linear in N.
template <class InputIterator>
multiset( ordered_range_t ordered_range, InputIterator first, InputIterator last
, const Pred& comp = Pred()
, const allocator_type& a = allocator_type())
- : m_tree(ordered_range, first, last, comp, a)
+ : m_tree(ordered_range, first, last, comp, a)
{}
//! <b>Effects</b>: Copy constructs a multiset.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- multiset(const multiset& x)
+ multiset(const multiset& x)
: m_tree(x.m_tree)
{}
//! <b>Effects</b>: Move constructs a multiset. Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Postcondition</b>: x is emptied.
- multiset(BOOST_RV_REF(multiset) x)
+ multiset(BOOST_RV_REF(multiset) x)
: m_tree(boost::move(x.m_tree))
{}
//! <b>Effects</b>: Copy constructs a multiset using the specified allocator.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- multiset(const multiset& x, const allocator_type &a)
+ multiset(const multiset& x, const allocator_type &a)
: m_tree(x.m_tree, a)
{}
//! <b>Effects</b>: Move constructs a multiset using the specified allocator.
//! Constructs *this using x's resources.
- //!
+ //!
//! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
- //!
+ //!
//! <b>Postcondition</b>: x is emptied.
- multiset(BOOST_RV_REF(multiset) x, const allocator_type &a)
+ multiset(BOOST_RV_REF(multiset) x, const allocator_type &a)
: m_tree(boost::move(x.m_tree), a)
{}
//! <b>Effects</b>: Makes *this a copy of x.
- //!
+ //!
//! <b>Complexity</b>: Linear in x.size().
- multiset& operator=(BOOST_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_RV_REF(multiset) x)
+ 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.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- key_compare key_comp() const
+ key_compare key_comp() const
{ return m_tree.key_comp(); }
//! <b>Effects</b>: Returns an object of value_compare constructed out
//! of the comparison object.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- value_compare value_comp() const
+ value_compare value_comp() const
{ return m_tree.key_comp(); }
//! <b>Effects</b>: Returns a copy of the Allocator that
//! was passed to the object's constructor.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- allocator_type get_allocator() const
+ allocator_type get_allocator() const
{ return m_tree.get_allocator(); }
- const stored_allocator_type &get_stored_allocator() const
+ const stored_allocator_type &get_stored_allocator() const
{ return m_tree.get_stored_allocator(); }
stored_allocator_type &get_stored_allocator()
{ return m_tree.get_stored_allocator(); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator begin()
+ iterator begin()
{ return m_tree.begin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const
{ return m_tree.begin(); }
//! <b>Effects</b>: Returns an iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator end()
+ iterator end()
{ return m_tree.end(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator end() const
+ const_iterator end() const
{ return m_tree.end(); }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rbegin()
- { return m_tree.rbegin(); }
+ reverse_iterator rbegin()
+ { return m_tree.rbegin(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const
- { return m_tree.rbegin(); }
+ const_reverse_iterator rbegin() const
+ { return m_tree.rbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rend()
+ reverse_iterator rend()
{ return m_tree.rend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const
+ const_reverse_iterator rend() const
{ return m_tree.rend(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return m_tree.cbegin(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ const_iterator cend() const
{ return m_tree.cend(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed container.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const
- { return m_tree.crbegin(); }
+ const_reverse_iterator crbegin() const
+ { return m_tree.crbegin(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed container.
- //!
+ //! of the reversed container.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const
{ return m_tree.crend(); }
//! <b>Effects</b>: Returns true if the container contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- bool empty() const
+ bool empty() const
{ return m_tree.empty(); }
//! <b>Effects</b>: Returns the number of the elements contained in the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const
{ return m_tree.size(); }
//! <b>Effects</b>: Returns the largest possible size of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type max_size() const
+ size_type max_size() const
{ return m_tree.max_size(); }
//! <b>Effects</b>: Swaps the contents of *this and x.
@@ -929,10 +929,10 @@
{ m_tree.swap(x.m_tree); }
//! <b>Effects</b>: Inserts x and returns the iterator pointing to the
- //! newly inserted element.
+ //! newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator insert(insert_const_ref_type x)
+ iterator insert(insert_const_ref_type x)
{ return priv_insert(x); }
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -952,7 +952,7 @@
//!
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p.
- iterator insert(BOOST_RV_REF(value_type) 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.
@@ -963,7 +963,7 @@
//!
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p.
- iterator insert(const_iterator p, insert_const_ref_type x)
+ iterator insert(const_iterator p, insert_const_ref_type x)
{ return priv_insert(p, x); }
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -984,7 +984,7 @@
//!
//! <b>Complexity</b>: Logarithmic in general, but amortized constant if t
//! is inserted right before p.
- iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
+ iterator insert(const_iterator p, BOOST_RV_REF(value_type) x)
{ return m_tree.insert_equal(p, boost::move(x)); }
//! <b>Requires</b>: first, last are not iterators into *this.
@@ -993,14 +993,14 @@
//!
//! <b>Complexity</b>: At most N log(size()+N) (N is the distance from first to last)
template <class InputIterator>
- void insert(InputIterator first, InputIterator last)
+ void insert(InputIterator first, InputIterator last)
{ m_tree.insert_equal(first, last); }
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... and returns the iterator pointing to the
- //! newly inserted element.
+ //! newly inserted element.
//!
//! <b>Complexity</b>: Logarithmic.
template <class... Args>
@@ -1040,11 +1040,11 @@
//! <b>Effects</b>: Erases the element pointed to by p.
//!
//! <b>Returns</b>: Returns an iterator pointing to the element immediately
- //! following q prior to the element being erased. If no such element exists,
+ //! following q prior to the element being erased. If no such element exists,
//! returns end().
//!
//! <b>Complexity</b>: Amortized constant time
- iterator erase(const_iterator p)
+ iterator erase(const_iterator p)
{ return m_tree.erase(p); }
//! <b>Effects</b>: Erases all elements in the container with key equivalent to x.
@@ -1052,7 +1052,7 @@
//! <b>Returns</b>: Returns the number of erased elements.
//!
//! <b>Complexity</b>: log(size()) + count(k)
- size_type erase(const key_type& x)
+ size_type erase(const key_type& x)
{ return m_tree.erase(x); }
//! <b>Effects</b>: Erases all the elements in the range [first, last).
@@ -1068,41 +1068,41 @@
//! <b>Postcondition</b>: size() == 0.
//!
//! <b>Complexity</b>: linear in size().
- void clear()
+ void clear()
{ m_tree.clear(); }
//! <b>Returns</b>: An iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- iterator find(const key_type& x)
+ iterator find(const key_type& x)
{ return m_tree.find(x); }
//! <b>Returns</b>: A const iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
- const_iterator find(const key_type& x) const
+ const_iterator find(const key_type& x) const
{ return m_tree.find(x); }
//! <b>Returns</b>: The number of elements with key equivalent to x.
//!
//! <b>Complexity</b>: log(size())+count(k)
- size_type count(const key_type& x) const
+ size_type count(const key_type& x) const
{ return m_tree.count(x); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
//! than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- iterator lower_bound(const key_type& x)
+ iterator lower_bound(const key_type& x)
{ return m_tree.lower_bound(x); }
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator lower_bound(const key_type& x) const
+ const_iterator lower_bound(const key_type& x) const
{ return m_tree.lower_bound(x); }
//! <b>Returns</b>: An iterator pointing to the first element with key not less
@@ -1116,21 +1116,21 @@
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
- const_iterator upper_bound(const key_type& x) const
+ const_iterator upper_bound(const key_type& x) const
{ return m_tree.upper_bound(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<iterator,iterator>
- equal_range(const key_type& x)
+ std::pair<iterator,iterator>
+ equal_range(const key_type& x)
{ return m_tree.equal_range(x); }
//! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)).
//!
//! <b>Complexity</b>: Logarithmic
- std::pair<const_iterator, const_iterator>
- equal_range(const key_type& x) const
+ std::pair<const_iterator, const_iterator>
+ equal_range(const key_type& x) const
{ return m_tree.equal_range(x); }
/// @cond
@@ -1141,47 +1141,47 @@
friend bool operator< (const multiset<K1,C1,A1>&,
const multiset<K1,C1,A1>&);
private:
- iterator priv_insert(const T &x)
+ iterator priv_insert(const T &x)
{ return m_tree.insert_equal(x); }
- iterator priv_insert(const_iterator p, const T &x)
+ iterator priv_insert(const_iterator p, const T &x)
{ return m_tree.insert_equal(p, x); }
/// @endcond
};
template <class T, class Pred, class A>
-inline bool operator==(const multiset<T,Pred,A>& x,
- const multiset<T,Pred,A>& y)
+inline bool operator==(const multiset<T,Pred,A>& x,
+ const multiset<T,Pred,A>& y)
{ return x.m_tree == y.m_tree; }
template <class T, class Pred, class A>
-inline bool operator<(const multiset<T,Pred,A>& x,
- const multiset<T,Pred,A>& y)
+inline bool operator<(const multiset<T,Pred,A>& x,
+ const multiset<T,Pred,A>& y)
{ return x.m_tree < y.m_tree; }
template <class T, class Pred, class A>
-inline bool operator!=(const multiset<T,Pred,A>& x,
- const multiset<T,Pred,A>& y)
+inline bool operator!=(const multiset<T,Pred,A>& x,
+ const multiset<T,Pred,A>& y)
{ return !(x == y); }
template <class T, class Pred, class A>
-inline bool operator>(const multiset<T,Pred,A>& x,
- const multiset<T,Pred,A>& y)
+inline bool operator>(const multiset<T,Pred,A>& x,
+ const multiset<T,Pred,A>& y)
{ return y < x; }
template <class T, class Pred, class A>
-inline bool operator<=(const multiset<T,Pred,A>& x,
- const multiset<T,Pred,A>& y)
+inline bool operator<=(const multiset<T,Pred,A>& x,
+ const multiset<T,Pred,A>& y)
{ return !(y < x); }
template <class T, class Pred, class A>
-inline bool operator>=(const multiset<T,Pred,A>& x,
- const multiset<T,Pred,A>& y)
+inline bool operator>=(const multiset<T,Pred,A>& x,
+ const multiset<T,Pred,A>& y)
{ return !(x < y); }
template <class T, class Pred, class A>
-inline void swap(multiset<T,Pred,A>& x, multiset<T,Pred,A>& y)
+inline void swap(multiset<T,Pred,A>& x, multiset<T,Pred,A>& y)
{ x.swap(y); }
/// @cond
Modified: branches/release/boost/container/slist.hpp
==============================================================================
--- branches/release/boost/container/slist.hpp (original)
+++ branches/release/boost/container/slist.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -32,7 +32,7 @@
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//Preprocessor library to emulate perfect forwarding
#else
-#include <boost/container/detail/preprocessor.hpp>
+#include <boost/container/detail/preprocessor.hpp>
#endif
#include <stdexcept>
@@ -99,51 +99,51 @@
/// @endcond
-//! An slist is a singly linked list: a list where each element is linked to the next
-//! element, but not to the previous element. That is, it is a Sequence that
-//! supports forward but not backward traversal, and (amortized) constant time
-//! insertion and removal of elements. Slists, like lists, have the important
-//! property that insertion and splicing do not invalidate iterators to list elements,
-//! and that even removal invalidates only the iterators that point to the elements
-//! that are removed. The ordering of iterators may be changed (that is,
-//! slist<T>::iterator might have a different predecessor or successor after a list
-//! operation than it did before), but the iterators themselves will not be invalidated
+//! An slist is a singly linked list: a list where each element is linked to the next
+//! element, but not to the previous element. That is, it is a Sequence that
+//! supports forward but not backward traversal, and (amortized) constant time
+//! insertion and removal of elements. Slists, like lists, have the important
+//! property that insertion and splicing do not invalidate iterators to list elements,
+//! and that even removal invalidates only the iterators that point to the elements
+//! that are removed. The ordering of iterators may be changed (that is,
+//! slist<T>::iterator might have a different predecessor or successor after a list
+//! operation than it did before), but the iterators themselves will not be invalidated
//! or made to point to different elements unless that invalidation or mutation is explicit.
//!
-//! The main difference between slist and list is that list's iterators are bidirectional
-//! iterators, while slist's iterators are forward iterators. This means that slist is
-//! less versatile than list; frequently, however, bidirectional iterators are
-//! unnecessary. You should usually use slist unless you actually need the extra
-//! functionality of list, because singly linked lists are smaller and faster than double
-//! linked lists.
-//!
-//! Important performance note: like every other Sequence, slist defines the member
-//! functions insert and erase. Using these member functions carelessly, however, can
-//! result in disastrously slow programs. The problem is that insert's first argument is
-//! an iterator p, and that it inserts the new element(s) before p. This means that
-//! insert must find the iterator just before p; this is a constant-time operation
-//! for list, since list has bidirectional iterators, but for slist it must find that
-//! iterator by traversing the list from the beginning up to p. In other words:
+//! The main difference between slist and list is that list's iterators are bidirectional
+//! iterators, while slist's iterators are forward iterators. This means that slist is
+//! less versatile than list; frequently, however, bidirectional iterators are
+//! unnecessary. You should usually use slist unless you actually need the extra
+//! functionality of list, because singly linked lists are smaller and faster than double
+//! linked lists.
+//!
+//! Important performance note: like every other Sequence, slist defines the member
+//! functions insert and erase. Using these member functions carelessly, however, can
+//! result in disastrously slow programs. The problem is that insert's first argument is
+//! an iterator p, and that it inserts the new element(s) before p. This means that
+//! insert must find the iterator just before p; this is a constant-time operation
+//! for list, since list has bidirectional iterators, but for slist it must find that
+//! iterator by traversing the list from the beginning up to p. In other words:
//! insert and erase are slow operations anywhere but near the beginning of the slist.
-//!
-//! Slist provides the member functions insert_after and erase_after, which are constant
-//! time operations: you should always use insert_after and erase_after whenever
-//! possible. If you find that insert_after and erase_after aren't adequate for your
-//! needs, and that you often need to use insert and erase in the middle of the list,
+//!
+//! Slist provides the member functions insert_after and erase_after, which are constant
+//! time operations: you should always use insert_after and erase_after whenever
+//! possible. If you find that insert_after and erase_after aren't adequate for your
+//! needs, and that you often need to use insert and erase in the middle of the list,
//! then you should probably use list instead of slist.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class A = std::allocator<T> >
#else
template <class T, class A>
#endif
-class slist
+class slist
: protected container_detail::node_alloc_holder
<A, typename container_detail::intrusive_slist_type<A>::type>
{
/// @cond
typedef typename container_detail::
move_const_ref_type<T>::type insert_const_ref_type;
- typedef typename
+ typedef typename
container_detail::intrusive_slist_type<A>::type Icont;
typedef container_detail::node_alloc_holder<A, Icont> AllocHolder;
typedef typename AllocHolder::NodePtr NodePtr;
@@ -218,11 +218,11 @@
public:
- //! Const iterator used to iterate through a list.
+ //! Const iterator used to iterate through a list.
class const_iterator
/// @cond
- : public std::iterator<std::forward_iterator_tag,
- value_type, list_difference_type,
+ : public std::iterator<std::forward_iterator_tag,
+ value_type, list_difference_type,
list_const_pointer, list_const_reference>
{
@@ -245,17 +245,17 @@
{}
//Pointer like operators
- const_reference operator*() const
+ const_reference operator*() const
{ return m_it->m_data; }
- const_pointer operator->() const
+ const_pointer operator->() const
{ return const_pointer(&m_it->m_data); }
//Increment / Decrement
- const_iterator& operator++()
+ const_iterator& operator++()
{ prot_incr(); return *this; }
- const_iterator operator++(int)
+ const_iterator operator++(int)
{ typename Icont::iterator tmp = m_it; ++*this; return const_iterator(tmp); }
//Comparison operators
@@ -278,7 +278,7 @@
explicit iterator(typename Icont::iterator it)
: const_iterator(it)
{}
-
+
typename Icont::iterator get()
{ return this->m_it; }
@@ -295,7 +295,7 @@
pointer operator->() const { return pointer(&this->m_it->m_data); }
//Increment / Decrement
- iterator& operator++()
+ iterator& operator++()
{ this->prot_incr(); return *this; }
iterator operator++(int)
@@ -306,18 +306,18 @@
public:
//! <b>Effects</b>: Constructs a list taking the allocator as parameter.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant.
slist()
: AllocHolder()
{}
//! <b>Effects</b>: Constructs a list taking the allocator as parameter.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant.
explicit slist(const allocator_type& a)
: AllocHolder(a)
@@ -332,7 +332,7 @@
//!
//! <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 slist(size_type n, const value_type& x, const allocator_type& a = allocator_type())
: AllocHolder(a)
@@ -347,25 +347,25 @@
//! <b>Complexity</b>: Linear to the range [first, last).
template <class InpIt>
slist(InpIt first, InpIt last,
- const allocator_type& a = allocator_type())
+ const allocator_type& a = allocator_type())
: AllocHolder(a)
{ this->insert_after(this->before_begin(), first, last); }
//! <b>Effects</b>: Copy constructs a list.
//!
//! <b>Postcondition</b>: x == *this.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's default constructor or copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements x contains.
- slist(const slist& x)
+ slist(const slist& x)
: AllocHolder(x)
{ this->insert_after(this->before_begin(), x.begin(), x.end()); }
//! <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.
slist(BOOST_RV_REF(slist) x)
: AllocHolder(boost::move(static_cast<AllocHolder&>(x)))
@@ -374,11 +374,11 @@
//! <b>Effects</b>: Copy constructs a list using the specified allocator.
//!
//! <b>Postcondition</b>: x == *this.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's default constructor or copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements x contains.
- slist(const slist& x, const allocator_type &a)
+ slist(const slist& x, const allocator_type &a)
: AllocHolder(a)
{ this->insert_after(this->before_begin(), x.begin(), x.end()); }
@@ -386,7 +386,7 @@
//! Moves x's resources to *this.
//!
//! <b>Throws</b>: If allocation or value_type's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
slist(BOOST_RV_REF(slist) x, const allocator_type &a)
: AllocHolder(a)
@@ -401,8 +401,8 @@
//! <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>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.
//!
@@ -425,8 +425,8 @@
//! <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>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.
//!
@@ -460,18 +460,18 @@
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements.
- ~slist()
+ ~slist()
{} //AllocHolder clears the slist
//! <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 allocator_type(this->node_alloc()); }
- const stored_allocator_type &get_stored_allocator() const
+ const stored_allocator_type &get_stored_allocator() const
{ return this->node_alloc(); }
stored_allocator_type &get_stored_allocator()
@@ -494,7 +494,7 @@
//!
//! <b>Complexity</b>: Linear to n.
template <class InpIt>
- void assign(InpIt first, InpIt last)
+ void assign(InpIt first, InpIt last)
{
const bool aux_boolean = container_detail::is_convertible<InpIt, size_type>::value;
typedef container_detail::bool_<aux_boolean> Result;
@@ -502,33 +502,33 @@
}
//! <b>Effects</b>: Returns an iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator begin()
+ iterator begin()
{ return iterator(this->icont().begin()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ const_iterator begin() const
{ return this->cbegin(); }
//! <b>Effects</b>: Returns an iterator to the end of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
iterator end()
{ return iterator(this->icont().end()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator end() const
{ return this->cend(); }
@@ -536,71 +536,71 @@
//! <b>Effects</b>: Returns a non-dereferenceable iterator that,
//! when incremented, yields begin(). This iterator may be used
//! as the argument toinsert_after, erase_after, etc.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- iterator before_begin()
+ iterator before_begin()
{ return iterator(end()); }
- //! <b>Effects</b>: Returns a non-dereferenceable const_iterator
+ //! <b>Effects</b>: Returns a non-dereferenceable const_iterator
//! that, when incremented, yields begin(). This iterator may be used
//! as the argument toinsert_after, erase_after, etc.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator before_begin() const
{ return this->cbefore_begin(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ const_iterator cbegin() const
{ return const_iterator(this->non_const_icont().begin()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator cend() const
{ return const_iterator(this->non_const_icont().end()); }
- //! <b>Effects</b>: Returns a non-dereferenceable const_iterator
+ //! <b>Effects</b>: Returns a non-dereferenceable const_iterator
//! that, when incremented, yields begin(). This iterator may be used
//! as the argument toinsert_after, erase_after, etc.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator cbefore_begin() const
{ return const_iterator(end()); }
//! <b>Effects</b>: Returns the number of the elements contained in the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const
{ return this->icont().size(); }
//! <b>Effects</b>: Returns the largest possible size of the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type max_size() const
+ size_type max_size() const
{ return AllocHolder::max_size(); }
//! <b>Effects</b>: Returns true if the list contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- bool empty() const
+ bool empty() const
{ return !this->size(); }
//! <b>Effects</b>: Swaps the contents of *this and x.
@@ -613,24 +613,24 @@
//! <b>Requires</b>: !empty()
//!
- //! <b>Effects</b>: Returns a reference to the first element
+ //! <b>Effects</b>: Returns a reference to the first element
//! from the beginning of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reference front()
+ reference front()
{ return *this->begin(); }
//! <b>Requires</b>: !empty()
//!
- //! <b>Effects</b>: Returns a const reference to the first element
+ //! <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
+ const_reference front() const
{ return *this->begin(); }
//! <b>Effects</b>: Inserts a copy of t in the beginning of the list.
@@ -668,24 +668,24 @@
void pop_front()
{ this->icont().pop_front_and_dispose(Destroyer(this->node_alloc())); }
- //! <b>Returns</b>: The iterator to the element before i in the sequence.
- //! Returns the end-iterator, if either i is the begin-iterator or the
- //! sequence is empty.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Linear to the number of elements before i.
- iterator previous(iterator p)
+ //! <b>Returns</b>: The iterator to the element before i in the sequence.
+ //! Returns the end-iterator, if either i is the begin-iterator or the
+ //! sequence is empty.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements before i.
+ iterator previous(iterator p)
{ return iterator(this->icont().previous(p.get())); }
- //! <b>Returns</b>: The const_iterator to the element before i in the sequence.
- //! Returns the end-const_iterator, if either i is the begin-const_iterator or
- //! the sequence is empty.
- //!
- //! <b>Throws</b>: Nothing.
- //!
- //! <b>Complexity</b>: Linear to the number of elements before i.
- const_iterator previous(const_iterator p)
+ //! <b>Returns</b>: The const_iterator to the element before i in the sequence.
+ //! Returns the end-const_iterator, if either i is the begin-const_iterator or
+ //! the sequence is empty.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements before i.
+ const_iterator previous(const_iterator p)
{ return const_iterator(this->icont().previous(p.get())); }
//! <b>Requires</b>: p must be a valid iterator of *this.
@@ -694,14 +694,14 @@
//! by prev_p.
//!
//! <b>Returns</b>: An iterator to the inserted element.
- //!
+ //!
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references of
//! previous values.
- iterator insert_after(const_iterator prev_pos, insert_const_ref_type x)
+ iterator insert_after(const_iterator prev_pos, insert_const_ref_type x)
{ return this->priv_insert_after(prev_pos, x); }
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -720,14 +720,14 @@
//! p pointed by prev_pos.
//!
//! <b>Returns</b>: An iterator to the inserted element.
- //!
+ //!
//! <b>Throws</b>: If memory allocation throws.
- //!
+ //!
//! <b>Complexity</b>: Amortized constant time.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references of
//! previous values.
- iterator insert_after(const_iterator prev_pos, BOOST_RV_REF(value_type) 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.
@@ -744,19 +744,19 @@
{ this->priv_create_and_insert_nodes(prev_pos, n, x); }
//! <b>Requires</b>: prev_pos must be a valid iterator of *this.
- //!
- //! <b>Effects</b>: Inserts the range pointed by [first, last)
+ //!
+ //! <b>Effects</b>: Inserts the range pointed by [first, last)
//! after the p prev_pos.
- //!
+ //!
//! <b>Throws</b>: If memory allocation throws, T's constructor from a
//! dereferenced InpIt throws.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of elements inserted.
- //!
+ //!
//! <b>Note</b>: Does not affect the validity of iterators and references of
//! previous values.
template <class InIter>
- void insert_after(const_iterator prev_pos, InIter first, InIter last)
+ void insert_after(const_iterator prev_pos, InIter first, InIter last)
{
const bool aux_boolean = container_detail::is_convertible<InIter, size_type>::value;
typedef container_detail::bool_<aux_boolean> Result;
@@ -770,7 +770,7 @@
//! <b>Throws</b>: If memory allocation throws or x's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to the elements before p.
- iterator insert(const_iterator position, insert_const_ref_type x)
+ iterator insert(const_iterator position, insert_const_ref_type x)
{ return this->priv_insert(position, x); }
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -790,7 +790,7 @@
//! <b>Throws</b>: If memory allocation throws.
//!
//! <b>Complexity</b>: Linear to the elements before p.
- iterator insert(const_iterator p, BOOST_RV_REF(value_type) 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.
@@ -800,9 +800,9 @@
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to n plus linear to the elements before p.
- void insert(const_iterator p, size_type n, const value_type& x)
+ void insert(const_iterator p, size_type n, const value_type& x)
{ return this->insert_after(previous(p), n, x); }
-
+
//! <b>Requires</b>: p must be a valid iterator of *this.
//!
//! <b>Effects</b>: Insert a copy of the [first, last) range before p.
@@ -813,7 +813,7 @@
//! <b>Complexity</b>: Linear to std::distance [first, last) plus
//! linear to the elements before p.
template <class InIter>
- void insert(const_iterator p, InIter first, InIter last)
+ void insert(const_iterator p, InIter first, InIter last)
{ return this->insert_after(previous(p), first, last); }
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -892,11 +892,11 @@
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Does not invalidate iterators or references to non erased elements.
iterator erase_after(const_iterator prev_pos)
{
@@ -904,17 +904,17 @@
}
//! <b>Effects</b>: Erases the range (before_first, last) from
- //! the list.
+ //! the list.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of erased elements.
- //!
+ //!
//! <b>Note</b>: Does not invalidate iterators or references to non erased elements.
- iterator erase_after(const_iterator before_first, const_iterator last)
+ iterator erase_after(const_iterator before_first, const_iterator last)
{
return iterator(this->icont().erase_after_and_dispose(before_first.get(), last.get(), Destroyer(this->node_alloc())));
}
@@ -926,7 +926,7 @@
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements before p.
- iterator erase(const_iterator p)
+ iterator erase(const_iterator p)
{ return iterator(this->erase_after(previous(p))); }
//! <b>Requires</b>: first and last must be valid iterator to elements in *this.
@@ -953,7 +953,7 @@
--new_size;
cur = cur_next;
}
- if (cur_next != end_n)
+ if (cur_next != end_n)
this->erase_after(const_iterator(cur), const_iterator(end_n));
else
this->insert_after(const_iterator(cur), new_size, x);
@@ -970,7 +970,7 @@
typename Icont::iterator end_n(this->icont().end()), cur(this->icont().before_begin()), cur_next;
size_type len = this->size();
size_type left = new_size;
-
+
while (++(cur_next = cur) != end_n && left > 0){
--left;
cur = cur_next;
@@ -988,7 +988,7 @@
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements in the list.
- void clear()
+ void clear()
{ this->icont().clear_and_dispose(Destroyer(this->node_alloc())); }
//! <b>Requires</b>: p must point to an element contained
@@ -1001,7 +1001,7 @@
//! are not equal.
//!
//! <b>Complexity</b>: Linear to the elements in x.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_pos, slist& x)
@@ -1016,16 +1016,16 @@
//! <b>Requires</b>: prev_pos must be a valid iterator of this.
//! i must point to an element contained in list x.
- //!
- //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
+ //!
+ //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! after the element pointed by prev_pos.
- //! If prev_pos == prev or prev_pos == ++prev, this function is a null operation.
- //!
+ //! If prev_pos == prev or prev_pos == ++prev, this function is a null operation.
+ //!
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
//! are not equal.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice_after(const_iterator prev_pos, slist& x, const_iterator prev)
@@ -1041,18 +1041,18 @@
//! <b>Requires</b>: prev_pos must be a valid iterator of this.
//! before_first and before_last must be valid iterators of x.
//! prev_pos must not be contained in [before_first, before_last) range.
- //!
+ //!
//! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
//! from list x to this list, after the element pointed by prev_pos.
- //!
+ //!
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
//! are not equal.
- //!
+ //!
//! <b>Complexity</b>: Linear to the number of transferred elements.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice_after(const_iterator prev_pos, slist& x,
+ void splice_after(const_iterator prev_pos, slist& x,
const_iterator before_first, const_iterator before_last)
{
if((NodeAlloc&)*this == (NodeAlloc&)x){
@@ -1068,18 +1068,18 @@
//! before_first and before_last must be valid iterators of x.
//! prev_pos must not be contained in [before_first, before_last) range.
//! n == std::distance(before_first, before_last)
- //!
+ //!
//! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
//! from list x to this list, after the element pointed by prev_pos.
- //!
+ //!
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
//! are not equal.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice_after(const_iterator prev_pos, slist& x,
+ void splice_after(const_iterator prev_pos, slist& x,
const_iterator before_first, const_iterator before_last,
size_type n)
{
@@ -1102,24 +1102,24 @@
//! are not equal.
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), and linear in x.size().
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of
//! this list. Iterators of this list and all the references are not invalidated.
- void splice(const_iterator p, ThisType& x)
+ void splice(const_iterator p, ThisType& x)
{ this->splice_after(this->previous(p), x); }
//! <b>Requires</b>: p must point to an element contained
//! by this list. i must point to an element contained in list x.
- //!
- //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
+ //!
+ //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! before the the element pointed by p. No destructors or copy constructors are called.
- //! If p == i or p == ++i, this function is a null operation.
- //!
+ //! If p == i or p == ++i, this function is a null operation.
+ //!
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
//! are not equal.
- //!
+ //!
//! <b>Complexity</b>: Linear in distance(begin(), p), and in distance(x.begin(), i).
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, slist& x, const_iterator i)
@@ -1127,37 +1127,37 @@
//! <b>Requires</b>: p must point to an element contained
//! by this list. first and last must point to elements contained in list x.
- //!
- //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
+ //!
+ //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
//! before the the element pointed by p. No destructors or copy constructors are called.
- //!
+ //!
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
//! are not equal.
- //!
+ //!
//! <b>Complexity</b>: Linear in distance(begin(), p), in distance(x.begin(), first),
//! and in distance(first, last).
- //!
+ //!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
void splice(const_iterator p, slist& x, const_iterator first, const_iterator last)
{ this->splice_after(previous(p), x, previous(first), previous(last)); }
- //! <b>Effects</b>: Reverses the order of elements in the list.
- //!
+ //! <b>Effects</b>: Reverses the order of elements in the list.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: This function is linear time.
- //!
+ //!
//! <b>Note</b>: Iterators and references are not invalidated
- void reverse()
+ void reverse()
{ this->icont().reverse(); }
//! <b>Effects</b>: Removes all the elements that compare equal to value.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
void remove(const T& value)
@@ -1165,57 +1165,57 @@
//! <b>Effects</b>: Removes all the elements for which a specified
//! predicate is satisfied.
- //!
+ //!
//! <b>Throws</b>: If pred throws.
- //!
+ //!
//! <b>Complexity</b>: Linear time. It performs exactly size() calls to the predicate.
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
- template <class Pred>
+ template <class Pred>
void remove_if(Pred pred)
{
typedef ValueCompareToNodeCompare<Pred> Predicate;
this->icont().remove_and_dispose_if(Predicate(pred), Destroyer(this->node_alloc()));
}
- //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
+ //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that are equal from the list.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Linear time (size()-1 comparisons calls to pred()).
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
void unique()
{ this->unique(value_equal()); }
- //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
+ //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that satisfy some binary predicate from the list.
- //!
+ //!
//! <b>Throws</b>: If pred throws.
- //!
+ //!
//! <b>Complexity</b>: Linear time (size()-1 comparisons equality comparisons).
- //!
+ //!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
- template <class Pred>
+ template <class Pred>
void unique(Pred pred)
{
typedef ValueCompareToNodeCompare<Pred> Predicate;
this->icont().unique_and_dispose(Predicate(pred), Destroyer(this->node_alloc()));
}
- //! <b>Requires</b>: The lists x and *this must be distinct.
+ //! <b>Requires</b>: The lists x and *this must be distinct.
//!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
- //! in order into *this according to std::less<value_type>. The merge is stable;
- //! that is, if an element from *this is equivalent to one from x, then the element
- //! from *this will precede the one from x.
- //!
+ //! in order into *this according to std::less<value_type>. The merge is stable;
+ //! that is, if an element from *this is equivalent to one from x, then the element
+ //! from *this will precede the one from x.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
void merge(slist & x)
@@ -1223,17 +1223,17 @@
//! <b>Requires</b>: p must be a comparison function that induces a strict weak
//! ordering and both *this and x must be sorted according to that ordering
- //! The lists x and *this must be distinct.
- //!
+ //! The lists x and *this must be distinct.
+ //!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
- //! in order into *this. The merge is stable; that is, if an element from *this is
- //! equivalent to one from x, then the element from *this will precede the one from x.
- //!
+ //! in order into *this. The merge is stable; that is, if an element from *this is
+ //! equivalent to one from x, then the element from *this will precede the one from x.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
- //!
+ //!
//! <b>Note</b>: Iterators and references to *this are not invalidated.
template <class StrictWeakOrdering>
void merge(slist& x, StrictWeakOrdering comp)
@@ -1247,28 +1247,28 @@
}
}
- //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
+ //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
- //!
+ //!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
void sort()
{ this->sort(value_less()); }
- //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
+ //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
- //!
+ //!
//! <b>Throws</b>: Nothing.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
- //!
+ //!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
- template <class StrictWeakOrdering>
+ template <class StrictWeakOrdering>
void sort(StrictWeakOrdering comp)
{
// nothing if the slist has length 0 or 1.
@@ -1279,10 +1279,10 @@
/// @cond
private:
- iterator priv_insert(const_iterator p, const value_type& x)
+ iterator priv_insert(const_iterator p, const value_type& x)
{ return this->insert_after(previous(p), x); }
- iterator priv_insert_after(const_iterator prev_pos, const value_type& x)
+ iterator priv_insert_after(const_iterator prev_pos, const value_type& x)
{ return iterator(this->icont().insert_after(prev_pos.get(), *this->create_node(x))); }
void priv_push_front(const value_type &x)
@@ -1362,10 +1362,10 @@
{ this->priv_create_and_insert_nodes(prev, first, last); }
template<class Integer>
- void priv_insert_dispatch(const_iterator prev, Integer n, Integer x, container_detail::true_)
+ void priv_insert_dispatch(const_iterator prev, Integer n, Integer x, container_detail::true_)
{ this->priv_create_and_insert_nodes(prev, (size_type)n, x); }
- void priv_fill_assign(size_type n, const T& val)
+ void priv_fill_assign(size_type n, const T& val)
{
iterator end_n(this->end());
iterator prev(this->before_begin());
@@ -1404,11 +1404,11 @@
}
template <class Int>
- void priv_insert_after_range_dispatch(const_iterator prev_pos, Int n, Int x, container_detail::true_)
+ void priv_insert_after_range_dispatch(const_iterator prev_pos, Int n, Int x, container_detail::true_)
{ 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, container_detail::false_)
+ void priv_insert_after_range_dispatch(const_iterator prev_pos, InIter first, InIter last, container_detail::false_)
{ this->priv_create_and_insert_nodes(prev_pos, first, last); }
//Functors for member algorithm defaults
@@ -1438,7 +1438,7 @@
};
template <class T, class A>
-inline bool
+inline bool
operator==(const slist<T,A>& x, const slist<T,A>& y)
{
if(x.size() != y.size()){
@@ -1465,27 +1465,27 @@
}
template <class T, class A>
-inline bool
-operator!=(const slist<T,A>& sL1, const slist<T,A>& sL2)
+inline bool
+operator!=(const slist<T,A>& sL1, const slist<T,A>& sL2)
{ return !(sL1 == sL2); }
template <class T, class A>
-inline bool
-operator>(const slist<T,A>& sL1, const slist<T,A>& sL2)
+inline bool
+operator>(const slist<T,A>& sL1, const slist<T,A>& sL2)
{ return sL2 < sL1; }
template <class T, class A>
-inline bool
+inline bool
operator<=(const slist<T,A>& sL1, const slist<T,A>& sL2)
{ return !(sL2 < sL1); }
template <class T, class A>
-inline bool
+inline bool
operator>=(const slist<T,A>& sL1, const slist<T,A>& sL2)
{ return !(sL1 < sL2); }
template <class T, class A>
-inline void swap(slist<T,A>& x, slist<T,A>& y)
+inline void swap(slist<T,A>& x, slist<T,A>& y)
{ x.swap(y); }
}}
@@ -1513,12 +1513,12 @@
///@cond
-//Ummm, I don't like to define things in namespace std, but
+//Ummm, I don't like to define things in namespace std, but
//there is no other way
namespace std {
template <class T, class A>
-class insert_iterator<boost::container::slist<T, A> >
+class insert_iterator<boost::container::slist<T, A> >
{
protected:
typedef boost::container::slist<T, A> Container;
@@ -1532,14 +1532,14 @@
typedef void pointer;
typedef void reference;
- insert_iterator(Container& x,
- typename Container::iterator i,
- bool is_previous = false)
+ insert_iterator(Container& x,
+ typename Container::iterator i,
+ bool is_previous = false)
: container(&x), iter(is_previous ? i : x.previous(i)){ }
- insert_iterator<Container>&
- operator=(const typename Container::value_type& value)
- {
+ insert_iterator<Container>&
+ operator=(const typename Container::value_type& value)
+ {
iter = container->insert_after(iter, value);
return *this;
}
Modified: branches/release/boost/container/stable_vector.hpp
==============================================================================
--- branches/release/boost/container/stable_vector.hpp (original)
+++ branches/release/boost/container/stable_vector.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -93,7 +93,7 @@
{
if(do_clear_){
c_.clear();
- c_.clear_pool();
+ c_.clear_pool();
}
}
@@ -172,7 +172,7 @@
iterator(const iterator<T, T&, typename boost::intrusive::pointer_traits<Pointer>::template rebind_pointer<T>::type>& x)
: pn(x.pn)
{}
-
+
private:
static node_type_ptr_t node_ptr_cast(const void_ptr &p)
{
@@ -208,7 +208,7 @@
pointer operator->() const { return pointer(&this->dereference()); }
//Increment / Decrement
- iterator& operator++()
+ iterator& operator++()
{ this->increment(); return *this; }
iterator operator++(int)
@@ -328,11 +328,11 @@
//! stability.
//!
//! More details taken the author's blog:
-//! (<a href="http://bannalia.blogspot.com/2008/09/introducing-stablevector.html" >
+//! (<a href="http://bannalia.blogspot.com/2008/09/introducing-stablevector.html" >
//! Introducing stable_vector</a>)
//!
//! We present stable_vector, a fully STL-compliant stable container that provides
-//! most of the features of std::vector except element contiguity.
+//! most of the features of std::vector except element contiguity.
//!
//! General properties: stable_vector satisfies all the requirements of a container,
//! a reversible container and a sequence and provides all the optional operations
@@ -398,7 +398,7 @@
integral_constant<unsigned, 1> allocator_v1;
typedef ::boost::container::container_detail::
integral_constant<unsigned, 2> allocator_v2;
- typedef ::boost::container::container_detail::integral_constant
+ typedef ::boost::container::container_detail::integral_constant
<unsigned, boost::container::container_detail::
version<A>::value> alloc_version;
typedef typename allocator_traits_type::
@@ -481,9 +481,9 @@
public:
//! <b>Effects</b>: Default constructs a stable_vector.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's default constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant.
stable_vector()
: internal_data(), impl()
@@ -492,9 +492,9 @@
}
//! <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_type& al)
: internal_data(al),impl(al)
@@ -507,7 +507,7 @@
//!
//! <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(),impl()
@@ -523,7 +523,7 @@
//!
//! <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_type& al = allocator_type())
: internal_data(al),impl(al)
@@ -554,7 +554,7 @@
//! <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(allocator_traits<node_allocator_type>::
@@ -571,7 +571,7 @@
//! <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(boost::move(x.node_alloc())), impl(boost::move(x.impl))
@@ -582,7 +582,7 @@
//! <b>Effects</b>: Copy constructs a stable_vector using the specified allocator.
//!
//! <b>Postcondition</b>: x == *this.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements x contains.
stable_vector(const stable_vector& x, const allocator_type &a)
: internal_data(a), impl(a)
@@ -597,7 +597,7 @@
//! Moves mx's resources to *this.
//!
//! <b>Throws</b>: If allocator_type's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise
stable_vector(BOOST_RV_REF(stable_vector) x, const allocator_type &a)
: internal_data(a), impl(a)
@@ -622,13 +622,13 @@
~stable_vector()
{
this->clear();
- clear_pool();
+ clear_pool();
}
//! <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>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.
//!
@@ -711,146 +711,146 @@
}
//! <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 this->node_alloc();}
//! <b>Effects</b>: Returns a reference to the internal allocator.
- //!
+ //!
//! <b>Throws</b>: Nothing
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Non-standard extension.
const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
{ return node_alloc(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
- //!
+ //!
//! <b>Throws</b>: Nothing
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Non-standard extension.
stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
{ return node_alloc(); }
//! <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>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>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.
- //!
+ //! 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.
- //!
+ //! 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>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.
- //!
+ //! of the reversed stable_vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crend()const {return this->rend();}
//! <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
{
@@ -865,9 +865,9 @@
}
//! <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; }
@@ -907,7 +907,7 @@
//! 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)
{
@@ -915,7 +915,7 @@
if(n > this->max_size())
throw std::bad_alloc();
- size_type size = this->size();
+ size_type size = this->size();
size_type old_capacity = this->capacity();
if(n > old_capacity){
this->initialize_end_node(n);
@@ -935,31 +935,31 @@
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a reference to the nth element
+ //! <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
+ //! <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]);}
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a reference to the nth element
+ //! <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)
{
@@ -970,11 +970,11 @@
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a const reference to the nth element
+ //! <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
{
@@ -987,9 +987,9 @@
//!
//! <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()); }
@@ -998,9 +998,9 @@
//!
//! <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()); }
@@ -1009,9 +1009,9 @@
//!
//! <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)); }
@@ -1020,9 +1020,9 @@
//!
//! <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)); }
@@ -1033,7 +1033,7 @@
//! T's copy constructor throws.
//!
//! <b>Complexity</b>: Amortized constant time.
- void push_back(insert_const_ref_type x)
+ void push_back(insert_const_ref_type x)
{ return priv_push_back(x); }
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -1051,7 +1051,7 @@
//! <b>Throws</b>: If memory allocation throws.
//!
//! <b>Complexity</b>: Amortized constant time.
- void push_back(BOOST_RV_REF(T) t)
+ 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.
@@ -1070,7 +1070,7 @@
//!
//! <b>Complexity</b>: If position is end(), amortized constant time
//! Linear time otherwise.
- iterator insert(const_iterator position, insert_const_ref_type x)
+ iterator insert(const_iterator position, insert_const_ref_type x)
{ return this->priv_insert(position, x); }
#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -1090,7 +1090,7 @@
//!
//! <b>Complexity</b>: If position is end(), amortized constant time
//! Linear time otherwise.
- iterator insert(const_iterator position, BOOST_RV_REF(T) x)
+ iterator insert(const_iterator position, BOOST_RV_REF(T) x)
{
typedef repeat_iterator<T, difference_type> repeat_it;
typedef boost::move_iterator<repeat_it> repeat_move_it;
@@ -1210,7 +1210,7 @@
//!
//! <b>Throws</b>: Nothing.
//!
- //! <b>Complexity</b>: Linear to the elements between pos and the
+ //! <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)
{
@@ -1581,7 +1581,7 @@
{
for(; first!=last; ++first){
this->insert(position, *first);
- }
+ }
}
template <class InputIterator>
@@ -1692,7 +1692,7 @@
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) !=
+ if(const_void_ptr(node_ptr_cast(*it)->up) !=
const_void_ptr(const_void_ptr_ptr(&*it)))
return false;
}
Modified: branches/release/boost/container/string.hpp
==============================================================================
--- branches/release/boost/container/string.hpp (original)
+++ branches/release/boost/container/string.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -50,8 +50,8 @@
#include <functional>
#include <string>
-#include <stdexcept>
-#include <utility>
+#include <stdexcept>
+#include <utility>
#include <iterator>
#include <memory>
#include <algorithm>
@@ -78,14 +78,14 @@
/// @cond
namespace container_detail {
// ------------------------------------------------------------
-// Class basic_string_base.
+// Class basic_string_base.
// basic_string_base is a helper class that makes it it easier to write
// an exception-safe version of basic_string. The constructor allocates,
// but does not initialize, a block of memory. The destructor
// deallocates, but does not destroy elements within, a block of
-// memory. The destructor assumes that the memory either is the internal buffer,
-// or else points to a block of memory that was allocated using _String_base's
+// memory. The destructor assumes that the memory either is the internal buffer,
+// or else points to a block of memory that was allocated using _String_base's
// allocator and whose size is this->m_storage.
template <class A>
class basic_string_base
@@ -111,22 +111,22 @@
basic_string_base(const allocator_type& a, size_type n)
: members_(a)
- {
- this->init();
+ {
+ this->init();
this->allocate_initial_block(n);
}
basic_string_base(BOOST_RV_REF(basic_string_base) b)
: members_(boost::move(b.alloc()))
- {
+ {
this->init();
- this->swap_data(b);
+ this->swap_data(b);
}
- ~basic_string_base()
- {
+ ~basic_string_base()
+ {
if(!this->is_short()){
- this->deallocate_block();
+ this->deallocate_block();
allocator_traits_type::destroy
( this->alloc()
, static_cast<long_t*>(static_cast<void*>(&this->members_.m_repr.r))
@@ -136,7 +136,7 @@
private:
- //This is the structure controlling a long string
+ //This is the structure controlling a long string
struct long_t
{
size_type is_short : 1;
@@ -175,8 +175,8 @@
//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
-
- typedef typename boost::aligned_storage< sizeof(long_t),
+
+ typedef typename boost::aligned_storage< sizeof(long_t),
container_detail::alignment_of<long_t>::value>::type long_raw_t;
protected:
@@ -187,13 +187,13 @@
container_detail::ct_rounded_size<sizeof(short_header), AlignmentOfValueType>::value;
static const size_type ZeroCostInternalBufferChars =
(sizeof(long_t) - ShortDataOffset)/sizeof(value_type);
- static const size_type UnalignedFinalInternalBufferChars =
+ static const size_type UnalignedFinalInternalBufferChars =
(ZeroCostInternalBufferChars > MinInternalBufferChars) ?
ZeroCostInternalBufferChars : MinInternalBufferChars;
struct short_t
{
- short_header h;
+ short_header h;
value_type data[UnalignedFinalInternalBufferChars];
};
@@ -241,7 +241,7 @@
{ return static_cast<bool>(this->members_.m_repr.s.h.is_short != 0); }
void is_short(bool yes)
- {
+ {
if(yes && !this->is_short()){
allocator_traits_type::destroy
( this->alloc()
@@ -273,7 +273,7 @@
std::pair<pointer, bool>
allocation_command(allocation_type command,
- size_type limit_size,
+ size_type limit_size,
size_type preferred_size,
size_type &received_size, pointer reuse = 0)
{
@@ -287,7 +287,7 @@
std::pair<pointer, bool>
allocation_command(allocation_type command,
- size_type limit_size,
+ size_type limit_size,
size_type preferred_size,
size_type &received_size,
const pointer &reuse,
@@ -303,21 +303,21 @@
std::pair<pointer, bool>
allocation_command(allocation_type command,
- size_type limit_size,
+ size_type limit_size,
size_type preferred_size,
size_type &received_size,
pointer reuse,
allocator_v2)
{
- return this->alloc().allocation_command(command, limit_size, preferred_size,
+ return this->alloc().allocation_command(command, limit_size, preferred_size,
received_size, reuse);
}
size_type next_capacity(size_type additional_objects) const
{ return get_next_capacity(allocator_traits_type::max_size(this->alloc()), this->priv_storage(), additional_objects); }
- void deallocate(pointer p, size_type n)
- {
+ void deallocate(pointer p, size_type n)
+ {
if (p && (n > InternalBufferChars))
this->alloc().deallocate(p, n);
}
@@ -365,9 +365,9 @@
throw_length_error();
}
- void deallocate_block()
+ void deallocate_block()
{ this->deallocate(this->priv_addr(), this->priv_storage()); }
-
+
size_type max_size() const
{ return allocator_traits_type::max_size(this->alloc()) - 1; }
@@ -404,13 +404,13 @@
{ return this->members_.m_repr.long_repr().storage; }
void priv_storage(size_type storage)
- {
+ {
if(!this->is_short())
this->priv_long_storage(storage);
}
void priv_long_storage(size_type storage)
- {
+ {
this->members_.m_repr.long_repr().storage = storage;
}
@@ -424,7 +424,7 @@
{ return this->members_.m_repr.long_repr().length; }
void priv_size(size_type sz)
- {
+ {
if(this->is_short())
this->priv_short_size(sz);
else
@@ -432,12 +432,12 @@
}
void priv_short_size(size_type sz)
- {
+ {
this->members_.m_repr.s.h.length = (unsigned char)sz;
}
void priv_long_size(size_type sz)
- {
+ {
this->members_.m_repr.long_repr().length = static_cast<typename allocator_traits_type::size_type>(sz);
}
@@ -470,41 +470,41 @@
/// @endcond
-//! The basic_string class represents a Sequence of characters. It contains all the
-//! usual operations of a Sequence, and, additionally, it contains standard string
+//! The basic_string class represents a Sequence of characters. It contains all the
+//! usual operations of a Sequence, and, additionally, it contains standard string
//! operations such as search and concatenation.
//!
-//! The basic_string class is parameterized by character type, and by that type's
+//! The basic_string class is parameterized by character type, and by that type's
//! Character Traits.
-//!
-//! This class has performance characteristics very much like vector<>, meaning,
+//!
+//! This class has performance characteristics very much like vector<>, meaning,
//! for example, that it does not perform reference-count or copy-on-write, and that
-//! concatenation of two strings is an O(N) operation.
-//!
-//! Some of basic_string's member functions use an unusual method of specifying positions
-//! and ranges. In addition to the conventional method using iterators, many of
-//! basic_string's member functions use a single value pos of type size_type to represent a
-//! position (in which case the position is begin() + pos, and many of basic_string's
-//! member functions use two values, pos and n, to represent a range. In that case pos is
-//! the beginning of the range and n is its size. That is, the range is
-//! [begin() + pos, begin() + pos + n).
-//!
-//! Note that the C++ standard does not specify the complexity of basic_string operations.
-//! In this implementation, basic_string has performance characteristics very similar to
-//! those of vector: access to a single character is O(1), while copy and concatenation
+//! concatenation of two strings is an O(N) operation.
+//!
+//! Some of basic_string's member functions use an unusual method of specifying positions
+//! and ranges. In addition to the conventional method using iterators, many of
+//! basic_string's member functions use a single value pos of type size_type to represent a
+//! position (in which case the position is begin() + pos, and many of basic_string's
+//! member functions use two values, pos and n, to represent a range. In that case pos is
+//! the beginning of the range and n is its size. That is, the range is
+//! [begin() + pos, begin() + pos + n).
+//!
+//! Note that the C++ standard does not specify the complexity of basic_string operations.
+//! In this implementation, basic_string has performance characteristics very similar to
+//! those of vector: access to a single character is O(1), while copy and concatenation
//! are O(N).
-//!
-//! In this implementation, begin(),
+//!
+//! In this implementation, begin(),
//! end(), rbegin(), rend(), operator[], c_str(), and data() do not invalidate iterators.
//! In this implementation, iterators are only invalidated by member functions that
-//! explicitly change the string's contents.
+//! explicitly change the string's contents.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class CharT, class Traits = std::char_traits<CharT>, class A = std::allocator<CharT> >
#else
template <class CharT, class Traits, class A>
#endif
class basic_string
- : private container_detail::basic_string_base<A>
+ : private container_detail::basic_string_base<A>
{
/// @cond
private:
@@ -535,12 +535,12 @@
const Pointer m_first;
const Pointer m_last;
- Not_within_traits(Pointer f, Pointer l)
+ Not_within_traits(Pointer f, Pointer l)
: m_first(f), m_last(l) {}
- bool operator()(const typename Tr::char_type& x) const
+ bool operator()(const typename Tr::char_type& x) const
{
- return std::find_if(m_first, m_last,
+ return std::find_if(m_first, m_last,
std::bind1st(Eq_traits<Tr>(), x)) == m_last;
}
};
@@ -558,11 +558,11 @@
typedef Traits traits_type;
//! Pointer to CharT
typedef typename allocator_traits_type::pointer pointer;
- //! Const pointer to CharT
+ //! Const pointer to CharT
typedef typename allocator_traits_type::const_pointer const_pointer;
- //! Reference to CharT
+ //! Reference to CharT
typedef typename allocator_traits_type::reference reference;
- //! Const reference to CharT
+ //! Const reference to CharT
typedef typename allocator_traits_type::const_reference const_reference;
//! An unsigned integral type
typedef typename allocator_traits_type::size_type size_type;
@@ -576,7 +576,7 @@
typedef std::reverse_iterator<iterator> reverse_iterator;
//! Const iterator used to iterate backwards through a string
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- //! The largest possible value of type size_type. That is, size_type(-1).
+ //! The largest possible value of type size_type. That is, size_type(-1).
static const size_type npos;
/// @cond
@@ -602,7 +602,7 @@
/// @endcond
//! <b>Effects</b>: Default constructs a basic_string.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's default constructor throws.
basic_string()
: base_t()
@@ -610,7 +610,7 @@
//! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's copy constructor throws.
explicit basic_string(const allocator_type& a)
: base_t(a)
@@ -619,27 +619,27 @@
//! <b>Effects</b>: Copy constructs a basic_string.
//!
//! <b>Postcondition</b>: x == *this.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's default constructor throws.
- basic_string(const basic_string& s)
+ basic_string(const basic_string& s)
: base_t(allocator_traits_type::select_on_container_copy_construction(s.alloc()))
{ this->priv_range_initialize(s.begin(), s.end()); }
//! <b>Effects</b>: Move constructor. Moves s's resources to *this.
//!
//! <b>Throws</b>: If allocator_type's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- basic_string(BOOST_RV_REF(basic_string) s)
+ basic_string(BOOST_RV_REF(basic_string) s)
: base_t(boost::move((base_t&)s))
{}
//! <b>Effects</b>: Copy constructs a basic_string using the specified allocator.
//!
//! <b>Postcondition</b>: x == *this.
- //!
+ //!
//! <b>Throws</b>: If allocation throws.
- basic_string(const basic_string& s, const allocator_type &a)
+ basic_string(const basic_string& s, const allocator_type &a)
: base_t(a)
{ this->priv_range_initialize(s.begin(), s.end()); }
@@ -647,9 +647,9 @@
//! Moves s's resources to *this.
//!
//! <b>Throws</b>: If allocation throws.
- //!
+ //!
//! <b>Complexity</b>: Constant if a == s.get_allocator(), linear otherwise.
- basic_string(BOOST_RV_REF(basic_string) s, const allocator_type &a)
+ basic_string(BOOST_RV_REF(basic_string) s, const allocator_type &a)
: base_t(a)
{
if(a == this->alloc()){
@@ -661,10 +661,10 @@
}
//! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter,
- //! and is initialized by a specific number of characters of the s string.
+ //! and is initialized by a specific number of characters of the s string.
basic_string(const basic_string& s, size_type pos, size_type n = npos,
- const allocator_type& a = allocator_type())
- : base_t(a)
+ const allocator_type& a = allocator_type())
+ : base_t(a)
{
if (pos > s.size())
this->throw_out_of_range();
@@ -676,15 +676,15 @@
//! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter,
//! and is initialized by a specific number of characters of the s c-string.
basic_string(const CharT* s, size_type n,
- const allocator_type& a = allocator_type())
- : base_t(a)
+ const allocator_type& a = allocator_type())
+ : base_t(a)
{ this->priv_range_initialize(s, s + n); }
//! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter,
//! and is initialized by the null-terminated s c-string.
basic_string(const CharT* s,
const allocator_type& a = allocator_type())
- : base_t(a)
+ : base_t(a)
{ this->priv_range_initialize(s, s + Traits::length(s)); }
//! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter,
@@ -692,7 +692,7 @@
basic_string(size_type n, CharT c,
const allocator_type& a = allocator_type())
: base_t(a)
- {
+ {
this->priv_range_initialize(cvalue_iterator(c, n),
cvalue_iterator());
}
@@ -715,13 +715,13 @@
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- ~basic_string()
+ ~basic_string()
{}
-
+
//! <b>Effects</b>: Copy constructs a string.
//!
//! <b>Postcondition</b>: x == *this.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements x contains.
basic_string& operator=(BOOST_COPY_ASSIGN_REF(basic_string) x)
{
@@ -747,7 +747,7 @@
//! <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.
basic_string& operator=(BOOST_RV_REF(basic_string) x)
{
@@ -773,7 +773,7 @@
}
//! <b>Effects</b>: Assignment from a null-terminated c-string.
- basic_string& operator=(const CharT* s)
+ basic_string& operator=(const CharT* s)
{ return this->assign(s, s + Traits::length(s)); }
//! <b>Effects</b>: Assignment from character.
@@ -781,155 +781,155 @@
{ return this->assign(static_cast<size_type>(1), c); }
//! <b>Effects</b>: Returns an iterator to the first element contained in the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
iterator begin()
{ return this->priv_addr(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator begin() const
{ return this->priv_addr(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator cbegin() const
{ return this->priv_addr(); }
//! <b>Effects</b>: Returns an iterator to the end of the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
iterator end()
{ return this->priv_addr() + this->priv_size(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator end() const
- { return this->priv_addr() + this->priv_size(); }
+ const_iterator end() const
+ { return this->priv_addr() + this->priv_size(); }
//! <b>Effects</b>: Returns a const_iterator to the end of the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const
- { return this->priv_addr() + this->priv_size(); }
+ const_iterator cend() const
+ { return this->priv_addr() + this->priv_size(); }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed vector.
- //!
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rbegin()
+ reverse_iterator rbegin()
{ return reverse_iterator(this->priv_addr() + this->priv_size()); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed vector.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rbegin() const
+ const_reverse_iterator rbegin() const
{ return this->crbegin(); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed vector.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crbegin() const
+ const_reverse_iterator crbegin() const
{ return const_reverse_iterator(this->priv_addr() + this->priv_size()); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed vector.
- //!
+ //! of the reversed vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- reverse_iterator rend()
+ reverse_iterator rend()
{ return reverse_iterator(this->priv_addr()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed vector.
- //!
+ //! of the reversed vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator rend() const
+ const_reverse_iterator rend() const
{ return this->crend(); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed vector.
- //!
+ //! of the reversed vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- const_reverse_iterator crend() const
+ const_reverse_iterator crend() const
{ return const_reverse_iterator(this->priv_addr()); }
//! <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
+ allocator_type get_allocator() const
{ return this->alloc(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
- //!
+ //!
//! <b>Throws</b>: Nothing
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Non-standard extension.
const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
{ return this->alloc(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
- //!
+ //!
//! <b>Throws</b>: Nothing
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Non-standard extension.
stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
{ return this->alloc(); }
//! <b>Effects</b>: Returns the number of the elements contained in the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
- size_type size() const
+ size_type size() const
{ return this->priv_size(); }
//! <b>Effects</b>: Returns the number of the elements contained in the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
size_type length() const
{ return this->size(); }
//! <b>Effects</b>: Returns the largest possible size of the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
size_type max_size() const
{ return base_t::max_size(); }
@@ -961,7 +961,7 @@
//! 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 res_arg)
{
@@ -988,9 +988,9 @@
//! <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
{ return this->priv_capacity(); }
@@ -1040,42 +1040,42 @@
}
//! <b>Effects</b>: Returns true if the vector contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
bool empty() const
{ return !this->priv_size(); }
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a reference to the nth element
+ //! <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->priv_addr() + n); }
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a const reference to the nth element
+ //! <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->priv_addr() + n); }
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a reference to the nth element
+ //! <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())
@@ -1085,11 +1085,11 @@
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a const reference to the nth element
+ //! <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 {
if (n >= size())
@@ -1118,12 +1118,12 @@
//! <b>Effects</b>: Calls append(str.data(), str.size()).
//!
//! <b>Returns</b>: *this
- basic_string& append(const basic_string& s)
+ basic_string& append(const basic_string& s)
{ return this->append(s.begin(), s.end()); }
//! <b>Requires</b>: pos <= str.size()
//!
- //! <b>Effects</b>: Determines the effective length rlen of the string to append
+ //! <b>Effects</b>: Determines the effective length rlen of the string to append
//! as the smaller of n and str.size() - pos and calls append(str.data() + pos, rlen).
//!
//! <b>Throws</b>: If memory allocation throws and out_of_range if pos > str.size()
@@ -1147,7 +1147,7 @@
//! <b>Throws</b>: If memory allocation throws length_error if size() + n > max_size().
//!
//! <b>Returns</b>: *this
- basic_string& append(const CharT* s, size_type n)
+ basic_string& append(const CharT* s, size_type n)
{ return this->append(s, s + n); }
//! <b>Requires</b>: s points to an array of at least traits::length(s) + 1 elements of CharT.
@@ -1155,7 +1155,7 @@
//! <b>Effects</b>: Calls append(s, traits::length(s)).
//!
//! <b>Returns</b>: *this
- basic_string& append(const CharT* s)
+ basic_string& append(const CharT* s)
{ return this->append(s, s + Traits::length(s)); }
//! <b>Effects</b>: Equivalent to append(basic_string(n, c)).
@@ -1190,17 +1190,17 @@
//! <b>Effects</b>: Equivalent to assign(str, 0, npos).
//!
//! <b>Returns</b>: *this
- basic_string& assign(const basic_string& s)
+ basic_string& assign(const basic_string& s)
{ return this->operator=(s); }
//! <b>Effects</b>: The function replaces the string controlled by *this
- //! with a string of length str.size() whose elements are a copy of the string
+ //! with a string of length str.size() whose elements are a copy of the string
//! controlled by str. Leaves str in a valid but unspecified state.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: *this
- basic_string& assign(BOOST_RV_REF(basic_string) ms)
+ basic_string& assign(BOOST_RV_REF(basic_string) ms)
{ return this->swap_data(ms), *this; }
//! <b>Requires</b>: pos <= str.size()
@@ -1211,11 +1211,11 @@
//! <b>Throws</b>: If memory allocation throws or out_of_range if pos > str.size().
//!
//! <b>Returns</b>: *this
- basic_string& assign(const basic_string& s,
+ basic_string& assign(const basic_string& s,
size_type pos, size_type n) {
if (pos > s.size())
this->throw_out_of_range();
- return this->assign(s.begin() + pos,
+ return this->assign(s.begin() + pos,
s.begin() + pos + container_detail::min_value(n, s.size() - pos));
}
@@ -1225,7 +1225,7 @@
//! length n whose elements are a copy of those pointed to by s.
//!
//! <b>Throws</b>: If memory allocation throws or length_error if n > max_size().
- //!
+ //!
//! <b>Returns</b>: *this
basic_string& assign(const CharT* s, size_type n)
{ return this->assign(s, s + n); }
@@ -1248,7 +1248,7 @@
//!
//! <b>Returns</b>: *this
template <class InputIter>
- basic_string& assign(InputIter first, InputIter last)
+ basic_string& assign(InputIter first, InputIter last)
{
//Dispatch depending on integer/iterator
const bool aux_boolean = container_detail::is_convertible<InputIter, size_type>::value;
@@ -1263,7 +1263,7 @@
//! <b>Throws</b>: If memory allocation throws or out_of_range if pos > size().
//!
//! <b>Returns</b>: *this
- basic_string& insert(size_type pos, const basic_string& s)
+ basic_string& insert(size_type pos, const basic_string& s)
{
if (pos > size())
this->throw_out_of_range();
@@ -1282,7 +1282,7 @@
//!
//! <b>Returns</b>: *this
basic_string& insert(size_type pos1, const basic_string& s,
- size_type pos2, size_type n)
+ size_type pos2, size_type n)
{
if (pos1 > this->size() || pos2 > s.size())
this->throw_out_of_range();
@@ -1306,7 +1306,7 @@
//! length_error if size() + n > max_size().
//!
//! <b>Returns</b>: *this
- basic_string& insert(size_type pos, const CharT* s, size_type n)
+ basic_string& insert(size_type pos, const CharT* s, size_type n)
{
if (pos > this->size())
this->throw_out_of_range();
@@ -1324,7 +1324,7 @@
//! length_error if size() > max_size() - Traits::length(s)
//!
//! <b>Returns</b>: *this
- basic_string& insert(size_type pos, const CharT* s)
+ basic_string& insert(size_type pos, const CharT* s)
{
if (pos > size())
this->throw_out_of_range();
@@ -1341,7 +1341,7 @@
//! length_error if size() > max_size() - n
//!
//! <b>Returns</b>: *this
- basic_string& insert(size_type pos, size_type n, CharT c)
+ basic_string& insert(size_type pos, size_type n, CharT c)
{
if (pos > this->size())
this->throw_out_of_range();
@@ -1356,7 +1356,7 @@
//! <b>Effects</b>: inserts a copy of c before the character referred to by p.
//!
//! <b>Returns</b>: An iterator which refers to the copy of the inserted character.
- iterator insert(const_iterator p, CharT c)
+ iterator insert(const_iterator p, CharT c)
{
size_type new_offset = p - this->priv_addr() + 1;
this->insert(p, cvalue_iterator(c, 1), cvalue_iterator());
@@ -1382,7 +1382,7 @@
//! <b>Returns</b>: An iterator which refers to the copy of the first
//! inserted character, or p if first == last.
template <class InputIter>
- void insert(const_iterator p, InputIter first, InputIter last)
+ void insert(const_iterator p, InputIter first, InputIter last)
{
//Dispatch depending on integer/iterator
const bool aux_boolean = container_detail::is_convertible<InputIter, size_type>::value;
@@ -1401,13 +1401,13 @@
//! <b>Throws</b>: out_of_range if pos > size().
//!
//! <b>Returns</b>: *this
- basic_string& erase(size_type pos = 0, size_type n = npos)
+ basic_string& erase(size_type pos = 0, size_type n = npos)
{
if (pos > size())
this->throw_out_of_range();
erase(this->priv_addr() + pos, this->priv_addr() + pos + container_detail::min_value(n, size() - pos));
return *this;
- }
+ }
//! <b>Effects</b>: Removes the character referred to by p.
//!
@@ -1415,12 +1415,12 @@
//!
//! <b>Returns</b>: An iterator which points to the element immediately following p prior to the element being
//! erased. If no such element exists, end() is returned.
- iterator erase(const_iterator p)
+ iterator erase(const_iterator p)
{
// The move includes the terminating null.
CharT *ptr = const_cast<CharT*>(container_detail::to_raw_pointer(p));
Traits::move(ptr,
- container_detail::to_raw_pointer(p + 1),
+ container_detail::to_raw_pointer(p + 1),
this->priv_size() - (p - this->priv_addr()));
this->priv_size(this->priv_size()-1);
return iterator(ptr);
@@ -1440,7 +1440,7 @@
if (first != last) { // The move includes the terminating null.
size_type num_erased = last - first;
Traits::move(f,
- container_detail::to_raw_pointer(last),
+ container_detail::to_raw_pointer(last),
(this->priv_size() + 1)-(last - this->priv_addr()));
size_type new_length = this->priv_size() - num_erased;
this->priv_size(new_length);
@@ -1466,14 +1466,14 @@
//! <b>Throws</b>: if memory allocation throws or out_of_range if pos1 > size().
//!
//! <b>Returns</b>: *this
- basic_string& replace(size_type pos1, size_type n1, const basic_string& str)
+ basic_string& replace(size_type pos1, size_type n1, const basic_string& str)
{
if (pos1 > size())
this->throw_out_of_range();
const size_type len = container_detail::min_value(n1, size() - pos1);
if (this->size() - len >= this->max_size() - str.size())
this->throw_length_error();
- return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len,
+ return this->replace(this->priv_addr() + pos1, this->priv_addr() + pos1 + len,
str.begin(), str.end());
}
@@ -1487,7 +1487,7 @@
//!
//! <b>Returns</b>: *this
basic_string& replace(size_type pos1, size_type n1,
- const basic_string& str, size_type pos2, size_type n2)
+ const basic_string& str, size_type pos2, size_type n2)
{
if (pos1 > size() || pos2 > str.size())
this->throw_out_of_range();
@@ -1501,20 +1501,20 @@
//! <b>Requires</b>: pos1 <= size() and s points to an array of at least n2 elements of CharT.
//!
- //! <b>Effects</b>: Determines the effective length xlen of the string to be removed as the
- //! smaller of n1 and size() - pos1. If size() - xlen >= max_size() - n2 throws length_error.
- //! Otherwise, the function replaces the string controlled by *this with a string of
- //! length size() - xlen + n2 whose first pos1 elements are a copy of the initial elements
- //! of the original string controlled by *this, whose next n2 elements are a copy of the
- //! initial n2 elements of s, and whose remaining elements are a copy of the elements of
+ //! <b>Effects</b>: Determines the effective length xlen of the string to be removed as the
+ //! smaller of n1 and size() - pos1. If size() - xlen >= max_size() - n2 throws length_error.
+ //! Otherwise, the function replaces the string controlled by *this with a string of
+ //! length size() - xlen + n2 whose first pos1 elements are a copy of the initial elements
+ //! of the original string controlled by *this, whose next n2 elements are a copy of the
+ //! initial n2 elements of s, and whose remaining elements are a copy of the elements of
//! the original string controlled by *this beginning at position pos + xlen.
//!
- //! <b>Throws</b>: if memory allocation throws, out_of_range if pos1 > size() or length_error
+ //! <b>Throws</b>: if memory allocation throws, out_of_range if pos1 > size() or length_error
//! if the length of the resulting string would exceed max_size()
//!
//! <b>Returns</b>: *this
basic_string& replace(size_type pos1, size_type n1,
- const CharT* s, size_type n2)
+ const CharT* s, size_type n2)
{
if (pos1 > size())
this->throw_out_of_range();
@@ -1535,11 +1535,11 @@
//! remaining elements are a copy of the elements of the original string controlled by *this
//! beginning at position pos + xlen.
//!
- //! <b>Throws</b>: if memory allocation throws, out_of_range if pos1 > size() or length_error
+ //! <b>Throws</b>: if memory allocation throws, out_of_range if pos1 > size() or length_error
//! if the length of the resulting string would exceed max_size()
//!
//! <b>Returns</b>: *this
- basic_string& replace(size_type pos, size_type n1, const CharT* s)
+ basic_string& replace(size_type pos, size_type n1, const CharT* s)
{
if (pos > size())
this->throw_out_of_range();
@@ -1555,11 +1555,11 @@
//!
//! <b>Effects</b>: Equivalent to replace(pos1, n1, basic_string(n2, c)).
//!
- //! <b>Throws</b>: if memory allocation throws, out_of_range if pos1 > size() or length_error
+ //! <b>Throws</b>: if memory allocation throws, out_of_range if pos1 > size() or length_error
//! if the length of the resulting string would exceed max_size()
//!
//! <b>Returns</b>: *this
- basic_string& replace(size_type pos1, size_type n1, size_type n2, CharT c)
+ basic_string& replace(size_type pos1, size_type n1, size_type n2, CharT c)
{
if (pos1 > size())
this->throw_out_of_range();
@@ -1576,10 +1576,10 @@
//! <b>Throws</b>: if memory allocation throws
//!
//! <b>Returns</b>: *this
- basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str)
+ basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str)
{ return this->replace(i1, i2, str.begin(), str.end()); }
- //! <b>Requires</b>: [begin(),i1) and [i1,i2) are valid ranges and
+ //! <b>Requires</b>: [begin(),i1) and [i1,i2) are valid ranges and
//! s points to an array of at least n elements
//!
//! <b>Effects</b>: Calls replace(i1 - begin(), i2 - i1, s, n).
@@ -1587,7 +1587,7 @@
//! <b>Throws</b>: if memory allocation throws
//!
//! <b>Returns</b>: *this
- basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s, size_type n)
+ basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s, size_type n)
{ return this->replace(i1, i2, s, s + n); }
//! <b>Requires</b>: [begin(),i1) and [i1,i2) are valid ranges and s points to an
@@ -1598,7 +1598,7 @@
//! <b>Throws</b>: if memory allocation throws
//!
//! <b>Returns</b>: *this
- basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s)
+ basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s)
{ return this->replace(i1, i2, s, s + Traits::length(s)); }
//! <b>Requires</b>: [begin(),i1) and [i1,i2) are valid ranges.
@@ -1630,7 +1630,7 @@
//!
//! <b>Returns</b>: *this
template <class InputIter>
- basic_string& replace(const_iterator i1, const_iterator i2, InputIter j1, InputIter j2)
+ basic_string& replace(const_iterator i1, const_iterator i2, InputIter j1, InputIter j2)
{
//Dispatch depending on integer/iterator
const bool aux_boolean = container_detail::is_convertible<InputIter, size_type>::value;
@@ -1642,14 +1642,14 @@
//!
//! <b>Effects</b>: Determines the effective length rlen of the string to copy as the
//! smaller of n and size() - pos. s shall designate an array of at least rlen elements.
- //! The function then replaces the string designated by s with a string of length rlen
+ //! The function then replaces the string designated by s with a string of length rlen
//! whose elements are a copy of the string controlled by *this beginning at position pos.
//! The function does not append a null object to the string designated by s.
//!
//! <b>Throws</b>: if memory allocation throws, out_of_range if pos > size().
//!
//! <b>Returns</b>: rlen
- size_type copy(CharT* s, size_type n, size_type pos = 0) const
+ size_type copy(CharT* s, size_type n, size_type pos = 0) const
{
if (pos > size())
this->throw_out_of_range();
@@ -1658,7 +1658,7 @@
return len;
}
- //! <b>Effects</b>: *this contains the same sequence of characters that was in s,
+ //! <b>Effects</b>: *this contains the same sequence of characters that was in s,
//! s contains the same sequence of characters that was in *this.
//!
//! <b>Throws</b>: Nothing
@@ -1674,7 +1674,7 @@
//! <b>Returns</b>: A pointer p such that p + i == &operator[](i) for each i in [0,size()].
//!
//! <b>Complexity</b>: constant time.
- const CharT* c_str() const
+ const CharT* c_str() const
{ return container_detail::to_raw_pointer(this->priv_addr()); }
//! <b>Requires</b>: The program shall not alter any of the values stored in the character array.
@@ -1682,17 +1682,17 @@
//! <b>Returns</b>: A pointer p such that p + i == &operator[](i) for each i in [0,size()].
//!
//! <b>Complexity</b>: constant time.
- const CharT* data() const
+ const CharT* data() const
{ return container_detail::to_raw_pointer(this->priv_addr()); }
- //! <b>Effects</b>: Determines the lowest position xpos, if possible, such that both
+ //! <b>Effects</b>: Determines the lowest position xpos, if possible, such that both
//! of the following conditions obtain: 19 pos <= xpos and xpos + str.size() <= size();
//! 2) traits::eq(at(xpos+I), str.at(I)) for all elements I of the string controlled by str.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
- size_type find(const basic_string& s, size_type pos = 0) const
+ size_type find(const basic_string& s, size_type pos = 0) const
{ return find(s.c_str(), pos, s.size()); }
//! <b>Requires</b>: s points to an array of at least n elements of CharT.
@@ -1707,7 +1707,7 @@
else {
pointer finish = this->priv_addr() + this->priv_size();
const const_iterator result =
- std::search(container_detail::to_raw_pointer(this->priv_addr() + pos),
+ std::search(container_detail::to_raw_pointer(this->priv_addr() + pos),
container_detail::to_raw_pointer(finish),
s, s + n, Eq_traits<Traits>());
return result != finish ? result - begin() : npos;
@@ -1719,7 +1719,7 @@
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find(basic_string(s), pos).
- size_type find(const CharT* s, size_type pos = 0) const
+ size_type find(const CharT* s, size_type pos = 0) const
{ return find(s, pos, Traits::length(s)); }
//! <b>Throws</b>: Nothing
@@ -1738,7 +1738,7 @@
}
}
- //! <b>Effects</b>: Determines the highest position xpos, if possible, such
+ //! <b>Effects</b>: Determines the highest position xpos, if possible, such
//! that both of the following conditions obtain:
//! a) xpos <= pos and xpos + str.size() <= size();
//! b) traits::eq(at(xpos+I), str.at(I)) for all elements I of the string controlled by str.
@@ -1746,7 +1746,7 @@
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
- size_type rfind(const basic_string& str, size_type pos = npos) const
+ size_type rfind(const basic_string& str, size_type pos = npos) const
{ return rfind(str.c_str(), pos, str.size()); }
//! <b>Requires</b>: s points to an array of at least n elements of CharT.
@@ -1771,13 +1771,13 @@
}
}
- //! <b>Requires</b>: pos <= size() and s points to an array of at least
+ //! <b>Requires</b>: pos <= size() and s points to an array of at least
//! traits::length(s) + 1 elements of CharT.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: rfind(basic_string(s), pos).
- size_type rfind(const CharT* s, size_type pos = npos) const
+ size_type rfind(const CharT* s, size_type pos = npos) const
{ return rfind(s, pos, Traits::length(s)); }
//! <b>Throws</b>: Nothing
@@ -1805,7 +1805,7 @@
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
- size_type find_first_of(const basic_string& s, size_type pos = 0) const
+ size_type find_first_of(const basic_string& s, size_type pos = 0) const
{ return find_first_of(s.c_str(), pos, s.size()); }
//! <b>Requires</b>: s points to an array of at least n elements of CharT.
@@ -1831,7 +1831,7 @@
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find_first_of(basic_string(s), pos).
- size_type find_first_of(const CharT* s, size_type pos = 0) const
+ size_type find_first_of(const CharT* s, size_type pos = 0) const
{ return find_first_of(s, pos, Traits::length(s)); }
//! <b>Requires</b>: s points to an array of at least traits::length(s) + 1 elements of CharT.
@@ -1839,10 +1839,10 @@
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find_first_of(basic_string<CharT,traits,Allocator>(1,c), pos).
- size_type find_first_of(CharT c, size_type pos = 0) const
+ size_type find_first_of(CharT c, size_type pos = 0) const
{ return find(c, pos); }
- //! <b>Effects</b>: Determines the highest position xpos, if possible, such that both of
+ //! <b>Effects</b>: Determines the highest position xpos, if possible, such that both of
//! the following conditions obtain: a) xpos <= pos and xpos < size(); b)
//! traits::eq(at(xpos), str.at(I)) for some element I of the string controlled by str.
//!
@@ -1878,16 +1878,16 @@
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find_last_of(basic_string<CharT,traits,Allocator>(1,c),pos).
- size_type find_last_of(const CharT* s, size_type pos = npos) const
+ size_type find_last_of(const CharT* s, size_type pos = npos) const
{ return find_last_of(s, pos, Traits::length(s)); }
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find_last_of(basic_string(s), pos).
- size_type find_last_of(CharT c, size_type pos = npos) const
+ size_type find_last_of(CharT c, size_type pos = npos) const
{ return rfind(c, pos); }
- //! <b>Effects</b>: Determines the lowest position xpos, if possible, such that
+ //! <b>Effects</b>: Determines the lowest position xpos, if possible, such that
//! both of the following conditions obtain:
//! a) pos <= xpos and xpos < size(); b) traits::eq(at(xpos), str.at(I)) for no
//! element I of the string controlled by str.
@@ -1895,7 +1895,7 @@
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
- size_type find_first_not_of(const basic_string& str, size_type pos = 0) const
+ size_type find_first_not_of(const basic_string& str, size_type pos = 0) const
{ return find_first_not_of(str.c_str(), pos, str.size()); }
//! <b>Requires</b>: s points to an array of at least traits::length(s) + 1 elements of CharT.
@@ -1920,7 +1920,7 @@
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find_first_not_of(basic_string(s), pos).
- size_type find_first_not_of(const CharT* s, size_type pos = 0) const
+ size_type find_first_not_of(const CharT* s, size_type pos = 0) const
{ return find_first_not_of(s, pos, Traits::length(s)); }
//! <b>Throws</b>: Nothing
@@ -1940,7 +1940,7 @@
}
//! <b>Effects</b>: Determines the highest position xpos, if possible, such that
- //! both of the following conditions obtain: a) xpos <= pos and xpos < size();
+ //! both of the following conditions obtain: a) xpos <= pos and xpos < size();
//! b) traits::eq(at(xpos), str.at(I)) for no element I of the string controlled by str.
//!
//! <b>Throws</b>: Nothing
@@ -2003,11 +2003,11 @@
//! <b>Throws</b>: If memory allocation throws or out_of_range if pos > size().
//!
//! <b>Returns</b>: basic_string<CharT,traits,Allocator>(data()+pos,rlen).
- basic_string substr(size_type pos = 0, size_type n = npos) const
+ basic_string substr(size_type pos = 0, size_type n = npos) const
{
if (pos > size())
this->throw_out_of_range();
- return basic_string(this->priv_addr() + pos,
+ return basic_string(this->priv_addr() + pos,
this->priv_addr() + pos + container_detail::min_value(n, size() - pos), this->alloc());
}
@@ -2020,7 +2020,7 @@
//! <b>Returns</b>: The nonzero result if the result of the comparison is nonzero.
//! Otherwise, returns a value < 0 if size() < str.size(), a 0 value if size() == str.size(),
//! and value > 0 if size() > str.size()
- int compare(const basic_string& str) const
+ int compare(const basic_string& str) const
{ return s_compare(this->priv_addr(), this->priv_addr() + this->priv_size(), str.priv_addr(), str.priv_addr() + str.priv_size()); }
//! <b>Requires</b>: pos1 <= size()
@@ -2031,16 +2031,16 @@
//! <b>Throws</b>: out_of_range if pos1 > size()
//!
//! <b>Returns</b>:basic_string(*this,pos1,n1).compare(str).
- int compare(size_type pos1, size_type n1, const basic_string& str) const
+ int compare(size_type pos1, size_type n1, const basic_string& str) const
{
if (pos1 > size())
this->throw_out_of_range();
- return s_compare(this->priv_addr() + pos1,
+ return s_compare(this->priv_addr() + pos1,
this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
str.priv_addr(), str.priv_addr() + str.priv_size());
}
- //! <b>Requires</b>: pos1 <= size() and pos2 <= str.size()
+ //! <b>Requires</b>: pos1 <= size() and pos2 <= str.size()
//!
//! <b>Effects</b>: Determines the effective length rlen of the string to copy as
//! the smaller of
@@ -2048,20 +2048,20 @@
//! <b>Throws</b>: out_of_range if pos1 > size() or pos2 > str.size()
//!
//! <b>Returns</b>: basic_string(*this, pos1, n1).compare(basic_string(str, pos2, n2)).
- int compare(size_type pos1, size_type n1,
+ int compare(size_type pos1, size_type n1,
const basic_string& str, size_type pos2, size_type n2) const {
if (pos1 > size() || pos2 > str.size())
this->throw_out_of_range();
- return s_compare(this->priv_addr() + pos1,
+ return s_compare(this->priv_addr() + pos1,
this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
- str.priv_addr() + pos2,
+ str.priv_addr() + pos2,
str.priv_addr() + pos2 + container_detail::min_value(n2, size() - pos2));
}
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: compare(basic_string(s)).
- int compare(const CharT* s) const
+ int compare(const CharT* s) const
{ return s_compare(this->priv_addr(), this->priv_addr() + this->priv_size(), s, s + Traits::length(s)); }
@@ -2071,11 +2071,11 @@
//!
//! <b>Returns</b>: basic_string(*this, pos, n1).compare(basic_string(s, n2)).
int compare(size_type pos1, size_type n1,
- const CharT* s, size_type n2) const
+ const CharT* s, size_type n2) const
{
if (pos1 > size())
this->throw_out_of_range();
- return s_compare(this->priv_addr() + pos1,
+ return s_compare(this->priv_addr() + pos1,
this->priv_addr() + pos1 + container_detail::min_value(n1, size() - pos1),
s, s + n2);
}
@@ -2085,18 +2085,18 @@
//! <b>Throws</b>: out_of_range if pos1 > size()
//!
//! <b>Returns</b>: basic_string(*this, pos, n1).compare(basic_string(s, n2)).
- int compare(size_type pos1, size_type n1, const CharT* s) const
+ int compare(size_type pos1, size_type n1, const CharT* s) const
{ return this->compare(pos1, n1, s, Traits::length(s)); }
/// @cond
private:
static int s_compare(const_pointer f1, const_pointer l1,
- const_pointer f2, const_pointer l2)
+ const_pointer f2, const_pointer l2)
{
const difference_type n1 = l1 - f1;
const difference_type n2 = l2 - f2;
- const int cmp = Traits::compare(container_detail::to_raw_pointer(f1),
- container_detail::to_raw_pointer(f2),
+ const int cmp = Traits::compare(container_detail::to_raw_pointer(f1),
+ container_detail::to_raw_pointer(f2),
container_detail::min_value(n1, n2));
return cmp != 0 ? cmp : (n1 < n2 ? -1 : (n1 > n2 ? 1 : 0));
}
@@ -2131,7 +2131,7 @@
template<class AllocVersion>
void priv_shrink_to_fit_dynamic_buffer
- ( AllocVersion
+ ( AllocVersion
, typename container_detail::enable_if<container_detail::is_same<AllocVersion, allocator_v2> >::type* = 0)
{
size_type received_size;
@@ -2151,7 +2151,7 @@
// Helper functions used by constructors. It is a severe error for
// any of them to be called anywhere except from within constructors.
- void priv_terminate_string()
+ void priv_terminate_string()
{ this->priv_construct_null(this->priv_addr() + this->priv_size()); }
template <class InputIter>
@@ -2164,7 +2164,7 @@
}
template <class ForwardIter>
- void priv_range_initialize(ForwardIter f, ForwardIter l,
+ void priv_range_initialize(ForwardIter f, ForwardIter l,
std::forward_iterator_tag)
{
difference_type n = std::distance(f, l);
@@ -2193,7 +2193,7 @@
template <class InputIter>
void priv_initialize_dispatch(InputIter f, InputIter l, container_detail::false_)
{ this->priv_range_initialize(f, l); }
-
+
template<class FwdIt, class Count> inline
void priv_uninitialized_fill_n(FwdIt first, Count count, const CharT val)
{
@@ -2241,7 +2241,7 @@
}
template <class Integer>
- basic_string& priv_assign_dispatch(Integer n, Integer x, container_detail::true_)
+ basic_string& priv_assign_dispatch(Integer n, Integer x, container_detail::true_)
{ return this->assign((size_type) n, (CharT) x); }
template <class InputIter>
@@ -2272,7 +2272,7 @@
}
template <class ForwardIter>
- void priv_insert(const_iterator position, ForwardIter first,
+ void priv_insert(const_iterator position, ForwardIter first,
ForwardIter last, std::forward_iterator_tag)
{
if (first != last) {
@@ -2286,13 +2286,13 @@
//Check if we have enough capacity
if (remaining >= n){
- enough_capacity = true;
+ enough_capacity = true;
}
else {
//Otherwise expand current buffer or allocate new storage
new_cap = this->next_capacity(n);
allocation_ret = this->allocation_command
- (allocate_new | expand_fwd | expand_bwd, old_size + n + 1,
+ (allocate_new | expand_fwd | expand_bwd, old_size + n + 1,
new_cap, new_cap, old_start);
//Check forward expansion
@@ -2353,7 +2353,7 @@
this->priv_long_storage(new_cap);
}
else{
- //value_type is POD, so backwards expansion is much easier
+ //value_type is POD, so backwards expansion is much easier
//than with vector<T>
value_type *oldbuf = container_detail::to_raw_pointer(old_start);
value_type *newbuf = container_detail::to_raw_pointer(new_start);
@@ -2377,12 +2377,12 @@
template <class Integer>
void priv_insert_dispatch(const_iterator p, Integer n, Integer x,
- container_detail::true_)
+ container_detail::true_)
{ insert(p, (size_type) n, (CharT) x); }
template <class InputIter>
void priv_insert_dispatch(const_iterator p, InputIter first, InputIter last,
- container_detail::false_)
+ container_detail::false_)
{
typedef typename std::iterator_traits<InputIter>::iterator_category Category;
priv_insert(p, first, last, Category());
@@ -2395,19 +2395,19 @@
Traits::assign(*result, *first);
}
- void priv_copy(const CharT* first, const CharT* last, CharT* result)
+ void priv_copy(const CharT* first, const CharT* last, CharT* result)
{ Traits::copy(result, first, last - first); }
template <class Integer>
basic_string& priv_replace_dispatch(const_iterator first, const_iterator last,
Integer n, Integer x,
- container_detail::true_)
+ container_detail::true_)
{ return this->replace(first, last, (size_type) n, (CharT) x); }
template <class InputIter>
basic_string& priv_replace_dispatch(const_iterator first, const_iterator last,
InputIter f, InputIter l,
- container_detail::false_)
+ container_detail::false_)
{
typedef typename std::iterator_traits<InputIter>::iterator_category Category;
return this->priv_replace(first, last, f, l, Category());
@@ -2430,7 +2430,7 @@
template <class ForwardIter>
basic_string& priv_replace(const_iterator first, const_iterator last,
- ForwardIter f, ForwardIter l,
+ ForwardIter f, ForwardIter l,
std::forward_iterator_tag)
{
difference_type n = std::distance(f, l);
@@ -2468,9 +2468,9 @@
/// @cond
-template <class CharT, class Traits, class A>
-const typename basic_string<CharT,Traits,A>::size_type
-basic_string<CharT,Traits,A>::npos
+template <class CharT, class Traits, class A>
+const typename basic_string<CharT,Traits,A>::size_type
+basic_string<CharT,Traits,A>::npos
= (typename basic_string<CharT,Traits,A>::size_type) -1;
/// @endcond
@@ -2526,7 +2526,7 @@
template <class CharT, class Traits, class A>
inline basic_string<CharT,Traits,A>
-operator+(const CharT* s, const basic_string<CharT,Traits,A>& y)
+operator+(const CharT* s, const basic_string<CharT,Traits,A>& y)
{
typedef basic_string<CharT, Traits, A> str_t;
typedef typename str_t::reserve_t reserve_t;
@@ -2549,7 +2549,7 @@
template <class CharT, class Traits, class A>
inline basic_string<CharT,Traits,A>
-operator+(CharT c, const basic_string<CharT,Traits,A>& y)
+operator+(CharT c, const basic_string<CharT,Traits,A>& y)
{
typedef basic_string<CharT,Traits,A> str_t;
typedef typename str_t::reserve_t reserve_t;
@@ -2571,7 +2571,7 @@
template <class CharT, class Traits, class A>
inline basic_string<CharT,Traits,A>
-operator+(const basic_string<CharT,Traits,A>& x, const CharT* s)
+operator+(const basic_string<CharT,Traits,A>& x, const CharT* s)
{
typedef basic_string<CharT,Traits,A> str_t;
typedef typename str_t::reserve_t reserve_t;
@@ -2594,7 +2594,7 @@
template <class CharT, class Traits, class A>
inline basic_string<CharT,Traits,A>
-operator+(const basic_string<CharT,Traits,A>& x, const CharT c)
+operator+(const basic_string<CharT,Traits,A>& x, const CharT c)
{
typedef basic_string<CharT,Traits,A> str_t;
typedef typename str_t::reserve_t reserve_t;
@@ -2619,7 +2619,7 @@
template <class CharT, class Traits, class A>
inline bool
operator==(const basic_string<CharT,Traits,A>& x,
- const basic_string<CharT,Traits,A>& y)
+ const basic_string<CharT,Traits,A>& y)
{
return x.size() == y.size() &&
Traits::compare(x.data(), y.data(), x.size()) == 0;
@@ -2627,7 +2627,7 @@
template <class CharT, class Traits, class A>
inline bool
-operator==(const CharT* s, const basic_string<CharT,Traits,A>& y)
+operator==(const CharT* s, const basic_string<CharT,Traits,A>& y)
{
typename basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
return n == y.size() && Traits::compare(s, y.data(), n) == 0;
@@ -2635,7 +2635,7 @@
template <class CharT, class Traits, class A>
inline bool
-operator==(const basic_string<CharT,Traits,A>& x, const CharT* s)
+operator==(const basic_string<CharT,Traits,A>& x, const CharT* s)
{
typename basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
return x.size() == n && Traits::compare(x.data(), s, n) == 0;
@@ -2644,17 +2644,17 @@
template <class CharT, class Traits, class A>
inline bool
operator!=(const basic_string<CharT,Traits,A>& x,
- const basic_string<CharT,Traits,A>& y)
+ const basic_string<CharT,Traits,A>& y)
{ return !(x == y); }
template <class CharT, class Traits, class A>
inline bool
-operator!=(const CharT* s, const basic_string<CharT,Traits,A>& y)
+operator!=(const CharT* s, const basic_string<CharT,Traits,A>& y)
{ return !(s == y); }
template <class CharT, class Traits, class A>
inline bool
-operator!=(const basic_string<CharT,Traits,A>& x, const CharT* s)
+operator!=(const basic_string<CharT,Traits,A>& x, const CharT* s)
{ return !(x == s); }
@@ -2662,7 +2662,7 @@
template <class CharT, class Traits, class A>
inline bool
-operator<(const basic_string<CharT,Traits,A>& x, const basic_string<CharT,Traits,A>& y)
+operator<(const basic_string<CharT,Traits,A>& x, const basic_string<CharT,Traits,A>& y)
{
return x.compare(y) < 0;
// return basic_string<CharT,Traits,A>
@@ -2671,7 +2671,7 @@
template <class CharT, class Traits, class A>
inline bool
-operator<(const CharT* s, const basic_string<CharT,Traits,A>& y)
+operator<(const CharT* s, const basic_string<CharT,Traits,A>& y)
{
return y.compare(s) > 0;
// basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
@@ -2682,7 +2682,7 @@
template <class CharT, class Traits, class A>
inline bool
operator<(const basic_string<CharT,Traits,A>& x,
- const CharT* s)
+ const CharT* s)
{
return x.compare(s) < 0;
// basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
@@ -2705,7 +2705,7 @@
template <class CharT, class Traits, class A>
inline bool
-operator>(const basic_string<CharT,Traits,A>& x, const CharT* s)
+operator>(const basic_string<CharT,Traits,A>& x, const CharT* s)
{
return s < x;
}
@@ -2713,44 +2713,44 @@
template <class CharT, class Traits, class A>
inline bool
operator<=(const basic_string<CharT,Traits,A>& x,
- const basic_string<CharT,Traits,A>& y)
+ const basic_string<CharT,Traits,A>& y)
{
return !(y < x);
}
template <class CharT, class Traits, class A>
inline bool
-operator<=(const CharT* s, const basic_string<CharT,Traits,A>& y)
+operator<=(const CharT* s, const basic_string<CharT,Traits,A>& y)
{ return !(y < s); }
template <class CharT, class Traits, class A>
inline bool
-operator<=(const basic_string<CharT,Traits,A>& x, const CharT* s)
+operator<=(const basic_string<CharT,Traits,A>& x, const CharT* s)
{ return !(s < x); }
template <class CharT, class Traits, class A>
inline bool
operator>=(const basic_string<CharT,Traits,A>& x,
- const basic_string<CharT,Traits,A>& y)
+ const basic_string<CharT,Traits,A>& y)
{ return !(x < y); }
template <class CharT, class Traits, class A>
inline bool
-operator>=(const CharT* s, const basic_string<CharT,Traits,A>& y)
+operator>=(const CharT* s, const basic_string<CharT,Traits,A>& y)
{ return !(s < y); }
template <class CharT, class Traits, class A>
inline bool
-operator>=(const basic_string<CharT,Traits,A>& x, const CharT* s)
+operator>=(const basic_string<CharT,Traits,A>& x, const CharT* s)
{ return !(x < s); }
// Swap.
template <class CharT, class Traits, class A>
-inline void swap(basic_string<CharT,Traits,A>& x, basic_string<CharT,Traits,A>& y)
+inline void swap(basic_string<CharT,Traits,A>& x, basic_string<CharT,Traits,A>& y)
{ x.swap(y); }
/// @cond
-// I/O.
+// I/O.
namespace container_detail {
template <class CharT, class Traits>
@@ -2788,11 +2788,11 @@
if (w != 0 && n < w)
pad_len = w - n;
-
+
if (!left)
- ok = container_detail::string_fill(os, buf, pad_len);
+ ok = container_detail::string_fill(os, buf, pad_len);
- ok = ok &&
+ ok = ok &&
buf->sputn(s.data(), std::streamsize(n)) == std::streamsize(n);
if (left)
@@ -2807,7 +2807,7 @@
template <class CharT, class Traits, class A>
-std::basic_istream<CharT, Traits>&
+std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,A>& s)
{
typename std::basic_istream<CharT, Traits>::sentry sentry(is);
@@ -2842,7 +2842,7 @@
s.push_back(c);
}
}
-
+
// If we have read no characters, then set failbit.
if (s.size() == 0)
is.setstate(std::ios_base::failbit);
@@ -2853,8 +2853,8 @@
return is;
}
-template <class CharT, class Traits, class A>
-std::basic_istream<CharT, Traits>&
+template <class CharT, class Traits, class A>
+std::basic_istream<CharT, Traits>&
getline(std::istream& is, basic_string<CharT,Traits,A>& s,CharT delim)
{
typename basic_string<CharT,Traits,A>::size_type nread = 0;
@@ -2872,7 +2872,7 @@
else {
++nread;
CharT c = Traits::to_char_type(c1);
- if (!Traits::eq(c, delim))
+ if (!Traits::eq(c, delim))
s.push_back(c);
else
break; // Character is extracted but not appended.
@@ -2885,8 +2885,8 @@
return is;
}
-template <class CharT, class Traits, class A>
-inline std::basic_istream<CharT, Traits>&
+template <class CharT, class Traits, class A>
+inline std::basic_istream<CharT, Traits>&
getline(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,A>& s)
{
return getline(is, s, '\n');
Modified: branches/release/boost/container/vector.hpp
==============================================================================
--- branches/release/boost/container/vector.hpp (original)
+++ branches/release/boost/container/vector.hpp 2012-05-24 12:36:39 EDT (Thu, 24 May 2012)
@@ -55,7 +55,7 @@
namespace container_detail {
-//! Const vector_iterator used to iterate through a vector.
+//! Const vector_iterator used to iterate through a vector.
template <class Pointer>
class vector_const_iterator
{
@@ -82,20 +82,20 @@
vector_const_iterator() : m_ptr(0){}
//Pointer like operators
- reference operator*() const
+ reference operator*() const
{ return *m_ptr; }
- const value_type * operator->() const
+ const value_type * operator->() const
{ return container_detail::to_raw_pointer(m_ptr); }
reference operator[](difference_type off) const
{ return m_ptr[off]; }
//Increment / Decrement
- vector_const_iterator& operator++()
+ vector_const_iterator& operator++()
{ ++m_ptr; return *this; }
- vector_const_iterator operator++(int)
+ vector_const_iterator operator++(int)
{ Pointer tmp = m_ptr; ++*this; return vector_const_iterator(tmp); }
vector_const_iterator& operator--()
@@ -165,22 +165,22 @@
{}
//Pointer like operators
- reference operator*() const
+ reference operator*() const
{ return *this->m_ptr; }
- value_type* operator->() const
+ value_type* operator->() const
{ return container_detail::to_raw_pointer(this->m_ptr); }
- reference operator[](difference_type off) const
+ reference operator[](difference_type off) const
{ return this->m_ptr[off]; }
//Increment / Decrement
- vector_iterator& operator++()
+ vector_iterator& operator++()
{ ++this->m_ptr; return *this; }
vector_iterator operator++(int)
{ pointer tmp = this->m_ptr; ++*this; return vector_iterator(tmp); }
-
+
vector_iterator& operator--()
{ --this->m_ptr; return *this; }
@@ -249,7 +249,7 @@
//!This struct deallocates and allocated memory
template <class A>
-struct vector_alloc_holder
+struct vector_alloc_holder
{
typedef boost::container::allocator_traits<A> allocator_traits_type;
typedef typename allocator_traits_type::pointer pointer;
@@ -282,7 +282,7 @@
boost::container::container_detail::version<A>::value> alloc_version;
std::pair<pointer, bool>
allocation_command(allocation_type command,
- size_type limit_size,
+ size_type limit_size,
size_type preferred_size,
size_type &received_size, const pointer &reuse = 0)
{
@@ -292,7 +292,7 @@
std::pair<pointer, bool>
allocation_command(allocation_type command,
- size_type limit_size,
+ size_type limit_size,
size_type preferred_size,
size_type &received_size,
const pointer &reuse,
@@ -308,7 +308,7 @@
std::pair<pointer, bool>
allocation_command(allocation_type command,
- size_type limit_size,
+ size_type limit_size,
size_type preferred_size,
size_type &received_size,
const pointer &reuse,
@@ -394,9 +394,9 @@
/// @endcond
//! \class vector
-//! A vector is a sequence that supports random access to elements, constant
-//! time insertion and removal of elements at the end, and linear time insertion
-//! and removal of elements at the beginning or in the middle. The number of
+//! A vector is a sequence that supports random access to elements, constant
+//! time insertion and removal of elements at the end, and linear time insertion
+//! and removal of elements at the beginning or in the middle. The number of
//! elements in a vector may vary dynamically; memory management is automatic.
//! boost::container::vector is similar to std::vector but it's compatible
//! with shared memory and memory mapped files.
@@ -434,11 +434,11 @@
//! The random access const_iterator
typedef container_detail::vector_const_iterator<pointer> const_iterator;
- //! Iterator used to iterate backwards through a vector.
- typedef std::reverse_iterator<iterator>
+ //! Iterator used to iterate backwards through a vector.
+ typedef std::reverse_iterator<iterator>
reverse_iterator;
- //! Const iterator used to iterate backwards through a vector.
- typedef std::reverse_iterator<const_iterator>
+ //! Const iterator used to iterate backwards through a vector.
+ typedef std::reverse_iterator<const_iterator>
const_reverse_iterator;
//! The stored allocator type
typedef allocator_type stored_allocator_type;
@@ -461,9 +461,9 @@
public:
//! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's default constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant.
vector()
BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<A>::value)
@@ -471,9 +471,9 @@
{}
//! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
- //!
+ //!
//! <b>Throws</b>: Nothing
- //!
+ //!
//! <b>Complexity</b>: Constant.
explicit vector(const A& a) BOOST_CONTAINER_NOEXCEPT
: base_t(a)
@@ -484,7 +484,7 @@
//!
//! <b>Throws</b>: If allocator_type's default constructor or allocation
//! throws or T's default constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Linear to n.
explicit vector(size_type n)
: base_t()
@@ -511,21 +511,21 @@
//!
//! <b>Throws</b>: If allocator_type's default constructor or allocation
//! throws or T's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Linear to n.
- vector(size_type n, const T& value, const allocator_type& a = allocator_type())
+ vector(size_type n, const T& value, const allocator_type& a = allocator_type())
: base_t(a)
{ this->insert(this->cend(), n, value); }
//! <b>Effects</b>: Copy constructs a vector.
//!
//! <b>Postcondition</b>: x == *this.
- //!
+ //!
//! <b>Throws</b>: If allocator_type's default constructor or allocation
//! throws or T's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements x contains.
- vector(const vector &x)
+ vector(const vector &x)
: base_t(allocator_traits_type::select_on_container_copy_construction(x.alloc()))
{
this->assign( container_detail::to_raw_pointer(x.members_.m_start)
@@ -535,7 +535,7 @@
//! <b>Effects</b>: Move constructor. Moves mx's resources to *this.
//!
//! <b>Throws</b>: Nothing
- //!
+ //!
//! <b>Complexity</b>: Constant.
vector(BOOST_RV_REF(vector) mx) BOOST_CONTAINER_NOEXCEPT
: base_t(boost::move(mx.alloc()))
@@ -544,12 +544,12 @@
//! <b>Effects</b>: Copy constructs a vector using the specified allocator.
//!
//! <b>Postcondition</b>: x == *this.
- //!
+ //!
//! <b>Throws</b>: If allocation
//! throws or T's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Linear to the elements x contains.
- vector(const vector &x, const allocator_type &a)
+ vector(const vector &x, const allocator_type &a)
: base_t(a)
{
this->assign( container_detail::to_raw_pointer(x.members_.m_start)
@@ -561,7 +561,7 @@
//! Otherwise copies values from x to *this.
//!
//! <b>Throws</b>: If allocation or T's copy constructor throws.
- //!
+ //!
//! <b>Complexity</b>: Constant if a == mx.get_allocator(), linear otherwise.
vector(BOOST_RV_REF(vector) mx, const allocator_type &a)
: base_t(a)
@@ -597,103 +597,103 @@
{} //vector_alloc_holder clears the data
//! <b>Effects</b>: Returns an iterator to the first element contained in the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
iterator begin() BOOST_CONTAINER_NOEXCEPT
{ return iterator(this->members_.m_start); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
{ return const_iterator(this->members_.m_start); }
//! <b>Effects</b>: Returns an iterator to the end of the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
iterator end() BOOST_CONTAINER_NOEXCEPT
{ return iterator(this->members_.m_start + this->members_.m_size); }
//! <b>Effects</b>: Returns a const_iterator to the end of the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator end() const BOOST_CONTAINER_NOEXCEPT
{ return this->cend(); }
- //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
- //! of the reversed vector.
- //!
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
{ return reverse_iterator(this->end()); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed vector.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
{ return this->crbegin(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
- //! of the reversed vector.
- //!
+ //! of the reversed vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
{ return reverse_iterator(this->begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed vector.
- //!
+ //! of the reversed vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
{ return this->crend(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
{ return const_iterator(this->members_.m_start); }
//! <b>Effects</b>: Returns a const_iterator to the end of the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
{ return const_iterator(this->members_.m_start + this->members_.m_size); }
- //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
- //! of the reversed vector.
- //!
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
{ return const_reverse_iterator(this->end());}
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
- //! of the reversed vector.
- //!
+ //! of the reversed vector.
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
{ return const_reverse_iterator(this->begin()); }
@@ -702,9 +702,9 @@
//!
//! <b>Effects</b>: Returns a reference to the first
//! element of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reference front() BOOST_CONTAINER_NOEXCEPT
{ return *this->members_.m_start; }
@@ -713,9 +713,9 @@
//!
//! <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 BOOST_CONTAINER_NOEXCEPT
{ return *this->members_.m_start; }
@@ -724,9 +724,9 @@
//!
//! <b>Effects</b>: Returns a reference to the last
//! element of the container.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
reference back() BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_start[this->members_.m_size - 1]; }
@@ -735,132 +735,132 @@
//!
//! <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 BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_start[this->members_.m_size - 1]; }
//! <b>Returns</b>: A pointer such that [data(),data() + size()) is a valid range.
//! For a non-empty vector, data() == &front().
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
pointer data() BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_start; }
//! <b>Returns</b>: A pointer such that [data(),data() + size()) is a valid range.
//! For a non-empty vector, data() == &front().
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
const_pointer data() const BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_start; }
//! <b>Effects</b>: Returns the number of the elements contained in the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
size_type size() const BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_size; }
//! <b>Effects</b>: Returns the largest possible size of the vector.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
size_type max_size() const BOOST_CONTAINER_NOEXCEPT
{ return allocator_traits_type::max_size(this->alloc()); }
//! <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 BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_capacity; }
//! <b>Effects</b>: Returns true if the vector contains no elements.
- //!
+ //!
//! <b>Throws</b>: Nothing.
- //!
+ //!
//! <b>Complexity</b>: Constant.
bool empty() const BOOST_CONTAINER_NOEXCEPT
{ return !this->members_.m_size; }
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a reference to the nth element
+ //! <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)
+ reference operator[](size_type n)
{ return this->members_.m_start[n]; }
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a const reference to the nth element
+ //! <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 BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_start[n]; }
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a reference to the nth element
+ //! <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)
+ reference at(size_type n)
{ this->priv_check_range(n); return this->members_.m_start[n]; }
//! <b>Requires</b>: size() > n.
//!
- //! <b>Effects</b>: Returns a const reference to the nth element
+ //! <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_check_range(n); return this->members_.m_start[n]; }
//! <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 BOOST_CONTAINER_NOEXCEPT
{ return this->alloc(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
- //!
+ //!
//! <b>Throws</b>: Nothing
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Non-standard extension.
const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
{ return this->alloc(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
- //!
+ //!
//! <b>Throws</b>: Nothing
- //!
+ //!
//! <b>Complexity</b>: Constant.
- //!
+ //!
//! <b>Note</b>: Non-standard extension.
stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
{ return this->alloc(); }
@@ -869,7 +869,7 @@
//! 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 or T's copy/move constructor throws.
void reserve(size_type new_cap)
{
@@ -928,8 +928,8 @@
//! <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>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/move constructor/assignment throws.
//!
@@ -1002,7 +1002,7 @@
//!
//! <b>Complexity</b>: Linear to n.
template <class InIt>
- void assign(InIt first, InIt last)
+ void assign(InIt first, InIt last)
{
//Dispatch depending on integer/iterator
const bool aux_boolean = container_detail::is_convertible<InIt, size_type>::value;
@@ -1113,7 +1113,7 @@
#include BOOST_PP_LOCAL_ITERATE()
#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
-
+
//! <b>Effects</b>: Swaps the contents of *this and x.
//!
//! <b>Throws</b>: Nothing.
@@ -1184,7 +1184,7 @@
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
- void pop_back()
+ void pop_back()
{
//Destroy last element
--this->members_.m_size;
@@ -1195,9 +1195,9 @@
//!
//! <b>Throws</b>: Nothing.
//!
- //! <b>Complexity</b>: Linear to the elements between pos and the
+ //! <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)
+ iterator erase(const_iterator position)
{
T *pos = container_detail::to_raw_pointer(position.get_ptr());
T *beg = container_detail::to_raw_pointer(this->members_.m_start);
@@ -1214,7 +1214,7 @@
//!
//! <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)
+ iterator erase(const_iterator first, const_iterator last)
{
if (first != last){ // worth doing, copy down over hole
T* end_pos = container_detail::to_raw_pointer(this->members_.m_start) + this->members_.m_size;
@@ -1236,7 +1236,7 @@
//! <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 T& x)
+ void resize(size_type new_size, const T& x)
{
pointer finish = this->members_.m_start + this->members_.m_size;
if (new_size < size()){
@@ -1255,7 +1255,7 @@
//! <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)
+ void resize(size_type new_size)
{
if (new_size < this->size()){
//Destroy last elements
@@ -1288,8 +1288,23 @@
/// @cond
+ //Absolutely experimental. This function might change, disappear or simply crash!
+ template<class BiDirPosConstIt, class BiDirValueIt>
+ void insert_ordered_at(size_type element_count, BiDirPosConstIt last_position_it, BiDirValueIt last_value_it)
+ {
+ const size_type *dummy = 0;
+ this->priv_insert_ordered_at(element_count, last_position_it, false, &dummy[0], last_value_it);
+ }
+
+ //Absolutely experimental. This function might change, disappear or simply crash!
+ template<class BiDirPosConstIt, class BiDirSkipConstIt, class BiDirValueIt>
+ void insert_ordered_at(size_type element_count, BiDirPosConstIt last_position_it, BiDirSkipConstIt last_skip_it, BiDirValueIt last_value_it)
+ {
+ this->priv_insert_ordered_at(element_count, last_position_it, true, last_skip_it, last_value_it);
+ }
+
private:
- iterator priv_insert(const_iterator position, const T &x)
+ iterator priv_insert(const_iterator position, const T &x)
{
//Just call more general insert(pos, size, value) and return iterator
size_type pos_n = position - cbegin();
@@ -1297,7 +1312,7 @@
return iterator(this->members_.m_start + pos_n);
}
- iterator priv_insert(const_iterator position, BOOST_RV_REF(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();
@@ -1387,7 +1402,7 @@
template <class FwdIt>
void priv_range_insert(const_iterator pos, FwdIt first, FwdIt last, std::forward_iterator_tag)
{
- if(first != last){
+ if(first != last){
const size_type n = std::distance(first, last);
container_detail::advanced_insert_aux_proxy<A, FwdIt, T*> proxy(this->alloc(), first, last);
priv_range_insert(pos.get_ptr(), n, proxy);
@@ -1428,7 +1443,7 @@
this->members_.m_capacity = real_cap;
}
}
-
+
//If we had room or we have expanded forward
if (same_buffer_start){
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
@@ -1463,10 +1478,10 @@
}
}
- public:
//Absolutely experimental. This function might change, disappear or simply crash!
- template<class BiDirPosIt, class BiDirValueIt>
- void insert_ordered_at(size_type element_count, BiDirPosIt last_position_it, BiDirValueIt last_value_it)
+ template<class BiDirPosConstIt, class BiDirSkipConstIt, class BiDirValueIt>
+ void priv_insert_ordered_at( size_type element_count, BiDirPosConstIt last_position_it
+ , bool do_skip, BiDirSkipConstIt last_skip_it, BiDirValueIt last_value_it)
{
const size_type old_size_pos = this->size();
this->reserve(old_size_pos + element_count);
@@ -1484,11 +1499,15 @@
while(insertions_left){
const size_type pos = static_cast<size_type>(*(--last_position_it));
BOOST_ASSERT(pos <= old_size_pos);
- //Shift the range after the insertion point, function will take care if the shift
- //crosses the size() boundary, using copy/move or uninitialized copy/move if necessary.
- size_type new_hole_size = insert_ordered_at_shift_range(pos, next_pos, this->size(), insertions_left);
+ //If needed shift the range after the insertion point and the previous insertion point.
+ //Function will take care if the shift crosses the size() boundary, using copy/move
+ //or uninitialized copy/move if necessary.
+ size_type new_hole_size = (pos != next_pos)
+ ? priv_insert_ordered_at_shift_range(pos, next_pos, this->size(), insertions_left)
+ : hole_size
+ ;
if(new_hole_size > 0){
- //The hole was reduced by insert_ordered_at_shift_range so expand exception rollback range backwards
+ //The hole was reduced by priv_insert_ordered_at_shift_range so expand exception rollback range backwards
past_hole_values_destroyer.increment_size_backwards(next_pos - pos);
//Insert the new value in the hole
allocator_traits_type::construct(this->alloc(), begin_ptr + pos + insertions_left - 1, *(--last_value_it));
@@ -1505,13 +1524,19 @@
}
else{
if(hole_size){
- //Hole was just filled by insert_ordered_at_shift_range, disable exception rollback and change vector size
+ //Hole was just filled by priv_insert_ordered_at_shift_range, disable exception rollback and change vector size
past_hole_values_destroyer.release();
this->members_.m_size += element_count;
}
//Insert the new value in the already constructed range
begin_ptr[pos + insertions_left - 1] = *(--last_value_it);
}
+ if(do_skip){
+ size_type n = *(--last_skip_it);
+ while(n--){
+ --last_value_it;
+ }
+ }
--insertions_left;
hole_size = new_hole_size;
next_pos = pos;
@@ -1531,7 +1556,7 @@
//
//Old situation:
// first_pos last_pos old_limit
- // | | |
+ // | | |
// ____________V_______V__________________V_____________
//| prefix | range | suffix |raw_mem ~
//|____________|_______|__________________|_____________~
@@ -1540,20 +1565,20 @@
// range is moved through move assignments
//
// first_pos last_pos old_limit
- // | | |
+ // | | |
// ____________V_______V__________________V_____________
//| prefix' | | | range |suffix'|raw_mem ~
//|________________+______|___^___|_______|_____________~
// | |
- // |_>_>_>_>_>^
+ // |_>_>_>_>_>^
//
//
//New situation in Case B (hole_size >= 0):
// range is moved through uninitialized moves
//
// first_pos last_pos old_limit
- // | | |
- // ____________V_______V__________________V________________
+ // | | |
+ // ____________V_______V__________________V________________
//| prefix' | | | [hole] | range |
//|_______________________________________|________|___^___|
// | |
@@ -1563,13 +1588,13 @@
// range is moved through move assignments and uninitialized moves
//
// first_pos last_pos old_limit
- // | | |
- // ____________V_______V__________________V___
+ // | | |
+ // ____________V_______V__________________V___
//| prefix' | | | range |
//|___________________________________|___^___|
// | |
// |_>_>_>_>_>_>_>_>_>_>_>^
- size_type insert_ordered_at_shift_range(size_type first_pos, size_type last_pos, size_type limit_pos, size_type shift_count)
+ size_type priv_insert_ordered_at_shift_range(size_type first_pos, size_type last_pos, size_type limit_pos, size_type shift_count)
{
BOOST_ASSERT(first_pos <= last_pos);
BOOST_ASSERT(last_pos <= limit_pos);
@@ -1597,7 +1622,7 @@
::boost::container::uninitialized_move_alloc
(this->alloc(), boundary_ptr, begin_ptr + last_pos, limit_ptr);
//The rest is move assigned
- boost::move_backward(begin_ptr + first_pos, boundary_ptr, limit_ptr + shift_count);
+ boost::move_backward(begin_ptr + first_pos, boundary_ptr, limit_ptr);
}
return hole_size;
}
@@ -1646,7 +1671,7 @@
typename value_traits::ArrayDeallocator scoped_alloc(new_start, this->alloc(), new_cap);
typename value_traits::ArrayDestructor constructed_values_destroyer(new_start, this->alloc(), 0u);
- //Initialize with [begin(), pos) old buffer
+ //Initialize with [begin(), pos) old buffer
//the start of the new buffer
T *old_buffer = container_detail::to_raw_pointer(this->members_.m_start);
if(old_buffer){
@@ -1658,7 +1683,7 @@
interf.uninitialized_copy_remaining_to(old_finish = new_finish);
new_finish += n;
constructed_values_destroyer.increment_size(new_finish - old_finish);
- //Initialize from the rest of the old buffer,
+ //Initialize from the rest of the old buffer,
//starting from previous point
if(old_buffer){
new_finish = ::boost::container::uninitialized_move_alloc
@@ -1666,7 +1691,7 @@
//Destroy and deallocate old elements
//If there is allocated memory, destroy and deallocate
if(!value_traits::trivial_dctr_after_move)
- this->destroy_n(old_buffer, this->members_.m_size);
+ this->destroy_n(old_buffer, this->members_.m_size);
this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
}
this->members_.m_start = new_start;
@@ -1812,7 +1837,7 @@
//|___________|_____|_________|_____________________|
//
//Copy the first part of old_begin to raw_mem
- T *start_n = old_start + difference_type(s_before);
+ T *start_n = old_start + difference_type(s_before);
::boost::container::uninitialized_move_alloc
(this->alloc(), old_start, start_n, new_start);
//The buffer is all constructed until old_end,
@@ -2021,7 +2046,7 @@
this->members_.m_capacity = real_cap;
}
}
-
+
if(same_buffer_start){
T *start = container_detail::to_raw_pointer(this->members_.m_start);
if (this->size() >= n){
@@ -2050,7 +2075,7 @@
scoped_alloc.release();
//Destroy and deallocate old buffer
if(this->members_.m_start != 0){
- this->destroy_n(container_detail::to_raw_pointer(this->members_.m_start), this->members_.m_size);
+ this->destroy_n(container_detail::to_raw_pointer(this->members_.m_start), this->members_.m_size);
this->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
}
this->members_.m_start = ret.first;
@@ -2068,7 +2093,7 @@
this->members_.m_size = 0;
this->members_.m_start = ret.first;
this->members_.m_capacity = real_cap;
-
+
//Backup old buffer data
size_type old_offset = old_start - container_detail::to_raw_pointer(ret.first);
size_type first_count = container_detail::min_value(n, old_offset);
@@ -2079,7 +2104,7 @@
(this->alloc(), first, mid, container_detail::to_raw_pointer(ret.first));
if(old_offset > n){
- //All old elements will be destroyed by "old_values_destroyer"
+ //All old elements will be destroyed by "old_values_destroyer"
this->members_.m_size = n;
}
else{
@@ -2094,7 +2119,7 @@
std::advance(mid2, second_count);
// iG std::copy(mid, mid2, old_start);
std::copy(mid, mid2, old_start);
-
+
//Check if we still have to append elements in the
//uninitialized end
if(second_count == old_size){
@@ -2107,7 +2132,7 @@
(old_start + second_count, old_size - second_count);
this->members_.m_size = n;
}
- this->members_.m_size = n;
+ this->members_.m_size = n;
}
}
}
@@ -2118,18 +2143,18 @@
template <class InIt>
void priv_assign_dispatch(InIt first, InIt last, container_detail::false_)
- {
+ {
//Dispatch depending on integer/iterator
typedef typename std::iterator_traits<InIt>::iterator_category ItCat;
- this->priv_assign_aux(first, last, ItCat());
+ this->priv_assign_aux(first, last, ItCat());
}
template <class Integer>
- void priv_insert_dispatch(const_iterator pos, Integer n, Integer val, container_detail::true_)
+ void priv_insert_dispatch(const_iterator pos, Integer n, Integer val, container_detail::true_)
{ this->insert(pos, (size_type)n, (T)val); }
template <class InIt>
- void priv_insert_dispatch(const_iterator pos, InIt first,
+ void priv_insert_dispatch(const_iterator pos, InIt first,
InIt last, container_detail::false_)
{
//Dispatch depending on integer/iterator
@@ -2137,7 +2162,7 @@
this->priv_range_insert(pos, first, last, ItCat());
}
- void priv_check_range(size_type n) const
+ void priv_check_range(size_type n) const
{
//If n is out of range, throw an out_of_range exception
if (n >= size())
@@ -2157,7 +2182,7 @@
};
template <class T, class A>
-inline bool
+inline bool
operator==(const vector<T, A>& x, const vector<T, A>& y)
{
//Check first size and each element if needed
@@ -2165,7 +2190,7 @@
}
template <class T, class A>
-inline bool
+inline bool
operator!=(const vector<T, A>& x, const vector<T, A>& y)
{
//Check first size and each element if needed
@@ -2173,7 +2198,7 @@
}
template <class T, class A>
-inline bool
+inline bool
operator<(const vector<T, A>& x, const vector<T, A>& y)
{
return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
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