Reordered sequence container types and functions to improve Doxygen documentation

[SVN r80686]
This commit is contained in:
Ion Gaztañaga
2012-09-24 10:27:02 +00:00
parent de1caeb5d0
commit ac05be5947
10 changed files with 2001 additions and 1626 deletions

View File

@@ -27,6 +27,8 @@ doxygen autodoc
<doxygen:param>MACRO_EXPANSION=YES <doxygen:param>MACRO_EXPANSION=YES
<doxygen:param>"PREDEFINED=\"insert_const_ref_type= const T&\" \\ <doxygen:param>"PREDEFINED=\"insert_const_ref_type= const T&\" \\
\"BOOST_CONTAINER_DOXYGEN_INVOKED\" \\ \"BOOST_CONTAINER_DOXYGEN_INVOKED\" \\
\"BOOST_CONTAINER_IMPDEF(T)=implementation_defined\" \\
\"BOOST_CONTAINER_SEEDOC(T)=see_documentation\" \\
\"BOOST_RV_REF(T)=T &&\" \\ \"BOOST_RV_REF(T)=T &&\" \\
\"BOOST_RV_REF_BEG=\" \\ \"BOOST_RV_REF_BEG=\" \\
\"BOOST_RV_REF_END=&&\" \\ \"BOOST_RV_REF_END=&&\" \\

View File

@@ -617,13 +617,15 @@ use [*Boost.Container]? There are several reasons for that:
[section:release_notes_boost_1_52_00 Boost 1.52 Release] [section:release_notes_boost_1_52_00 Boost 1.52 Release]
* Improved `stable_vector`'s template code bloat and type safety. * Improved `stable_vector`'s template code bloat and type safety.
* Changed typedefs and reordered functions of sequence containers to improve doxygen documentation.
* Fixed bugs * Fixed bugs
[@https://svn.boost.org/trac/boost/ticket/6615 #6615], [@https://svn.boost.org/trac/boost/ticket/6615 #6615],
[@https://svn.boost.org/trac/boost/ticket/7139 #7139], [@https://svn.boost.org/trac/boost/ticket/7139 #7139],
[@https://svn.boost.org/trac/boost/ticket/7215 #7215], [@https://svn.boost.org/trac/boost/ticket/7215 #7215],
[@https://svn.boost.org/trac/boost/ticket/7232 #7232], [@https://svn.boost.org/trac/boost/ticket/7232 #7232],
[@https://svn.boost.org/trac/boost/ticket/7269 #7269]. [@https://svn.boost.org/trac/boost/ticket/7269 #7269].
* Implemented LWG Issue #149 (range insertion now returns an iterator) & cleaned up insertion code in most containers
* Corrected aliasing errors.
[endsect] [endsect]

View File

@@ -70,41 +70,41 @@ struct allocator_traits
typedef unspecified pointer; typedef unspecified pointer;
//! Alloc::const_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const //! Alloc::const_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const
//! //!
typedef unspecified const_pointer; typedef see_documentation const_pointer;
//! Non-standard extension //! Non-standard extension
//! Alloc::reference if such a type exists; otherwise, value_type& //! Alloc::reference if such a type exists; otherwise, value_type&
typedef unspecified reference; typedef see_documentation reference;
//! Non-standard extension //! Non-standard extension
//! Alloc::const_reference if such a type exists ; otherwise, const value_type& //! Alloc::const_reference if such a type exists ; otherwise, const value_type&
typedef unspecified const_reference; typedef see_documentation const_reference;
//! Alloc::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>. //! Alloc::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>.
//! //!
typedef unspecified void_pointer; typedef see_documentation void_pointer;
//! Alloc::const_void_pointer if such a type exists ; otherwis e, pointer_traits<pointer>::rebind<const //! Alloc::const_void_pointer if such a type exists ; otherwis e, pointer_traits<pointer>::rebind<const
//! //!
typedef unspecified const_void_pointer; typedef see_documentation const_void_pointer;
//! Alloc::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type. //! Alloc::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type.
//! //!
typedef unspecified difference_type; typedef see_documentation difference_type;
//! Alloc::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::type //! Alloc::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::type
//! //!
typedef unspecified size_type; typedef see_documentation size_type;
//! Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant //! Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant
//! type with internal constant static member `value` == false. //! type with internal constant static member `value` == false.
typedef unspecified propagate_on_container_copy_assignment; typedef see_documentation propagate_on_container_copy_assignment;
//! Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant //! Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant
//! type with internal constant static member `value` == false. //! type with internal constant static member `value` == false.
typedef unspecified propagate_on_container_move_assignment; typedef see_documentation propagate_on_container_move_assignment;
//! Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant //! Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant
//! type with internal constant static member `value` == false. //! type with internal constant static member `value` == false.
typedef unspecified propagate_on_container_swap; typedef see_documentation propagate_on_container_swap;
//! Defines an allocator: Alloc::rebind<T>::other if such a type exists; otherwise, Alloc<T, Args> //! 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. //! 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 //! In C++03 compilers `rebind_alloc` is a struct derived from an allocator
//! deduced by previously detailed rules. //! deduced by previously detailed rules.
template <class T> using rebind_alloc = unspecified; template <class T> using rebind_alloc = see_documentation;
//! In C++03 compilers `rebind_traits` is a struct derived from //! In C++03 compilers `rebind_traits` is a struct derived from
//! `allocator_traits<OtherAlloc>`, where `OtherAlloc` is //! `allocator_traits<OtherAlloc>`, where `OtherAlloc` is
@@ -115,7 +115,7 @@ struct allocator_traits
//! `type` is an allocator related to Alloc deduced deduced by rules explained in `rebind_alloc`. //! `type` is an allocator related to Alloc deduced deduced by rules explained in `rebind_alloc`.
template <class T> template <class T>
struct portable_rebind_alloc struct portable_rebind_alloc
{ typedef unspecified_type type; }; { typedef see_documentation type; };
#else #else
//pointer //pointer
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc,

View File

@@ -585,6 +585,22 @@ struct is_bidirectional_iterator<T, false>
static const bool value = false; static const bool value = false;
}; };
template<class T, class IIterator>
struct iiterator_types
{
typedef typename std::iterator_traits<IIterator>::pointer it_pointer;
typedef typename std::iterator_traits<IIterator>::difference_type difference_type;
typedef typename ::boost::intrusive::pointer_traits<it_pointer>::
template rebind_pointer<T>::type pointer;
typedef typename ::boost::intrusive::pointer_traits<it_pointer>::
template rebind_pointer<const T>::type const_pointer;
typedef typename ::boost::intrusive::
pointer_traits<pointer>::reference reference;
typedef typename ::boost::intrusive::
pointer_traits<const_pointer>::reference const_reference;
};
} //namespace container_detail { } //namespace container_detail {
} //namespace container { } //namespace container {
@@ -593,4 +609,3 @@ struct is_bidirectional_iterator<T, false>
#include <boost/container/detail/config_end.hpp> #include <boost/container/detail/config_end.hpp>
#endif //#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP #endif //#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP

View File

@@ -31,6 +31,10 @@
#define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST #define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST
#endif #endif
//Macros for documentation purposes. For code, expands to the argument
#define BOOST_CONTAINER_IMPDEF(TYPE) TYPE
#define BOOST_CONTAINER_SEEDOC(TYPE) TYPE
#include <boost/container/detail/config_end.hpp> #include <boost/container/detail/config_end.hpp>
#endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP #endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -466,9 +466,6 @@ class stable_vector
typedef typename index_traits_type::index_iterator index_iterator; typedef typename index_traits_type::index_iterator index_iterator;
typedef typename index_traits_type:: typedef typename index_traits_type::
const_index_iterator const_index_iterator; const_index_iterator const_index_iterator;
typedef typename container_detail::
move_const_ref_type<T>::type insert_const_ref_type;
typedef boost::intrusive:: typedef boost::intrusive::
pointer_traits pointer_traits
<typename allocator_traits_type::pointer> ptr_traits; <typename allocator_traits_type::pointer> ptr_traits;
@@ -601,27 +598,35 @@ class stable_vector
{ this->priv_node_alloc().deallocate_individual(boost::move(holder)); } { this->priv_node_alloc().deallocate_individual(boost::move(holder)); }
friend class stable_vector_detail::clear_on_destroy<stable_vector>; friend class stable_vector_detail::clear_on_destroy<stable_vector>;
typedef stable_vector_detail::iterator
< T
, typename allocator_traits<A>::reference
, typename allocator_traits<A>::pointer> iterator_impl;
typedef stable_vector_detail::iterator
< T
, typename allocator_traits<A>::const_reference
, typename allocator_traits<A>::const_pointer> const_iterator_impl;
///@endcond ///@endcond
public: public:
//////////////////////////////////////////////
// types: //
// types
typedef typename allocator_traits_type::reference reference; //
typedef typename allocator_traits_type::const_reference const_reference; //////////////////////////////////////////////
typedef typename allocator_traits_type::pointer pointer; typedef T value_type;
typedef typename allocator_traits_type::const_pointer const_pointer; typedef typename ::boost::container::allocator_traits<A>::pointer pointer;
typedef stable_vector_detail::iterator typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
<T,T&, pointer> iterator; typedef typename ::boost::container::allocator_traits<A>::reference reference;
typedef stable_vector_detail::iterator typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
<T,const T&, const_pointer> const_iterator; typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
typedef typename index_type::size_type size_type; typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
typedef typename iterator::difference_type difference_type; typedef A allocator_type;
typedef T value_type; typedef node_allocator_type stored_allocator_type;
typedef A allocator_type; typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator;
typedef std::reverse_iterator<iterator> reverse_iterator; typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<iterator>) reverse_iterator;
typedef node_allocator_type stored_allocator_type; typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<const_iterator>) const_reverse_iterator;
///@cond ///@cond
private: private:
@@ -636,6 +641,11 @@ class stable_vector
///@endcond ///@endcond
public: public:
//////////////////////////////////////////////
//
// construct/copy/destroy
//
//////////////////////////////////////////////
//! <b>Effects</b>: Default constructs a stable_vector. //! <b>Effects</b>: Default constructs a stable_vector.
//! //!
@@ -842,6 +852,18 @@ class stable_vector
return *this; return *this;
} }
//! <b>Effects</b>: Assigns the n copies of val to *this.
//!
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to n.
void assign(size_type n, const T& t)
{
typedef constant_iterator<value_type, difference_type> cvalue_iterator;
this->assign(cvalue_iterator(t, n), cvalue_iterator());
}
//! <b>Effects</b>: Assigns the the range [first, last) to *this. //! <b>Effects</b>: Assigns the the range [first, last) to *this.
//! //!
//! <b>Throws</b>: If memory allocation throws or //! <b>Throws</b>: If memory allocation throws or
@@ -870,17 +892,6 @@ class stable_vector
} }
} }
//! <b>Effects</b>: Assigns the n copies of val to *this.
//!
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to n.
void assign(size_type n, const T& t)
{
typedef constant_iterator<value_type, difference_type> cvalue_iterator;
this->assign(cvalue_iterator(t, n), cvalue_iterator());
}
//! <b>Effects</b>: Returns a copy of the internal allocator. //! <b>Effects</b>: Returns a copy of the internal allocator.
//! //!
//! <b>Throws</b>: If allocator's copy constructor throws. //! <b>Throws</b>: If allocator's copy constructor throws.
@@ -909,6 +920,12 @@ class stable_vector
stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
{ return this->priv_node_alloc(); } { return this->priv_node_alloc(); }
//////////////////////////////////////////////
//
// iterators
//
//////////////////////////////////////////////
//! <b>Effects</b>: Returns an iterator to the first element contained in the stable_vector. //! <b>Effects</b>: Returns an iterator to the first element contained in the stable_vector.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
@@ -1011,6 +1028,20 @@ class stable_vector
const_reverse_iterator crend()const const_reverse_iterator crend()const
{ return this->rend(); } { return this->rend(); }
//////////////////////////////////////////////
//
// capacity
//
//////////////////////////////////////////////
//! <b>Effects</b>: Returns true if the stable_vector contains no elements.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
bool empty() const
{ return this->index.size() <= ExtraPointers; }
//! <b>Effects</b>: Returns the number of the elements contained in the stable_vector. //! <b>Effects</b>: Returns the number of the elements contained in the stable_vector.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
@@ -1030,31 +1061,22 @@ class stable_vector
size_type max_size() const size_type max_size() const
{ return this->index.max_size() - ExtraPointers; } { return this->index.max_size() - ExtraPointers; }
//! <b>Effects</b>: Number of elements for which memory has been allocated. //! <b>Effects</b>: Inserts or erases elements at the end such that
//! capacity() is always greater than or equal to size(). //! the size becomes n. New elements are default constructed.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Linear to the difference between size() and new_size.
size_type capacity() const void resize(size_type n)
{ {
const size_type index_size = this->index.size(); typedef default_construct_iterator<value_type, difference_type> default_iterator;
BOOST_ASSERT(!index_size || index_size >= ExtraPointers); STABLE_VECTOR_CHECK_INVARIANT;
const size_type bucket_extra_capacity = this->index.capacity()- index_size; if(n > this->size())
const size_type node_extra_capacity = this->internal_data.pool_size; this->insert(this->cend(), default_iterator(n - this->size()), default_iterator());
const size_type extra_capacity = (bucket_extra_capacity < node_extra_capacity) else if(n < this->size())
? bucket_extra_capacity : node_extra_capacity; this->erase(this->cbegin() + n, this->cend());
return (index_size ? (index_size - ExtraPointers + extra_capacity) : index_size);
} }
//! <b>Effects</b>: Returns true if the stable_vector contains no elements.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
bool empty() const
{ return this->index.size() <= ExtraPointers; }
//! <b>Effects</b>: Inserts or erases elements at the end such that //! <b>Effects</b>: Inserts or erases elements at the end such that
//! the size becomes n. New elements are copy constructed from x. //! the size becomes n. New elements are copy constructed from x.
//! //!
@@ -1070,20 +1092,21 @@ class stable_vector
this->erase(this->cbegin() + n, this->cend()); this->erase(this->cbegin() + n, this->cend());
} }
//! <b>Effects</b>: Inserts or erases elements at the end such that //! <b>Effects</b>: Number of elements for which memory has been allocated.
//! the size becomes n. New elements are default constructed. //! capacity() is always greater than or equal to size().
//! //!
//! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws. //! <b>Throws</b>: Nothing.
//! //!
//! <b>Complexity</b>: Linear to the difference between size() and new_size. //! <b>Complexity</b>: Constant.
void resize(size_type n) size_type capacity() const
{ {
typedef default_construct_iterator<value_type, difference_type> default_iterator; const size_type index_size = this->index.size();
STABLE_VECTOR_CHECK_INVARIANT; BOOST_ASSERT(!index_size || index_size >= ExtraPointers);
if(n > this->size()) const size_type bucket_extra_capacity = this->index.capacity()- index_size;
this->insert(this->cend(), default_iterator(n - this->size()), default_iterator()); const size_type node_extra_capacity = this->internal_data.pool_size;
else if(n < this->size()) const size_type extra_capacity = (bucket_extra_capacity < node_extra_capacity)
this->erase(this->cbegin() + n, this->cend()); ? bucket_extra_capacity : node_extra_capacity;
return (index_size ? (index_size - ExtraPointers + extra_capacity) : index_size);
} }
//! <b>Effects</b>: If n is less than or equal to capacity(), this call has no //! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
@@ -1116,6 +1139,86 @@ class stable_vector
} }
} }
//! <b>Effects</b>: Tries to deallocate the excess of memory created
//! with previous allocations. The size of the stable_vector is unchanged
//!
//! <b>Throws</b>: If memory allocation throws.
//!
//! <b>Complexity</b>: Linear to size().
void shrink_to_fit()
{
if(this->capacity()){
//First empty allocated node pool
this->priv_clear_pool();
//If empty completely destroy the index, let's recover default-constructed state
if(this->empty()){
this->index.clear();
this->index.shrink_to_fit();
this->internal_data.end_node.up = node_base_ptr_ptr();
}
//Otherwise, try to shrink-to-fit the index and readjust pointers if necessary
else{
const void* old_ptr = &index[0];
this->index.shrink_to_fit();
bool realloced = &index[0] != old_ptr;
//Fix the pointers for the newly allocated buffer
if(realloced){
index_traits_type::fix_up_pointers_from(this->index, this->index.begin());
}
}
}
}
//////////////////////////////////////////////
//
// element access
//
//////////////////////////////////////////////
//! <b>Requires</b>: !empty()
//!
//! <b>Effects</b>: Returns a reference to the first
//! element of the container.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reference front()
{ return static_cast<node_reference>(*this->index.front()).value; }
//! <b>Requires</b>: !empty()
//!
//! <b>Effects</b>: Returns a const reference to the first
//! element of the container.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reference front() const
{ return static_cast<const_node_reference>(*this->index.front()).value; }
//! <b>Requires</b>: !empty()
//!
//! <b>Effects</b>: Returns a reference to the last
//! element of the container.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reference back()
{ return static_cast<node_reference>(*this->index[this->size() - ExtraPointers]).value; }
//! <b>Requires</b>: !empty()
//!
//! <b>Effects</b>: Returns a const reference to the last
//! element of the container.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reference back()const
{ return static_cast<const_node_reference>(*this->index[this->size() - ExtraPointers]).value; }
//! <b>Requires</b>: size() > 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
@@ -1168,49 +1271,86 @@ class stable_vector
return operator[](n); return operator[](n);
} }
//! <b>Requires</b>: !empty() //////////////////////////////////////////////
//! //
//! <b>Effects</b>: Returns a reference to the first // modifiers
//! element of the container. //
//! //////////////////////////////////////////////
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reference front()
{ return static_cast<node_reference>(*this->index.front()).value; }
//! <b>Requires</b>: !empty() #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//!
//! <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 static_cast<const_node_reference>(*this->index.front()).value; }
//! <b>Requires</b>: !empty() //! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the end of the stable_vector.
//! //!
//! <b>Effects</b>: Returns a reference to the last //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
//! element of the container.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Complexity</b>: Amortized constant time.
//! template<class ...Args>
//! <b>Complexity</b>: Constant. void emplace_back(Args &&...args)
reference back() {
{ return static_cast<node_reference>(*this->index[this->size() - ExtraPointers]).value; } typedef emplace_functor<Args...> EmplaceFunctor;
typedef emplace_iterator<value_type, EmplaceFunctor, difference_type> EmplaceIterator;
EmplaceFunctor &&ef = EmplaceFunctor(boost::forward<Args>(args)...);
this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
}
//! <b>Requires</b>: !empty() //! <b>Requires</b>: position must be a valid iterator of *this.
//! //!
//! <b>Effects</b>: Returns a const reference to the last //! <b>Effects</b>: Inserts an object of type T constructed with
//! element of the container. //! std::forward<Args>(args)... before position
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: If position is end(), amortized constant time
const_reference back()const //! Linear time otherwise.
{ return static_cast<const_node_reference>(*this->index[this->size() - ExtraPointers]).value; } template<class ...Args>
iterator emplace(const_iterator position, Args && ...args)
{
//Just call more general insert(pos, size, value) and return iterator
size_type pos_n = position - cbegin();
typedef emplace_functor<Args...> EmplaceFunctor;
typedef emplace_iterator<value_type, EmplaceFunctor, difference_type> EmplaceIterator;
EmplaceFunctor &&ef = EmplaceFunctor(boost::forward<Args>(args)...);
this->insert(position, EmplaceIterator(ef), EmplaceIterator());
return iterator(this->begin() + pos_n);
}
#else
#define BOOST_PP_LOCAL_MACRO(n) \
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ \
typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >) \
EmplaceFunctor; \
typedef emplace_iterator<value_type, EmplaceFunctor, difference_type> EmplaceIterator; \
EmplaceFunctor ef BOOST_PP_LPAREN_IF(n) \
BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) \
BOOST_PP_RPAREN_IF(n); \
this->insert(this->cend() , EmplaceIterator(ef), EmplaceIterator()); \
} \
\
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
iterator emplace(const_iterator pos \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ \
typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >) \
EmplaceFunctor; \
typedef emplace_iterator<value_type, EmplaceFunctor, difference_type> EmplaceIterator; \
EmplaceFunctor ef BOOST_PP_LPAREN_IF(n) \
BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) \
BOOST_PP_RPAREN_IF(n); \
size_type pos_n = pos - this->cbegin(); \
this->insert(pos, EmplaceIterator(ef), EmplaceIterator()); \
return iterator(this->begin() + pos_n); \
} \
//!
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE()
#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts a copy of x at the end of the stable_vector. //! <b>Effects</b>: Inserts a copy of x at the end of the stable_vector.
@@ -1232,16 +1372,6 @@ class stable_vector
BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back) BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
#endif #endif
//! <b>Effects</b>: Removes the last element from the stable_vector.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant time.
void pop_back()
{ this->erase(this->end()-1); }
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Requires</b>: position must be a valid iterator of *this. //! <b>Requires</b>: position must be a valid iterator of *this.
//! //!
@@ -1355,80 +1485,13 @@ class stable_vector
} }
#endif #endif
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! <b>Effects</b>: Removes the last element from the stable_vector.
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the end of the stable_vector.
//! //!
//! <b>Throws</b>: If memory allocation throws or the in-place constructor throws. //! <b>Throws</b>: Nothing.
//! //!
//! <b>Complexity</b>: Amortized constant time. //! <b>Complexity</b>: Constant time.
template<class ...Args> void pop_back()
void emplace_back(Args &&...args) { this->erase(--this->cend()); }
{
typedef emplace_functor<Args...> EmplaceFunctor;
typedef emplace_iterator<value_type, EmplaceFunctor, difference_type> EmplaceIterator;
EmplaceFunctor &&ef = EmplaceFunctor(boost::forward<Args>(args)...);
this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator());
}
//! <b>Requires</b>: position must be a valid iterator of *this.
//!
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... before position
//!
//! <b>Throws</b>: If memory allocation throws or the in-place constructor throws.
//!
//! <b>Complexity</b>: If position is end(), amortized constant time
//! Linear time otherwise.
template<class ...Args>
iterator emplace(const_iterator position, Args && ...args)
{
//Just call more general insert(pos, size, value) and return iterator
size_type pos_n = position - cbegin();
typedef emplace_functor<Args...> EmplaceFunctor;
typedef emplace_iterator<value_type, EmplaceFunctor, difference_type> EmplaceIterator;
EmplaceFunctor &&ef = EmplaceFunctor(boost::forward<Args>(args)...);
this->insert(position, EmplaceIterator(ef), EmplaceIterator());
return iterator(this->begin() + pos_n);
}
#else
#define BOOST_PP_LOCAL_MACRO(n) \
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ \
typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >) \
EmplaceFunctor; \
typedef emplace_iterator<value_type, EmplaceFunctor, difference_type> EmplaceIterator; \
EmplaceFunctor ef BOOST_PP_LPAREN_IF(n) \
BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) \
BOOST_PP_RPAREN_IF(n); \
this->insert(this->cend() , EmplaceIterator(ef), EmplaceIterator()); \
} \
\
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
iterator emplace(const_iterator pos \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ \
typedef BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
BOOST_PP_EXPR_IF(n, <) BOOST_PP_ENUM_PARAMS(n, P) BOOST_PP_EXPR_IF(n, >) \
EmplaceFunctor; \
typedef emplace_iterator<value_type, EmplaceFunctor, difference_type> EmplaceIterator; \
EmplaceFunctor ef BOOST_PP_LPAREN_IF(n) \
BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) \
BOOST_PP_RPAREN_IF(n); \
size_type pos_n = pos - this->cbegin(); \
this->insert(pos, EmplaceIterator(ef), EmplaceIterator()); \
return iterator(this->begin() + pos_n); \
} \
//!
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE()
#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
//! <b>Effects</b>: Erases the element at position pos. //! <b>Effects</b>: Erases the element at position pos.
//! //!
@@ -1491,36 +1554,6 @@ class stable_vector
void clear() void clear()
{ this->erase(this->cbegin(),this->cend()); } { this->erase(this->cbegin(),this->cend()); }
//! <b>Effects</b>: Tries to deallocate the excess of memory created
//! with previous allocations. The size of the stable_vector is unchanged
//!
//! <b>Throws</b>: If memory allocation throws.
//!
//! <b>Complexity</b>: Linear to size().
void shrink_to_fit()
{
if(this->capacity()){
//First empty allocated node pool
this->priv_clear_pool();
//If empty completely destroy the index, let's recover default-constructed state
if(this->empty()){
this->index.clear();
this->index.shrink_to_fit();
this->internal_data.end_node.up = node_base_ptr_ptr();
}
//Otherwise, try to shrink-to-fit the index and readjust pointers if necessary
else{
const void* old_ptr = &index[0];
this->index.shrink_to_fit();
bool realloced = &index[0] != old_ptr;
//Fix the pointers for the newly allocated buffer
if(realloced){
index_traits_type::fix_up_pointers_from(this->index, this->index.begin());
}
}
}
}
/// @cond /// @cond
private: private:

View File

@@ -86,7 +86,7 @@ class vector_const_iterator
{ return *m_ptr; } { return *m_ptr; }
const value_type * operator->() const const value_type * operator->() const
{ return container_detail::to_raw_pointer(m_ptr); } { return container_detail::to_raw_pointer(m_ptr); }
reference operator[](difference_type off) const reference operator[](difference_type off) const
{ return m_ptr[off]; } { return m_ptr[off]; }
@@ -408,40 +408,29 @@ template <class T, class A>
class vector : private container_detail::vector_alloc_holder<A> class vector : private container_detail::vector_alloc_holder<A>
{ {
/// @cond /// @cond
typedef vector<T, A> self_t;
typedef container_detail::vector_alloc_holder<A> base_t; typedef container_detail::vector_alloc_holder<A> base_t;
typedef allocator_traits<A> allocator_traits_type; typedef allocator_traits<A> allocator_traits_type;
/// @endcond /// @endcond
public: public:
//! The type of object, T, stored in the vector //////////////////////////////////////////////
typedef T value_type; //
//! Pointer to T // types
typedef typename allocator_traits_type::pointer pointer; //
//! Const pointer to T //////////////////////////////////////////////
typedef typename allocator_traits_type::const_pointer const_pointer;
//! Reference to T
typedef typename allocator_traits_type::reference reference;
//! Const reference to T
typedef typename allocator_traits_type::const_reference const_reference;
//! An unsigned integral type
typedef typename allocator_traits_type::size_type size_type;
//! A signed integral type
typedef typename allocator_traits_type::difference_type difference_type;
//! The allocator type
typedef A allocator_type;
//! The random access iterator
typedef container_detail::vector_iterator<pointer> iterator;
//! The random access const_iterator
typedef container_detail::vector_const_iterator<pointer> const_iterator;
//! Iterator used to iterate backwards through a vector. typedef T value_type;
typedef std::reverse_iterator<iterator> typedef typename ::boost::container::allocator_traits<A>::pointer pointer;
reverse_iterator; typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
//! Const iterator used to iterate backwards through a vector. typedef typename ::boost::container::allocator_traits<A>::reference reference;
typedef std::reverse_iterator<const_iterator> typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
const_reverse_iterator; typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
//! The stored allocator type typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
typedef allocator_type stored_allocator_type; typedef A allocator_type;
typedef allocator_type stored_allocator_type;
typedef BOOST_CONTAINER_IMPDEF(container_detail::vector_iterator<pointer>) iterator;
typedef BOOST_CONTAINER_IMPDEF(container_detail::vector_const_iterator<pointer>) const_iterator;
typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<iterator>) reverse_iterator;
typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<const_iterator>) const_reverse_iterator;
/// @cond /// @cond
private: private:
@@ -459,6 +448,11 @@ class vector : private container_detail::vector_alloc_holder<A>
/// @endcond /// @endcond
public: public:
//////////////////////////////////////////////
//
// construct/copy/destroy
//
//////////////////////////////////////////////
//! <b>Effects</b>: Constructs a vector taking the allocator as parameter. //! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
//! //!
@@ -488,25 +482,7 @@ class vector : private container_detail::vector_alloc_holder<A>
//! <b>Complexity</b>: Linear to n. //! <b>Complexity</b>: Linear to n.
explicit vector(size_type n) explicit vector(size_type n)
: base_t() : base_t()
{ { this->resize(n); }
this->resize(n);
/*
//Allocate
size_type real_cap = 0;
std::pair<pointer, bool> ret =
this->allocation_command(allocate_new, n, n, real_cap, this->members_.m_start);
T *new_mem = container_detail::to_raw_pointer(ret.first);
//Anti-exception rollback
typename value_traits::ArrayDeallocator scoped_alloc(new_mem, this->alloc(), real_cap);
//Default constructor
container_detail::default_construct_aux_proxy<A, T*> proxy(this->alloc(), n);
proxy.uninitialized_copy_remaining_to(new_mem);
//All ok, commit
this->members_.m_start = ret.first;
this->members_.m_size = n;
this->members_.m_capacity = real_cap;
scoped_alloc.release();*/
}
//! <b>Effects</b>: Constructs a vector that will use a copy of allocator a //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
//! and inserts n copies of value. //! and inserts n copies of value.
@@ -517,10 +493,19 @@ class vector : private container_detail::vector_alloc_holder<A>
//! <b>Complexity</b>: Linear to n. //! <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) : base_t(a)
{ { this->resize(n, value); }
this->resize(n, value);
// this->insert(this->cend(), n, value); //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
} //! and inserts a copy of the range [first, last) in the vector.
//!
//! <b>Throws</b>: If allocator_type's default constructor or allocation
//! throws or T's constructor taking an dereferenced InIt throws.
//!
//! <b>Complexity</b>: Linear to the range [first, last).
template <class InIt>
vector(InIt first, InIt last, const allocator_type& a = allocator_type())
: base_t(a)
{ this->assign(first, last); }
//! <b>Effects</b>: Copy constructs a vector. //! <b>Effects</b>: Copy constructs a vector.
//! //!
@@ -580,18 +565,6 @@ class vector : private container_detail::vector_alloc_holder<A>
} }
} }
//! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
//! and inserts a copy of the range [first, last) in the vector.
//!
//! <b>Throws</b>: If allocator_type's default constructor or allocation
//! throws or T's constructor taking an dereferenced InIt throws.
//!
//! <b>Complexity</b>: Linear to the range [first, last).
template <class InIt>
vector(InIt first, InIt last, const allocator_type& a = allocator_type())
: base_t(a)
{ this->assign(first, last); }
//! <b>Effects</b>: Destroys the vector. All stored values are destroyed //! <b>Effects</b>: Destroys the vector. All stored values are destroyed
//! and used memory is deallocated. //! and used memory is deallocated.
//! //!
@@ -601,6 +574,141 @@ class vector : private container_detail::vector_alloc_holder<A>
~vector() BOOST_CONTAINER_NOEXCEPT ~vector() BOOST_CONTAINER_NOEXCEPT
{} //vector_alloc_holder clears the data {} //vector_alloc_holder clears the data
//! <b>Effects</b>: Makes *this contain the same elements as x.
//!
//! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
//! of each of x's elements.
//!
//! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment throws.
//!
//! <b>Complexity</b>: Linear to the number of elements in x.
vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x)
{
if (&x != this){
allocator_type &this_alloc = this->alloc();
const allocator_type &x_alloc = x.alloc();
container_detail::bool_<allocator_traits_type::
propagate_on_container_copy_assignment::value> flag;
if(flag && this_alloc != x_alloc){
this->clear();
this->shrink_to_fit();
}
container_detail::assign_alloc(this_alloc, x_alloc, flag);
this->assign( container_detail::to_raw_pointer(x.members_.m_start)
, container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
}
return *this;
}
//! <b>Effects</b>: Move assignment. All mx's values are transferred to *this.
//!
//! <b>Postcondition</b>: x.empty(). *this contains a the elements x had
//! before the function.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear.
vector& operator=(BOOST_RV_REF(vector) x)
//iG BOOST_CONTAINER_NOEXCEPT_IF(!allocator_type::propagate_on_container_move_assignment::value || is_nothrow_move_assignable<allocator_type>::value);)
BOOST_CONTAINER_NOEXCEPT
{
if (&x != this){
allocator_type &this_alloc = this->alloc();
allocator_type &x_alloc = x.alloc();
//If allocators are equal we can just swap pointers
if(this_alloc == x_alloc){
//Destroy objects but retain memory in case x reuses it in the future
this->clear();
this->swap_members(x);
//Move allocator if needed
container_detail::bool_<allocator_traits_type::
propagate_on_container_move_assignment::value> flag;
container_detail::move_alloc(this_alloc, x_alloc, flag);
}
//If unequal allocators, then do a one by one move
else{
this->assign( boost::make_move_iterator(container_detail::to_raw_pointer(x.members_.m_start))
, boost::make_move_iterator(container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size)));
}
}
return *this;
}
//! <b>Effects</b>: Assigns the the range [first, last) to *this.
//!
//! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment or
//! T's constructor/assignment from dereferencing InpIt throws.
//!
//! <b>Complexity</b>: Linear to n.
template <class InIt>
void assign(InIt first, InIt last
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename container_detail::enable_if_c
< !container_detail::is_convertible<InIt, size_type>::value
//&& container_detail::is_input_iterator<InIt>::value
>::type * = 0
#endif
)
{
//Overwrite all elements we can from [first, last)
iterator cur = this->begin();
for ( ; first != last && cur != end(); ++cur, ++first){
*cur = *first;
}
if (first == last){
//There are no more elements in the sequence, erase remaining
this->erase(cur, this->cend());
}
else{
//There are more elements in the range, insert the remaining ones
this->insert(this->cend(), first, last);
}
}
//! <b>Effects</b>: Assigns the n copies of val to *this.
//!
//! <b>Throws</b>: If memory allocation throws or
//! T's copy/move constructor/assignment throws.
//!
//! <b>Complexity</b>: Linear to n.
void assign(size_type n, const value_type& val)
{ this->assign(cvalue_iterator(val, n), cvalue_iterator()); }
//! <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(); }
//////////////////////////////////////////////
//
// iterators
//
//////////////////////////////////////////////
//! <b>Effects</b>: Returns an iterator to the first element contained in the vector. //! <b>Effects</b>: Returns an iterator to the first element contained in the vector.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
@@ -703,67 +811,19 @@ class vector : private container_detail::vector_alloc_holder<A>
const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
{ return const_reverse_iterator(this->begin()); } { return const_reverse_iterator(this->begin()); }
//! <b>Requires</b>: !empty() //////////////////////////////////////////////
//! //
//! <b>Effects</b>: Returns a reference to the first // capacity
//! 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 true if the vector contains no elements.
//!
//! <b>Effects</b>: Returns a const reference to the first
//! element of the container.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Constant.
const_reference front() const BOOST_CONTAINER_NOEXCEPT bool empty() const BOOST_CONTAINER_NOEXCEPT
{ return *this->members_.m_start; } { return !this->members_.m_size; }
//! <b>Requires</b>: !empty()
//!
//! <b>Effects</b>: Returns a reference to the last
//! element of the container.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reference back() BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_start[this->members_.m_size - 1]; }
//! <b>Requires</b>: !empty()
//!
//! <b>Effects</b>: Returns a const reference to the last
//! element of the container.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reference back() const 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>Effects</b>: Returns the number of the elements contained in the vector.
//! //!
@@ -781,6 +841,45 @@ class vector : private container_detail::vector_alloc_holder<A>
size_type max_size() const BOOST_CONTAINER_NOEXCEPT size_type max_size() const BOOST_CONTAINER_NOEXCEPT
{ return allocator_traits_type::max_size(this->alloc()); } { return allocator_traits_type::max_size(this->alloc()); }
//! <b>Effects</b>: Inserts or erases elements at the end such that
//! the size becomes n. New elements are default constructed.
//!
//! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to the difference between size() and new_size.
void resize(size_type new_size)
{
if (new_size < this->size()){
//Destroy last elements
this->erase(const_iterator(this->members_.m_start + new_size), this->end());
}
else{
const size_type n = new_size - this->size();
this->reserve(new_size);
container_detail::default_construct_aux_proxy<A, T*> proxy(this->alloc(), n);
this->priv_forward_range_insert(this->cend().get_ptr(), n, proxy);
}
}
//! <b>Effects</b>: Inserts or erases elements at the end such that
//! the size becomes n. New elements are copy constructed from x.
//!
//! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to the difference between size() and new_size.
void resize(size_type new_size, const T& x)
{
pointer finish = this->members_.m_start + this->members_.m_size;
if (new_size < size()){
//Destroy last elements
this->erase(const_iterator(this->members_.m_start + new_size), this->end());
}
else{
//Insert new elements at the end
this->insert(const_iterator(finish), new_size - this->size(), x);
}
}
//! <b>Effects</b>: Number of elements for which memory has been allocated. //! <b>Effects</b>: Number of elements for which memory has been allocated.
//! capacity() is always greater than or equal to size(). //! capacity() is always greater than or equal to size().
//! //!
@@ -790,86 +889,6 @@ class vector : private container_detail::vector_alloc_holder<A>
size_type capacity() const BOOST_CONTAINER_NOEXCEPT size_type capacity() const BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_capacity; } { 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
//! from the beginning of the container.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
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
//! 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
//! 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_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
//! 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(); }
//! <b>Effects</b>: If n is less than or equal to capacity(), this call has no //! <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. //! effect. Otherwise, it is a request for allocation of additional memory.
//! If the request is successful, then capacity() is greater than or equal to //! If the request is successful, then capacity() is greater than or equal to
@@ -931,251 +950,138 @@ class vector : private container_detail::vector_alloc_holder<A>
} }
} }
//! <b>Effects</b>: Makes *this contain the same elements as x. //! <b>Effects</b>: Tries to deallocate the excess of memory created
//! with previous allocations. The size of the vector is unchanged
//! //!
//! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy //! <b>Throws</b>: If memory allocation throws, or T's copy/move constructor throws.
//! of each of x's elements.
//! //!
//! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment throws. //! <b>Complexity</b>: Linear to size().
void shrink_to_fit()
{ priv_shrink_to_fit(alloc_version()); }
//////////////////////////////////////////////
//
// element access
//
//////////////////////////////////////////////
//! <b>Requires</b>: !empty()
//! //!
//! <b>Complexity</b>: Linear to the number of elements in x. //! <b>Effects</b>: Returns a reference to the first
vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x) //! element of the container.
{
if (&x != this){
allocator_type &this_alloc = this->alloc();
const allocator_type &x_alloc = x.alloc();
container_detail::bool_<allocator_traits_type::
propagate_on_container_copy_assignment::value> flag;
if(flag && this_alloc != x_alloc){
this->clear();
this->shrink_to_fit();
}
container_detail::assign_alloc(this_alloc, x_alloc, flag);
this->assign( container_detail::to_raw_pointer(x.members_.m_start)
, container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size));
}
return *this;
}
//! <b>Effects</b>: Move assignment. All mx's values are transferred to *this.
//! //!
//! <b>Postcondition</b>: x.empty(). *this contains a the elements x had //! <b>Throws</b>: Nothing.
//! before the function.
//! //!
//! <b>Throws</b>: Nothing //! <b>Complexity</b>: Constant.
reference front() BOOST_CONTAINER_NOEXCEPT
{ return *this->members_.m_start; }
//! <b>Requires</b>: !empty()
//! //!
//! <b>Complexity</b>: Linear. //! <b>Effects</b>: Returns a const reference to the first
vector& operator=(BOOST_RV_REF(vector) x) //! element of the container.
//iG BOOST_CONTAINER_NOEXCEPT_IF(!allocator_type::propagate_on_container_move_assignment::value || is_nothrow_move_assignable<allocator_type>::value);)
BOOST_CONTAINER_NOEXCEPT
{
if (&x != this){
allocator_type &this_alloc = this->alloc();
allocator_type &x_alloc = x.alloc();
//If allocators are equal we can just swap pointers
if(this_alloc == x_alloc){
//Destroy objects but retain memory in case x reuses it in the future
this->clear();
this->swap_members(x);
//Move allocator if needed
container_detail::bool_<allocator_traits_type::
propagate_on_container_move_assignment::value> flag;
container_detail::move_alloc(this_alloc, x_alloc, flag);
}
//If unequal allocators, then do a one by one move
else{
this->assign( boost::make_move_iterator(container_detail::to_raw_pointer(x.members_.m_start))
, boost::make_move_iterator(container_detail::to_raw_pointer(x.members_.m_start + x.members_.m_size)));
}
}
return *this;
}
//! <b>Effects</b>: Assigns the n copies of val to *this.
//! //!
//! <b>Throws</b>: If memory allocation throws or //! <b>Throws</b>: Nothing.
//! T's copy/move constructor/assignment throws.
//! //!
//! <b>Complexity</b>: Linear to n. //! <b>Complexity</b>: Constant.
void assign(size_type n, const value_type& val) const_reference front() const BOOST_CONTAINER_NOEXCEPT
{ this->assign(cvalue_iterator(val, n), cvalue_iterator()); } { return *this->members_.m_start; }
//! <b>Effects</b>: Assigns the the range [first, last) to *this. //! <b>Requires</b>: !empty()
//! //!
//! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment or //! <b>Effects</b>: Returns a reference to the last
//! T's constructor/assignment from dereferencing InpIt throws. //! element of the container.
//! //!
//! <b>Complexity</b>: Linear to n. //! <b>Throws</b>: Nothing.
template <class InIt>
void assign(InIt first, InIt last
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename container_detail::enable_if_c
< !container_detail::is_convertible<InIt, size_type>::value
&& container_detail::is_input_iterator<InIt>::value
>::type * = 0
#endif
)
{
//Overwrite all elements we can from [first, last)
iterator cur = begin();
for ( ; first != last && cur != end(); ++cur, ++first){
*cur = *first;
}
if (first == last){
//There are no more elements in the sequence, erase remaining
this->erase(cur, cend());
}
else{
//There are more elements in the range, insert the remaining ones
this->insert(this->cend(), first, last);
}
}
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template <class FwdIt>
void assign(FwdIt first, FwdIt last
, typename container_detail::enable_if_c
< !container_detail::is_convertible<FwdIt, size_type>::value
&& !container_detail::is_input_iterator<FwdIt>::value
>::type * = 0
)
{
const size_type n = std::distance(first, last);
if(!n){
this->prot_destroy_all();
return;
}
//Check if we have enough memory or try to expand current memory
size_type remaining = this->members_.m_capacity - this->members_.m_size;
bool same_buffer_start;
std::pair<pointer, bool> ret;
size_type real_cap = this->members_.m_capacity;
if (n <= remaining){
same_buffer_start = true;
}
else{
//There is not enough memory, allocate a new buffer
size_type new_cap = this->next_capacity(n);
ret = this->allocation_command
(allocate_new | expand_fwd | expand_bwd,
this->size() + n, new_cap, real_cap, this->members_.m_start);
same_buffer_start = ret.second && this->members_.m_start == ret.first;
if(same_buffer_start){
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){
//There is memory, but there are more old elements than new ones
//Overwrite old elements with new ones
std::copy(first, last, start);
//Destroy remaining old elements
this->destroy_n(start + n, this->members_.m_size - n);
this->members_.m_size = n;
}
else{
//There is memory, but there are less old elements than new ones
//First overwrite some old elements with new ones
FwdIt mid = first;
std::advance(mid, this->size());
T *end = std::copy(first, mid, start);
//Initialize the remaining new elements in the uninitialized memory
::boost::container::uninitialized_copy_or_move_alloc(this->alloc(), mid, last, end);
this->members_.m_size = n;
}
}
else if(!ret.second){
typename value_traits::ArrayDeallocator scoped_alloc(ret.first, this->alloc(), real_cap);
::boost::container::uninitialized_copy_or_move_alloc(this->alloc(), first, last, container_detail::to_raw_pointer(ret.first));
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->alloc().deallocate(this->members_.m_start, this->members_.m_capacity);
}
this->members_.m_start = ret.first;
this->members_.m_size = n;
this->members_.m_capacity = real_cap;
}
else{
//Backwards expansion
//If anything goes wrong, this object will destroy old objects
T *old_start = container_detail::to_raw_pointer(this->members_.m_start);
size_type old_size = this->members_.m_size;
typename value_traits::OldArrayDestructor old_values_destroyer(old_start, this->alloc(), old_size);
//If something goes wrong size will be 0
//but holding the whole buffer
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);
FwdIt mid = first;
std::advance(mid, first_count);
::boost::container::uninitialized_copy_or_move_alloc
(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"
this->members_.m_size = n;
}
else{
//We have constructed objects from the new begin until
//the old end so release the rollback destruction
old_values_destroyer.release();
this->members_.m_start = ret.first;
this->members_.m_size = first_count + old_size;
//Now overwrite the old values
size_type second_count = container_detail::min_value(old_size, n - first_count);
FwdIt mid2 = mid;
std::advance(mid2, second_count);
std::copy(mid, mid2, old_start);
//Check if we still have to append elements in the
//uninitialized end
if(second_count == old_size){
std::copy(mid2, last, old_start + old_size);
}
else{
//We have to destroy some old values
this->destroy_n
(old_start + second_count, old_size - second_count);
this->members_.m_size = n;
}
this->members_.m_size = n;
}
}
}
#endif
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts a copy of x at the end of the vector.
//! //!
//! <b>Throws</b>: If memory allocation throws or //! <b>Complexity</b>: Constant.
//! T's copy/move constructor throws. reference back() BOOST_CONTAINER_NOEXCEPT
//! { return this->members_.m_start[this->members_.m_size - 1]; }
//! <b>Complexity</b>: Amortized constant time.
void push_back(const T &x);
//! <b>Effects</b>: Constructs a new element in the end of the vector //! <b>Requires</b>: !empty()
//! and moves the resources of mx to this new element.
//! //!
//! <b>Throws</b>: If memory allocation throws or //! <b>Effects</b>: Returns a const reference to the last
//! T's move constructor throws. //! element of the container.
//! //!
//! <b>Complexity</b>: Amortized constant time. //! <b>Throws</b>: Nothing.
void push_back(T &&x); //!
#else //! <b>Complexity</b>: Constant.
BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back) const_reference back() const BOOST_CONTAINER_NOEXCEPT
#endif { return this->members_.m_start[this->members_.m_size - 1]; }
//! <b>Requires</b>: size() > n.
//!
//! <b>Effects</b>: Returns a reference to the nth element
//! from the beginning of the container.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reference operator[](size_type n)
{ return this->members_.m_start[n]; }
//! <b>Requires</b>: size() > n.
//!
//! <b>Effects</b>: Returns a const reference to the nth element
//! from the beginning of the container.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
{ return this->members_.m_start[n]; }
//! <b>Requires</b>: size() > n.
//!
//! <b>Effects</b>: Returns a reference to the nth element
//! from the beginning of the container.
//!
//! <b>Throws</b>: std::range_error if n >= size()
//!
//! <b>Complexity</b>: Constant.
reference at(size_type n)
{ this->priv_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
//! 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]; }
//////////////////////////////////////////////
//
// data access
//
//////////////////////////////////////////////
//! <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.
T* data() BOOST_CONTAINER_NOEXCEPT
{ return container_detail::to_raw_pointer(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 T * data() const BOOST_CONTAINER_NOEXCEPT
{ return container_detail::to_raw_pointer(this->members_.m_start); }
//////////////////////////////////////////////
//
// modifiers
//
//////////////////////////////////////////////
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type T constructed with //! <b>Effects</b>: Inserts an object of type T constructed with
@@ -1260,19 +1166,26 @@ class vector : private container_detail::vector_alloc_holder<A>
#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
//! <b>Effects</b>: Swaps the contents of *this and x. #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts a copy of x at the end of the vector.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: If memory allocation throws or
//! T's copy/move constructor throws.
//! //!
//! <b>Complexity</b>: Constant. //! <b>Complexity</b>: Amortized constant time.
void swap(vector& x) void push_back(const T &x);
{
//Just swap internals //! <b>Effects</b>: Constructs a new element in the end of the vector
this->swap_members(x); //! and moves the resources of mx to this new element.
//And now the allocator //!
container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag; //! <b>Throws</b>: If memory allocation throws or
container_detail::swap_alloc(this->alloc(), x.alloc(), flag); //! T's move constructor throws.
} //!
//! <b>Complexity</b>: Amortized constant time.
void push_back(T &&x);
#else
BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
#endif
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Requires</b>: position must be a valid iterator of *this. //! <b>Requires</b>: position must be a valid iterator of *this.
@@ -1298,6 +1211,18 @@ class vector : private container_detail::vector_alloc_holder<A>
BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator) BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator)
#endif #endif
//! <b>Requires</b>: p must be a valid iterator of *this.
//!
//! <b>Effects</b>: Insert n copies of x before pos.
//!
//! <b>Returns</b>: an iterator to the first inserted element or p if n is 0.
//!
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to n.
iterator insert(const_iterator p, size_type n, const T& x)
{ return this->insert(p, cvalue_iterator(x, n), cvalue_iterator()); }
//! <b>Requires</b>: p must be a valid iterator of *this. //! <b>Requires</b>: p must be a valid iterator of *this.
//! //!
//! <b>Effects</b>: Insert a copy of the [first, last) range before pos. //! <b>Effects</b>: Insert a copy of the [first, last) range before pos.
@@ -1344,18 +1269,6 @@ class vector : private container_detail::vector_alloc_holder<A>
} }
#endif #endif
//! <b>Requires</b>: p must be a valid iterator of *this.
//!
//! <b>Effects</b>: Insert n copies of x before pos.
//!
//! <b>Returns</b>: an iterator to the first inserted element or p if n is 0.
//!
//! <b>Throws</b>: If memory allocation throws or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to n.
iterator insert(const_iterator p, size_type n, const T& x)
{ return this->insert(p, cvalue_iterator(x, n), cvalue_iterator()); }
//! <b>Effects</b>: Removes the last element from the vector. //! <b>Effects</b>: Removes the last element from the vector.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
@@ -1407,43 +1320,18 @@ class vector : private container_detail::vector_alloc_holder<A>
return iterator(first.get_ptr()); return iterator(first.get_ptr());
} }
//! <b>Effects</b>: Inserts or erases elements at the end such that //! <b>Effects</b>: Swaps the contents of *this and x.
//! the size becomes n. New elements are copy constructed from x.
//! //!
//! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws. //! <b>Throws</b>: Nothing.
//! //!
//! <b>Complexity</b>: Linear to the difference between size() and new_size. //! <b>Complexity</b>: Constant.
void resize(size_type new_size, const T& x) void swap(vector& x)
{ {
pointer finish = this->members_.m_start + this->members_.m_size; //Just swap internals
if (new_size < size()){ this->swap_members(x);
//Destroy last elements //And now the allocator
this->erase(const_iterator(this->members_.m_start + new_size), this->end()); container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag;
} container_detail::swap_alloc(this->alloc(), x.alloc(), flag);
else{
//Insert new elements at the end
this->insert(const_iterator(finish), new_size - this->size(), x);
}
}
//! <b>Effects</b>: Inserts or erases elements at the end such that
//! the size becomes n. New elements are default constructed.
//!
//! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to the difference between size() and new_size.
void resize(size_type new_size)
{
if (new_size < this->size()){
//Destroy last elements
this->erase(const_iterator(this->members_.m_start + new_size), this->end());
}
else{
const size_type n = new_size - this->size();
this->reserve(new_size);
container_detail::default_construct_aux_proxy<A, T*> proxy(this->alloc(), n);
this->priv_forward_range_insert(this->cend().get_ptr(), n, proxy);
}
} }
//! <b>Effects</b>: Erases all the elements of the vector. //! <b>Effects</b>: Erases all the elements of the vector.
@@ -1454,15 +1342,6 @@ class vector : private container_detail::vector_alloc_holder<A>
void clear() BOOST_CONTAINER_NOEXCEPT void clear() BOOST_CONTAINER_NOEXCEPT
{ this->prot_destroy_all(); } { this->prot_destroy_all(); }
//! <b>Effects</b>: Tries to deallocate the excess of memory created
//! with previous allocations. The size of the vector is unchanged
//!
//! <b>Throws</b>: If memory allocation throws, or T's copy/move constructor throws.
//!
//! <b>Complexity</b>: Linear to size().
void shrink_to_fit()
{ priv_shrink_to_fit(alloc_version()); }
/// @cond /// @cond
//Absolutely experimental. This function might change, disappear or simply crash! //Absolutely experimental. This function might change, disappear or simply crash!

View File

@@ -52,3 +52,110 @@ change virtual functions with pointers to avoid template instantiation for every
Add hash for containers Add hash for containers
Add std:: hashing support Add std:: hashing support
Take out from class definition iterators in slist & list
Fix trivial destructor after move and other optimizing traits
Define typedefs exactly like the standard to generate better documentation. for implementation defined types:
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
#define BOOST_CONTAINER_IMPLDEF(TYPE) TYPE
#else
#define BOOST_CONTAINER_IMPLDEF(TYPE) implementation_defined
#endif
Mark previous() in slist/and forward_list as non-standard
Replace all insert_const_ref_type with BOOST_MOVE_CONVERSION_AWARE_CATCH_XXX
Function order:
----------type------------
value_type;
pointer;
const_pointer;
reference;
const_reference;
size_type;
difference_type;
allocator_type;
stored_allocator_type;
iterator;
const_iterator;
reverse_iterator;
const_reverse_iterator;
----------func------------
container()
container(allocator_type)
container(size_type)
container(size_type, value_type, allocator_type = ())
container(InpIt, InpIt)
container(const container &)
container(container &&)
container(const container &, allocator_type)
container(container &&, allocator_type)
container(initializer_list<T>, allocator)
~container()
container operator=(const container &)
container operator=(container &&)
container operator=(initializer_list<T>)
assign(size_type, const T &)
assign(InpIt, InptIt)
assign(initializer_list)
get_allocator()
begin()
begin() const
end()
end() const
rbegin()
rbegin() const
rend()
rend() const
cbegin() const
cend() const
crbegin() const
crend() const
empty()
size()
max_size()
resize(size_type)
resize(size_type, cont T&)
capacity()
reserve(size_type)
shrink_to_fit()
front()
front() const
back()
back() const
operator[] ()
operator[] ()const
at()
at() const
data()
data() const
emplace_front()
emplace_back()
emplace()
push_front(const T&)
push_front(T&&)
push_back(const T&)
push_back(T&&)
insert(iterator, const T &)
insert(iterator, T &&)
insert(size_type, const T &)
insert(InpIt, InpIt)
pop_front()
pop_back()
erase(const_iterator)
erase(const_iterator, const_iterator)
swap(container &)
clear()