STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Protected Member Functions | List of all members
vector< _Ty, _Alloc > Class Template Reference
Inheritance diagram for vector< _Ty, _Alloc >:
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > >

Public Types

typedef vector< _Ty, _Alloc_Myt
 
typedef _Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
 
typedef _Alloc allocator_type
 
typedef _Mybase::_Alty _Alty
 
typedef _Mybase::value_type value_type
 
typedef _Mybase::size_type size_type
 
typedef _Mybase::difference_type difference_type
 
typedef _Mybase::pointer pointer
 
typedef _Mybase::const_pointer const_pointer
 
typedef _Mybase::reference reference
 
typedef _Mybase::const_reference const_reference
 
typedef _Mybase::iterator iterator
 
typedef _Mybase::const_iterator const_iterator
 
typedef _STD reverse_iterator< iteratorreverse_iterator
 
typedef _STD reverse_iterator< const_iteratorconst_reverse_iterator
 
- Public Types inherited from _Vector_alloc< _Vec_base_types< _Ty, _Alloc > >
typedef _Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Myt
 
typedef _Vec_base_types< _Ty, _Alloc >::_Alloc _Alloc
 
typedef _Vec_base_types< _Ty, _Alloc >::_Alty _Alty
 
typedef _Vec_base_types< _Ty, _Alloc >::_Val_types _Val_types
 
typedef _Val_types::value_type value_type
 
typedef _Val_types::size_type size_type
 
typedef _Val_types::difference_type difference_type
 
typedef _Val_types::pointer pointer
 
typedef _Val_types::const_pointer const_pointer
 
typedef _Val_types::reference reference
 
typedef _Val_types::const_reference const_reference
 
typedef _Vector_iterator< _Vector_val< _Val_types > > iterator
 
typedef _Vector_const_iterator< _Vector_val< _Val_types > > const_iterator
 

Public Member Functions

 vector () _NOEXCEPT_OP(is_nothrow_default_constructible< _Alloc >
 
 vector (const _Alloc &_Al) _NOEXCEPT
 
 vector (size_type _Count)
 
 vector (size_type _Count, const value_type &_Val)
 
 vector (size_type _Count, const value_type &_Val, const _Alloc &_Al)
 
 vector (const _Myt &_Right)
 
 vector (const _Myt &_Right, const _Alloc &_Al)
 
template<class _Iter , class = typename enable_if<_Is_iterator<_Iter>::value, void>::type>
 vector (_Iter _First, _Iter _Last)
 
template<class _Iter , class = typename enable_if<_Is_iterator<_Iter>::value, void>::type>
 vector (_Iter _First, _Iter _Last, const _Alloc &_Al)
 
template<class _Iter >
void _Construct (_Iter _First, _Iter _Last)
 
template<class _Iter >
void _Construct (_Iter _First, _Iter _Last, input_iterator_tag)
 
template<class _Iter >
void _Construct (_Iter _First, _Iter _Last, forward_iterator_tag)
 
void _Construct_n (size_type _Count, const value_type *_Pval)
 
 vector (_Myt &&_Right) _NOEXCEPT
 
 vector (_Myt &&_Right, const _Alloc &_Al)
 
_Mytoperator= (_Myt &&_Right) _NOEXCEPT_OP(_Alty
 
void _Assign_rv (_Myt &&_Right, true_type)
 
void _Assign_rv (_Myt &&_Right, false_type)
 
void _Assign_rv (_Myt &&_Right)
 
void push_back (value_type &&_Val)
 
iterator insert (const_iterator _Where, _Ty &&_Val)
 
template<class... _Valty>
void emplace_back (_Valty &&..._Val)
 
template<class... _Valty>
iterator emplace (const_iterator _Where, _Valty &&..._Val)
 
 vector (_XSTD initializer_list< value_type > _Ilist, const _Alloc &_Al=allocator_type())
 
_Mytoperator= (_XSTD initializer_list< value_type > _Ilist)
 
void assign (_XSTD initializer_list< value_type > _Ilist)
 
iterator insert (const_iterator _Where, _XSTD initializer_list< value_type > _Ilist)
 
 ~vector () _NOEXCEPT
 
_Mytoperator= (const _Myt &_Right)
 
void reserve (size_type _Count)
 
size_type capacity () const _NOEXCEPT
 
size_type _Unused_capacity () const _NOEXCEPT
 
size_type _Has_unused_capacity () const _NOEXCEPT
 
iterator begin () _NOEXCEPT
 
const_iterator begin () const _NOEXCEPT
 
iterator end () _NOEXCEPT
 
const_iterator end () const _NOEXCEPT
 
iterator _Make_iter (const_iterator _Where) const
 
reverse_iterator rbegin () _NOEXCEPT
 
const_reverse_iterator rbegin () const _NOEXCEPT
 
reverse_iterator rend () _NOEXCEPT
 
const_reverse_iterator rend () const _NOEXCEPT
 
const_iterator cbegin () const _NOEXCEPT
 
const_iterator cend () const _NOEXCEPT
 
const_reverse_iterator crbegin () const _NOEXCEPT
 
const_reverse_iterator crend () const _NOEXCEPT
 
void shrink_to_fit ()
 
void resize (size_type _Newsize)
 
void resize (size_type _Newsize, const value_type &_Val)
 
size_type size () const _NOEXCEPT
 
size_type max_size () const _NOEXCEPT
 
bool empty () const _NOEXCEPT
 
_Alloc get_allocator () const _NOEXCEPT
 
const_reference at (size_type _Pos) const
 
reference at (size_type _Pos)
 
const_reference operator[] (size_type _Pos) const
 
reference operator[] (size_type _Pos)
 
_Ty * data () _NOEXCEPT
 
const _Ty * data () const _NOEXCEPT
 
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
void push_back (const value_type &_Val)
 
void pop_back ()
 
template<class _Iter >
enable_if< _Is_iterator< _Iter >::value, void >::type assign (_Iter _First, _Iter _Last)
 
template<class _Iter >
void _Assign (_Iter _First, _Iter _Last, input_iterator_tag)
 
template<class _Iter >
void _Assign (_Iter _First, _Iter _Last, forward_iterator_tag)
 
void assign (size_type _Count, const value_type &_Val)
 
iterator insert (const_iterator _Where, const _Ty &_Val)
 
iterator insert (const_iterator _Where, size_type _Count, const _Ty &_Val)
 
template<class _Iter >
enable_if< _Is_iterator< _Iter >::value, iterator >::type insert (const_iterator _Where, _Iter _First, _Iter _Last)
 
template<class _Iter >
void _Insert (const_iterator _Where, _Iter _First, _Iter _Last, input_iterator_tag)
 
template<class _Iter >
void _Insert (const_iterator _Where, _Iter _First, _Iter _Last, forward_iterator_tag)
 
iterator erase (const_iterator _Where)
 
iterator erase (const_iterator _First_arg, const_iterator _Last_arg)
 
void _Pop_back_n (size_type _Count)
 
void clear () _NOEXCEPT
 
void swap (_Myt &_Right) _NOEXCEPT_OP(_Alty
 
- Public Member Functions inherited from _Vector_alloc< _Vec_base_types< _Ty, _Alloc > >
 _Vector_alloc ()
 
 _Vector_alloc (_Any_alloc &&_Al)
 
void _Copy_alloc (const _Alty &_Al)
 
void _Move_alloc (_Alty &_Al)
 
void _Orphan_all ()
 
void _Swap_all (_Myt &_Right)
 
_Alty_Getal () _NOEXCEPT
 
const _Alty_Getal () const _NOEXCEPT
 
_Vector_val< _Val_types > & _Get_data () _NOEXCEPT
 
const _Vector_val< _Val_types > & _Get_data () const _NOEXCEPT
 
pointer_Myfirst () _NOEXCEPT
 
const pointer_Myfirst () const _NOEXCEPT
 
pointer_Mylast () _NOEXCEPT
 
const pointer_Mylast () const _NOEXCEPT
 
pointer_Myend () _NOEXCEPT
 
const pointer_Myend () const _NOEXCEPT
 

Protected Member Functions

bool _Buy (size_type _Capacity)
 
void _Destroy (pointer _First, pointer _Last)
 
size_type _Grow_to (size_type _Count) const
 
bool _Inside (const value_type *_Ptr) const
 
void _Reallocate (size_type _Count)
 
void _Reserve (size_type _Count)
 
void _Tidy ()
 
template<class _Iter >
pointer _Ucopy (_Iter _First, _Iter _Last, pointer _Ptr)
 
template<class _Iter >
pointer _Umove (_Iter _First, _Iter _Last, pointer _Ptr)
 
iterator _Insert_n (const_iterator _Where, size_type _Count, const value_type &_Val)
 
pointer _Ufill (pointer _Ptr, size_type _Count, const value_type *_Pval)
 
void _Xlen () const
 
void _Xran () const
 
void _Orphan_range (pointer, pointer) const
 

Member Typedef Documentation

template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Mybase::_Alty vector< _Ty, _Alloc >::_Alty
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Vector_alloc<_Vec_base_types<_Ty, _Alloc> > vector< _Ty, _Alloc >::_Mybase
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef vector<_Ty, _Alloc> vector< _Ty, _Alloc >::_Myt
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Alloc vector< _Ty, _Alloc >::allocator_type
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Mybase::const_iterator vector< _Ty, _Alloc >::const_iterator
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Mybase::const_pointer vector< _Ty, _Alloc >::const_pointer
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Mybase::const_reference vector< _Ty, _Alloc >::const_reference
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _STD reverse_iterator<const_iterator> vector< _Ty, _Alloc >::const_reverse_iterator
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Mybase::difference_type vector< _Ty, _Alloc >::difference_type
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Mybase::iterator vector< _Ty, _Alloc >::iterator
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Mybase::pointer vector< _Ty, _Alloc >::pointer
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Mybase::reference vector< _Ty, _Alloc >::reference
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _STD reverse_iterator<iterator> vector< _Ty, _Alloc >::reverse_iterator
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Mybase::size_type vector< _Ty, _Alloc >::size_type
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Mybase::value_type vector< _Ty, _Alloc >::value_type

Constructor & Destructor Documentation

template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( )
inline
706  : _Mybase()
707  { // construct empty vector
708  }
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:683
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( const _Alloc _Al)
inlineexplicit
711  : _Mybase(_Al)
712  { // construct empty vector, allocator
713  }
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:683
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( size_type  _Count)
inlineexplicit
716  : _Mybase()
717  { // construct from _Count * value_type()
718  if (_Buy(_Count))
719  { // nonzero, fill it
720  _TRY_BEGIN
722  this->_Getal());
723  this->_Mylast() += _Count;
724  _CATCH_ALL
725  _Tidy();
726  _RERAISE;
727  _CATCH_END
728  }
729  }
unsigned int _Count
Definition: xcomplex:668
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
bool _Buy(size_type _Capacity)
Definition: vector:1560
#define _CATCH_ALL
Definition: xstddef:62
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Uninitialized_default_fill_n(_FwdIt _First, _Diff _Count, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory:477
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:683
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
#define _RERAISE
Definition: xstddef:74
void _Tidy()
Definition: vector:1635
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( size_type  _Count,
const value_type _Val 
)
inline
732  : _Mybase()
733  { // construct from _Count * _Val
735  }
unsigned int _Count
Definition: xcomplex:668
constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:723
_In_ int _Val
Definition: vcruntime_string.h:62
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:683
void _Construct_n(size_type _Count, const value_type *_Pval)
Definition: vector:826
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( size_type  _Count,
const value_type _Val,
const _Alloc _Al 
)
inline
738  : _Mybase(_Al)
739  { // construct from _Count * _Val, allocator
741  }
unsigned int _Count
Definition: xcomplex:668
constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:723
_In_ int _Val
Definition: vcruntime_string.h:62
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:683
void _Construct_n(size_type _Count, const value_type *_Pval)
Definition: vector:826
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( const _Myt _Right)
inline
745  : _Mybase(_Right._Getal().select_on_container_copy_construction())
746 
747 
748  { // construct by copying _Right
749  if (_Buy(_Right.size()))
750  _TRY_BEGIN
751  this->_Mylast() = _Ucopy(_Right.begin(), _Right.end(),
752  this->_Myfirst());
753  _CATCH_ALL
754  _Tidy();
755  _RERAISE;
756  _CATCH_END
757  }
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
bool _Buy(size_type _Capacity)
Definition: vector:1560
#define _CATCH_ALL
Definition: xstddef:62
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:683
#define _RERAISE
Definition: xstddef:74
void _Tidy()
Definition: vector:1635
pointer _Ucopy(_Iter _First, _Iter _Last, pointer _Ptr)
Definition: vector:1650
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( const _Myt _Right,
const _Alloc _Al 
)
inline
760  : _Mybase(_Al)
761  { // construct by copying _Right, allocator
762  if (_Buy(_Right.size()))
763  _TRY_BEGIN
764  this->_Mylast() = _Ucopy(_Right.begin(), _Right.end(),
765  this->_Myfirst());
766  _CATCH_ALL
767  _Tidy();
768  _RERAISE;
769  _CATCH_END
770  }
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
bool _Buy(size_type _Capacity)
Definition: vector:1560
#define _CATCH_ALL
Definition: xstddef:62
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:683
#define _RERAISE
Definition: xstddef:74
void _Tidy()
Definition: vector:1635
pointer _Ucopy(_Iter _First, _Iter _Last, pointer _Ptr)
Definition: vector:1650
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter , class = typename enable_if<_Is_iterator<_Iter>::value, void>::type>
vector< _Ty, _Alloc >::vector ( _Iter  _First,
_Iter  _Last 
)
inline
776  : _Mybase()
777  { // construct from [_First, _Last)
778  _Construct(_First, _Last);
779  }
void _Construct(_Iter _First, _Iter _Last)
Definition: vector:791
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:683
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter , class = typename enable_if<_Is_iterator<_Iter>::value, void>::type>
vector< _Ty, _Alloc >::vector ( _Iter  _First,
_Iter  _Last,
const _Alloc _Al 
)
inline
785  : _Mybase(_Al)
786  { // construct from [_First, _Last) with allocator
787  _Construct(_First, _Last);
788  }
void _Construct(_Iter _First, _Iter _Last)
Definition: vector:791
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:683
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( _Myt &&  _Right)
inline
840  : _Mybase(_STD move(_Right._Getal()))
841  { // construct by moving _Right
842  _Assign_rv(_STD forward<_Myt>(_Right), true_type());
843  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: vector:867
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:683
integral_constant< bool, true > true_type
Definition: xtr1common:40
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( _Myt &&  _Right,
const _Alloc _Al 
)
inline
846  : _Mybase(_Al)
847  { // construct by moving _Right, allocator
848  _Assign_rv(_STD forward<_Myt>(_Right));
849  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: vector:867
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:683
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( _XSTD initializer_list< value_type _Ilist,
const _Alloc _Al = allocator_type() 
)
inline
952  : _Mybase(_Al)
953  { // construct from initializer_list
954  _Construct(_Ilist.begin(), _Ilist.end());
955  }
void _Construct(_Iter _First, _Iter _Last)
Definition: vector:791
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:683
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::~vector ( )
inline
975  { // destroy the object
976  _Tidy();
977  }
void _Tidy()
Definition: vector:1635

Member Function Documentation

template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Assign ( _Iter  _First,
_Iter  _Last,
input_iterator_tag   
)
inline
1331  { // assign [_First, _Last), input iterators
1332  for (; _First != _Last; ++_First)
1333  emplace_back(*_First);
1334  }
void emplace_back(_Valty &&..._Val)
Definition: vector:924
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Assign ( _Iter  _First,
_Iter  _Last,
forward_iterator_tag   
)
inline
1339  { // assign [_First, _Last), forward iterators
1340  size_type _Newsize = _STD distance(_First, _Last);
1341 
1342  if (capacity() < _Newsize)
1343  { // need more room, try to get it
1344  size_type _Newcapacity = _Grow_to(_Newsize);
1345  _Tidy();
1346  _Buy(_Newcapacity);
1347  }
1348 
1349  this->_Mylast() = _Ucopy(_First, _Last, this->_Myfirst());
1350  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
size_type capacity() const _NOEXCEPT
Definition: vector:1041
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1124
bool _Buy(size_type _Capacity)
Definition: vector:1560
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
_Mybase::size_type size_type
Definition: vector:689
size_type _Grow_to(size_type _Count) const
Definition: vector:1584
void _Tidy()
Definition: vector:1635
pointer _Ucopy(_Iter _First, _Iter _Last, pointer _Ptr)
Definition: vector:1650
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Assign_rv ( _Myt &&  _Right,
true_type   
)
inline
868  { // move from _Right, stealing its contents
869  this->_Swap_all((_Myt&)_Right);
870  this->_Myfirst() = _Right._Myfirst();
871  this->_Mylast() = _Right._Mylast();
872  this->_Myend() = _Right._Myend();
873 
874  _Right._Myfirst() = pointer();
875  _Right._Mylast() = pointer();
876  _Right._Myend() = pointer();
877  }
void _Swap_all(_Myt &_Right)
Definition: vector:616
pointer & _Myend() _NOEXCEPT
Definition: vector:661
vector< _Ty, _Alloc > _Myt
Definition: vector:682
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
_Mybase::pointer pointer
Definition: vector:691
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Assign_rv ( _Myt &&  _Right,
false_type   
)
inline
880  { // move from _Right, possibly moving its contents
881  if (get_allocator() == _Right.get_allocator())
882  _Assign_rv(_STD forward<_Myt>(_Right), true_type());
883  else
886  }
_Alloc get_allocator() const _NOEXCEPT
Definition: vector:1193
void _Construct(_Iter _First, _Iter _Last)
Definition: vector:791
void _Assign_rv(_Myt &&_Right, true_type)
Definition: vector:867
integral_constant< bool, true > true_type
Definition: xtr1common:40
move_iterator< _RanIt > make_move_iterator(_RanIt _Iter)
Definition: xutility:2267
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Assign_rv ( _Myt &&  _Right)
inline
889  { // assign by moving _Right
890  _Assign_rv(_STD forward<_Myt>(_Right),
891  typename _Alty::propagate_on_container_move_assignment());
892  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: vector:867
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty, class _Alloc = allocator<_Ty>>
bool vector< _Ty, _Alloc >::_Buy ( size_type  _Capacity)
inlineprotected
1561  { // allocate array with _Capacity elements
1562  this->_Myfirst() = pointer();
1563  this->_Mylast() = pointer();
1564  this->_Myend() = pointer();
1565 
1566  if (_Capacity == 0)
1567  return (false);
1568  else if (max_size() < _Capacity)
1569  _Xlen(); // result too long
1570  else
1571  { // nonempty array, allocate storage
1572  this->_Myfirst() = this->_Getal().allocate(_Capacity);
1573  this->_Mylast() = this->_Myfirst();
1574  this->_Myend() = this->_Myfirst() + _Capacity;
1575  }
1576  return (true);
1577  }
pointer & _Myend() _NOEXCEPT
Definition: vector:661
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
size_type max_size() const _NOEXCEPT
Definition: vector:1183
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
_Mybase::pointer pointer
Definition: vector:691
void _Xlen() const
Definition: vector:1763
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Construct ( _Iter  _First,
_Iter  _Last 
)
inline
792  { // initialize with [_First, _Last)
793  _Construct(_First, _Last, _Iter_cat_t<_Iter>());
794  }
typename iterator_traits< _Iter >::iterator_category _Iter_cat_t
Definition: xutility:655
void _Construct(_Iter _First, _Iter _Last)
Definition: vector:791
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Construct ( _Iter  _First,
_Iter  _Last,
input_iterator_tag   
)
inline
799  { // initialize with [_First, _Last), input iterators
800  _TRY_BEGIN
801 
802  for (; _First != _Last; ++_First)
803  emplace_back(*_First);
804 
805  _CATCH_ALL
806  _Tidy();
807  _RERAISE;
808  _CATCH_END
809  }
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
void emplace_back(_Valty &&..._Val)
Definition: vector:924
#define _CATCH_ALL
Definition: xstddef:62
#define _RERAISE
Definition: xstddef:74
void _Tidy()
Definition: vector:1635
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Construct ( _Iter  _First,
_Iter  _Last,
forward_iterator_tag   
)
inline
814  { // initialize with [_First, _Last), forward iterators
815  if (_Buy(_STD distance(_First, _Last)))
816  { // nonzero, fill it
817  _TRY_BEGIN
818  this->_Mylast() = _Ucopy(_First, _Last, this->_Myfirst());
819  _CATCH_ALL
820  _Tidy();
821  _RERAISE;
822  _CATCH_END
823  }
824  }
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1124
bool _Buy(size_type _Capacity)
Definition: vector:1560
#define _CATCH_ALL
Definition: xstddef:62
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
#define _RERAISE
Definition: xstddef:74
void _Tidy()
Definition: vector:1635
pointer _Ucopy(_Iter _First, _Iter _Last, pointer _Ptr)
Definition: vector:1650
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Construct_n ( size_type  _Count,
const value_type _Pval 
)
inline
827  { // construct from _Count * *_Pval
828  if (_Buy(_Count))
829  { // nonzero, fill it
830  _TRY_BEGIN
831  this->_Mylast() = _Ufill(this->_Myfirst(), _Count, _Pval);
832  _CATCH_ALL
833  _Tidy();
834  _RERAISE;
835  _CATCH_END
836  }
837  }
unsigned int _Count
Definition: xcomplex:668
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
bool _Buy(size_type _Capacity)
Definition: vector:1560
#define _CATCH_ALL
Definition: xstddef:62
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
pointer _Ufill(pointer _Ptr, size_type _Count, const value_type *_Pval)
Definition: vector:1757
#define _RERAISE
Definition: xstddef:74
void _Tidy()
Definition: vector:1635
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Destroy ( pointer  _First,
pointer  _Last 
)
inlineprotected
1580  { // destroy [_First, _Last) using allocator
1581  _Destroy_range(_First, _Last, this->_Getal());
1582  }
void _Destroy_range(_Ptr _First, _Ptr _Last, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory0:1113
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
size_type vector< _Ty, _Alloc >::_Grow_to ( size_type  _Count) const
inlineprotected
1585  { // grow by 50% or at least to _Count
1586  size_type _Capacity = capacity();
1587 
1588  _Capacity = max_size() - _Capacity / 2 < _Capacity
1589  ? 0 : _Capacity + _Capacity / 2; // try to grow by 50%
1590  if (_Capacity < _Count)
1591  _Capacity = _Count;
1592  return (_Capacity);
1593  }
unsigned int _Count
Definition: xcomplex:668
size_type capacity() const _NOEXCEPT
Definition: vector:1041
size_type max_size() const _NOEXCEPT
Definition: vector:1183
_Mybase::size_type size_type
Definition: vector:689
template<class _Ty, class _Alloc = allocator<_Ty>>
size_type vector< _Ty, _Alloc >::_Has_unused_capacity ( ) const
inline
1052  { // micro-optimization for capacity() != size()
1053  return (this->_Myend() != this->_Mylast());
1054  }
pointer & _Myend() _NOEXCEPT
Definition: vector:661
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Insert ( const_iterator  _Where,
_Iter  _First,
_Iter  _Last,
input_iterator_tag   
)
inline
1383  { // insert [_First, _Last) at _Where, input iterators
1384  size_type _Off = _VIPTR(_Where) - this->_Myfirst();
1385 
1386  #if _ITERATOR_DEBUG_LEVEL == 2
1387  if (size() < _Off)
1388  _DEBUG_ERROR("vector insert iterator outside range");
1389  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1390 
1391  if (_First != _Last)
1392  { // worth doing, gather at end and rotate into place
1393  size_type _Oldsize = size();
1394 
1395  _TRY_BEGIN
1396  for (; _First != _Last; ++_First)
1397  push_back(*_First); // append
1398 
1399  _CATCH_ALL
1400  erase(begin() + _Oldsize, end());
1401  _RERAISE;
1402  _CATCH_END
1403 
1404  _STD rotate(begin() + _Off, begin() + _Oldsize, end());
1405  }
1406  }
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
#define _VIPTR(it)
Definition: vector:697
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
iterator begin() _NOEXCEPT
Definition: vector:1056
size_type size() const _NOEXCEPT
Definition: vector:1178
_FwdIt rotate(_FwdIt _First, _FwdIt _Mid, _FwdIt _Last)
Definition: xutility:3623
iterator end() _NOEXCEPT
Definition: vector:1066
#define _CATCH_ALL
Definition: xstddef:62
_Mybase::size_type size_type
Definition: vector:689
iterator erase(const_iterator _Where)
Definition: vector:1483
void push_back(value_type &&_Val)
Definition: vector:895
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
#define _RERAISE
Definition: xstddef:74
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Insert ( const_iterator  _Where,
_Iter  _First,
_Iter  _Last,
forward_iterator_tag   
)
inline
1412  { // insert [_First, _Last) at _Where, forward iterators
1413  #if _ITERATOR_DEBUG_LEVEL == 2
1414  if (_VICONT(_Where) != &this->_Get_data()
1415  || _VIPTR(_Where) < this->_Myfirst()
1416  || this->_Mylast() < _VIPTR(_Where))
1417  _DEBUG_ERROR("vector insert iterator outside range");
1418  _DEBUG_RANGE(_First, _Last);
1419  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1420 
1421  size_type _Count = _STD distance(_First, _Last);
1422  if (_Count == 0)
1423  ;
1424  else if (_Unused_capacity() < _Count)
1425  { // not enough room, reallocate
1426  if (max_size() - size() < _Count)
1427  _Xlen(); // result too long
1428 
1429  size_type _Capacity = _Grow_to(size() + _Count);
1430  pointer _Newvec = this->_Getal().allocate(_Capacity);
1431  pointer _Ptr = _Newvec;
1432 
1433  _TRY_BEGIN
1434  _Ptr = _Umove(this->_Myfirst(), _VIPTR(_Where),
1435  _Newvec); // copy prefix
1436  _Ptr = _Ucopy(_First, _Last, _Ptr); // add new stuff
1437  _Umove(_VIPTR(_Where), this->_Mylast(),
1438  _Ptr); // copy suffix
1439  _CATCH_ALL
1440  _Destroy(_Newvec, _Ptr);
1441  this->_Getal().deallocate(_Newvec, _Capacity);
1442  _RERAISE;
1443  _CATCH_END
1444 
1445  _Count += size();
1446  if (this->_Myfirst() != pointer())
1447  { // destroy and deallocate old array
1448  _Destroy(this->_Myfirst(), this->_Mylast());
1449  this->_Getal().deallocate(this->_Myfirst(),
1450  this->_Myend() - this->_Myfirst());
1451  }
1452 
1453  this->_Orphan_all();
1454  this->_Myend() = _Newvec + _Capacity;
1455  this->_Mylast() = _Newvec + _Count;
1456  this->_Myfirst() = _Newvec;
1457  }
1458  else
1459  { // new stuff fits, append and rotate into place
1460  _Ucopy(_First, _Last, this->_Mylast());
1461  _STD rotate(_VIPTR(_Where), this->_Mylast(),
1462  this->_Mylast() + _Count);
1463  this->_Mylast() += _Count;
1464  _Orphan_range(_VIPTR(_Where), this->_Mylast());
1465  }
1466  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:631
void _Orphan_all()
Definition: vector:611
unsigned int _Count
Definition: xcomplex:668
#define _DEBUG_RANGE(first, last)
Definition: xutility:822
#define _TRY_BEGIN
Definition: xstddef:60
pointer & _Myend() _NOEXCEPT
Definition: vector:661
#define _CATCH_END
Definition: xstddef:63
#define _VIPTR(it)
Definition: vector:697
#define _VICONT(it)
Definition: vector:696
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1124
pointer _Umove(_Iter _First, _Iter _Last, pointer _Ptr)
Definition: vector:1657
size_type size() const _NOEXCEPT
Definition: vector:1178
_FwdIt rotate(_FwdIt _First, _FwdIt _Mid, _FwdIt _Last)
Definition: xutility:3623
size_type max_size() const _NOEXCEPT
Definition: vector:1183
void _Orphan_range(pointer, pointer) const
Definition: vector:1792
#define _CATCH_ALL
Definition: xstddef:62
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
_Mybase::size_type size_type
Definition: vector:689
size_type _Unused_capacity() const _NOEXCEPT
Definition: vector:1046
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1579
size_type _Grow_to(size_type _Count) const
Definition: vector:1584
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
_Mybase::pointer pointer
Definition: vector:691
#define _RERAISE
Definition: xstddef:74
void _Xlen() const
Definition: vector:1763
pointer _Ucopy(_Iter _First, _Iter _Last, pointer _Ptr)
Definition: vector:1650
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::_Insert_n ( const_iterator  _Where,
size_type  _Count,
const value_type _Val 
)
inlineprotected
1665  { // insert _Count * _Val at _Where
1666  #if _ITERATOR_DEBUG_LEVEL == 2
1667  if (_VICONT(_Where) != &this->_Get_data()
1668  || _VIPTR(_Where) < this->_Myfirst()
1669  || this->_Mylast() < _VIPTR(_Where))
1670  _DEBUG_ERROR("vector insert iterator outside range");
1671  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1672 
1673  size_type _Off = _VIPTR(_Where) - this->_Myfirst();
1674  if (_Count == 0)
1675  ;
1676  else if (_Unused_capacity() < _Count)
1677  { // not enough room, reallocate
1678  if (max_size() - size() < _Count)
1679  _Xlen(); // result too long
1680 
1681  size_type _Capacity = _Grow_to(size() + _Count);
1682  pointer _Newvec = this->_Getal().allocate(_Capacity);
1683  size_type _Whereoff = _VIPTR(_Where) - this->_Myfirst();
1684  int _Ncopied = 0;
1685 
1686  _TRY_BEGIN
1687  _Ufill(_Newvec + _Whereoff, _Count,
1688  _STD addressof(_Val)); // add new stuff
1689  ++_Ncopied;
1690  _Umove(this->_Myfirst(), _VIPTR(_Where),
1691  _Newvec); // copy prefix
1692  ++_Ncopied;
1693  _Umove(_VIPTR(_Where), this->_Mylast(),
1694  _Newvec + (_Whereoff + _Count)); // copy suffix
1695  _CATCH_ALL
1696  if (1 < _Ncopied)
1697  _Destroy(_Newvec, _Newvec + _Whereoff);
1698  if (0 < _Ncopied)
1699  _Destroy(_Newvec + _Whereoff, _Newvec + _Whereoff + _Count);
1700  this->_Getal().deallocate(_Newvec, _Capacity);
1701  _RERAISE;
1702  _CATCH_END
1703 
1704  _Count += size();
1705  if (this->_Myfirst() != pointer())
1706  { // destroy and deallocate old array
1707  _Destroy(this->_Myfirst(), this->_Mylast());
1708  this->_Getal().deallocate(this->_Myfirst(),
1709  this->_Myend() - this->_Myfirst());
1710  }
1711 
1712  this->_Orphan_all();
1713  this->_Myend() = _Newvec + _Capacity;
1714  this->_Mylast() = _Newvec + _Count;
1715  this->_Myfirst() = _Newvec;
1716  }
1717  else if ((size_type)(this->_Mylast() - _VIPTR(_Where))
1718  < _Count)
1719  { // new stuff spills off end
1720  value_type _Tmp = _Val; // in case _Val is in sequence
1721 
1722  _Umove(_VIPTR(_Where), this->_Mylast(),
1723  _VIPTR(_Where) + _Count); // copy suffix
1724 
1725  _TRY_BEGIN
1726  _Ufill(this->_Mylast(),
1727  _Count - (this->_Mylast() - _VIPTR(_Where)),
1728  _STD addressof(_Tmp)); // insert new stuff off end
1729  _CATCH_ALL
1730  _Destroy(_VIPTR(_Where) + _Count,
1731  this->_Mylast() + _Count);
1732  _RERAISE;
1733  _CATCH_END
1734 
1735  this->_Mylast() += _Count;
1736  _Orphan_range(_VIPTR(_Where), this->_Mylast());
1737  _STD fill(_VIPTR(_Where), this->_Mylast() - _Count,
1738  _Tmp); // insert up to old end
1739  }
1740  else
1741  { // new stuff can all be assigned
1742  value_type _Tmp = _Val; // in case _Val is in sequence
1743 
1744  pointer _Oldend = this->_Mylast();
1745  this->_Mylast() = _Umove(_Oldend - _Count, _Oldend,
1746  this->_Mylast()); // copy suffix
1747 
1748  _Orphan_range(_VIPTR(_Where), this->_Mylast());
1749  _Move_backward_unchecked(_VIPTR(_Where), _Oldend - _Count,
1750  _Oldend); // copy hole
1751  _STD fill(_VIPTR(_Where),
1752  _VIPTR(_Where) + _Count, _Tmp); // insert into hole
1753  }
1754  return (begin() + _Off);
1755  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:631
void _Orphan_all()
Definition: vector:611
unsigned int _Count
Definition: xcomplex:668
constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:723
#define _TRY_BEGIN
Definition: xstddef:60
pointer & _Myend() _NOEXCEPT
Definition: vector:661
#define _CATCH_END
Definition: xstddef:63
_In_ int _Val
Definition: vcruntime_string.h:62
#define _VIPTR(it)
Definition: vector:697
#define _VICONT(it)
Definition: vector:696
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
void fill(_FwdIt _First, _FwdIt _Last, const _Ty &_Val)
Definition: xutility:2785
iterator begin() _NOEXCEPT
Definition: vector:1056
pointer _Umove(_Iter _First, _Iter _Last, pointer _Ptr)
Definition: vector:1657
size_type size() const _NOEXCEPT
Definition: vector:1178
_Mybase::value_type value_type
Definition: vector:688
size_type max_size() const _NOEXCEPT
Definition: vector:1183
void _Orphan_range(pointer, pointer) const
Definition: vector:1792
#define _CATCH_ALL
Definition: xstddef:62
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
_BidIt2 _Move_backward_unchecked(_BidIt1 _First, _BidIt1 _Last, _BidIt2 _Dest)
Definition: xutility:2674
_Mybase::size_type size_type
Definition: vector:689
size_type _Unused_capacity() const _NOEXCEPT
Definition: vector:1046
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1579
size_type _Grow_to(size_type _Count) const
Definition: vector:1584
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
pointer _Ufill(pointer _Ptr, size_type _Count, const value_type *_Pval)
Definition: vector:1757
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
_Mybase::pointer pointer
Definition: vector:691
#define _RERAISE
Definition: xstddef:74
void _Xlen() const
Definition: vector:1763
template<class _Ty, class _Alloc = allocator<_Ty>>
bool vector< _Ty, _Alloc >::_Inside ( const value_type _Ptr) const
inlineprotected
1596  { // test if _Ptr points inside vector
1597  return (_Ptr < _Unfancy(this->_Mylast()) && _Unfancy(this->_Myfirst()) <= _Ptr);
1598  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:732
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::_Make_iter ( const_iterator  _Where) const
inline
1077  { // make iterator from const_iterator
1078  return (iterator(_Where._Ptr, &this->_Get_data()));
1079  }
_Mybase::iterator iterator
Definition: vector:699
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Orphan_range ( pointer  ,
pointer   
) const
inlineprotected
1793  { // orphan iterators within specified (inclusive) range
1794  }
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Pop_back_n ( size_type  _Count)
inline
1527  { // erase _Count elements at end
1528  pointer _Ptr = this->_Mylast() - _Count;
1529 
1530  #if _ITERATOR_DEBUG_LEVEL == 2
1531  _Orphan_range(_Ptr, this->_Mylast());
1532  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1533 
1534  _Destroy(_Ptr, this->_Mylast());
1535  this->_Mylast() = _Ptr;
1536  }
unsigned int _Count
Definition: xcomplex:668
void _Orphan_range(pointer, pointer) const
Definition: vector:1792
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1579
_Mybase::pointer pointer
Definition: vector:691
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Reallocate ( size_type  _Count)
inlineprotected
1601  { // move to array of exactly _Count elements
1602  pointer _Ptr = this->_Getal().allocate(_Count);
1603 
1604  _TRY_BEGIN
1605  _Umove(this->_Myfirst(), this->_Mylast(), _Ptr);
1606  _CATCH_ALL
1607  this->_Getal().deallocate(_Ptr, _Count);
1608  _RERAISE;
1609  _CATCH_END
1610 
1611  size_type _Size = size();
1612  if (this->_Myfirst() != pointer())
1613  { // destroy and deallocate old array
1614  _Destroy(this->_Myfirst(), this->_Mylast());
1615  this->_Getal().deallocate(this->_Myfirst(),
1616  this->_Myend() - this->_Myfirst());
1617  }
1618 
1619  this->_Orphan_all();
1620  this->_Myend() = _Ptr + _Count;
1621  this->_Mylast() = _Ptr + _Size;
1622  this->_Myfirst() = _Ptr;
1623  }
void _Orphan_all()
Definition: vector:611
unsigned int _Count
Definition: xcomplex:668
#define _TRY_BEGIN
Definition: xstddef:60
pointer & _Myend() _NOEXCEPT
Definition: vector:661
#define _CATCH_END
Definition: xstddef:63
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
pointer _Umove(_Iter _First, _Iter _Last, pointer _Ptr)
Definition: vector:1657
size_type size() const _NOEXCEPT
Definition: vector:1178
#define _CATCH_ALL
Definition: xstddef:62
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
_Mybase::size_type size_type
Definition: vector:689
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1579
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
_Mybase::pointer pointer
Definition: vector:691
#define _RERAISE
Definition: xstddef:74
_Size
Definition: vcruntime_string.h:36
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Reserve ( size_type  _Count)
inlineprotected
1626  { // ensure room for _Count new elements, grow exponentially
1627  if (_Unused_capacity() < _Count)
1628  { // need more room, try to get it
1629  if (max_size() - size() < _Count)
1630  _Xlen();
1632  }
1633  }
unsigned int _Count
Definition: xcomplex:668
void _Reallocate(size_type _Count)
Definition: vector:1600
size_type size() const _NOEXCEPT
Definition: vector:1178
size_type max_size() const _NOEXCEPT
Definition: vector:1183
size_type _Unused_capacity() const _NOEXCEPT
Definition: vector:1046
size_type _Grow_to(size_type _Count) const
Definition: vector:1584
void _Xlen() const
Definition: vector:1763
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Tidy ( )
inlineprotected
1636  { // free all storage
1637  if (this->_Myfirst() != pointer())
1638  { // something to free, destroy and deallocate it
1639  this->_Orphan_all();
1640  _Destroy(this->_Myfirst(), this->_Mylast());
1641  this->_Getal().deallocate(this->_Myfirst(),
1642  this->_Myend() - this->_Myfirst());
1643  this->_Myfirst() = pointer();
1644  this->_Mylast() = pointer();
1645  this->_Myend() = pointer();
1646  }
1647  }
void _Orphan_all()
Definition: vector:611
pointer & _Myend() _NOEXCEPT
Definition: vector:661
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1579
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
_Mybase::pointer pointer
Definition: vector:691
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
pointer vector< _Ty, _Alloc >::_Ucopy ( _Iter  _First,
_Iter  _Last,
pointer  _Ptr 
)
inlineprotected
1651  { // copy initializing [_First, _Last), using allocator
1652  return (_Uninitialized_copy(_First, _Last,
1653  _Ptr, this->_Getal()));
1654  }
_FwdIt _Uninitialized_copy(_InIt _First, _InIt _Last, _FwdIt _Dest, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory:257
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
pointer vector< _Ty, _Alloc >::_Ufill ( pointer  _Ptr,
size_type  _Count,
const value_type _Pval 
)
inlineprotected
1758  { // copy initializing _Count * _Val, using allocator
1759  _Uninitialized_fill_n(_Ptr, _Count, _Pval, this->_Getal());
1760  return (_Ptr + _Count);
1761  }
unsigned int _Count
Definition: xcomplex:668
void _Uninitialized_fill_n(_FwdIt _First, _Diff _Count, const _Iter_value_t< _FwdIt > *_Pval, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory:440
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
pointer vector< _Ty, _Alloc >::_Umove ( _Iter  _First,
_Iter  _Last,
pointer  _Ptr 
)
inlineprotected
1658  { // move initializing [_First, _Last), using allocator
1659  return (_Uninitialized_move(_First, _Last,
1660  _Ptr, this->_Getal()));
1661  }
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
_FwdIt _Uninitialized_move(_InIt _First, _InIt _Last, _FwdIt _Dest, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory:311
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
size_type vector< _Ty, _Alloc >::_Unused_capacity ( ) const
inline
1047  { // micro-optimization for capacity() - size()
1048  return (this->_Myend() - this->_Mylast());
1049  }
pointer & _Myend() _NOEXCEPT
Definition: vector:661
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Xlen ( ) const
inlineprotected
1764  { // report a length_error
1765  _Xlength_error("vector<T> too long");
1766  }
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xlength_error(_In_z_ const char *)
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Xran ( ) const
inlineprotected
1769  { // report an out_of_range error
1770  _Xout_of_range("invalid vector<T> subscript");
1771  }
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *)
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::assign ( _XSTD initializer_list< value_type _Ilist)
inline
964  { // assign initializer_list
965  assign(_Ilist.begin(), _Ilist.end());
966  }
void assign(_XSTD initializer_list< value_type > _Ilist)
Definition: vector:963
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
enable_if<_Is_iterator<_Iter>::value, void>::type vector< _Ty, _Alloc >::assign ( _Iter  _First,
_Iter  _Last 
)
inline
1323  { // assign [_First, _Last)
1324  clear();
1325  _Assign(_First, _Last, _Iter_cat_t<_Iter>());
1326  }
typename iterator_traits< _Iter >::iterator_category _Iter_cat_t
Definition: xutility:655
void clear() _NOEXCEPT
Definition: vector:1538
void _Assign(_Iter _First, _Iter _Last, input_iterator_tag)
Definition: vector:1329
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::assign ( size_type  _Count,
const value_type _Val 
)
inline
1353  { // assign _Count * _Val
1354  clear();
1355  insert(begin(), _Count, _Val);
1356  }
unsigned int _Count
Definition: xcomplex:668
_In_ int _Val
Definition: vcruntime_string.h:62
iterator begin() _NOEXCEPT
Definition: vector:1056
iterator insert(const_iterator _Where, _Ty &&_Val)
Definition: vector:918
void clear() _NOEXCEPT
Definition: vector:1538
template<class _Ty, class _Alloc = allocator<_Ty>>
const_reference vector< _Ty, _Alloc >::at ( size_type  _Pos) const
inline
1200  { // subscript nonmutable sequence with checking
1201  if (size() <= _Pos)
1202  _Xran();
1203  return (*(this->_Myfirst() + _Pos));
1204  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
size_type size() const _NOEXCEPT
Definition: vector:1178
void _Xran() const
Definition: vector:1768
template<class _Ty, class _Alloc = allocator<_Ty>>
reference vector< _Ty, _Alloc >::at ( size_type  _Pos)
inline
1207  { // subscript mutable sequence with checking
1208  if (size() <= _Pos)
1209  _Xran();
1210  return (*(this->_Myfirst() + _Pos));
1211  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
size_type size() const _NOEXCEPT
Definition: vector:1178
void _Xran() const
Definition: vector:1768
template<class _Ty, class _Alloc = allocator<_Ty>>
reference vector< _Ty, _Alloc >::back ( )
inline
1266  { // return last element of mutable sequence
1267  return (*(end() - 1));
1268  }
iterator end() _NOEXCEPT
Definition: vector:1066
template<class _Ty, class _Alloc = allocator<_Ty>>
const_reference vector< _Ty, _Alloc >::back ( ) const
inline
1271  { // return last element of nonmutable sequence
1272  return (*(end() - 1));
1273  }
iterator end() _NOEXCEPT
Definition: vector:1066
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::begin ( )
inline
1057  { // return iterator for beginning of mutable sequence
1058  return (iterator(this->_Myfirst(), &this->_Get_data()));
1059  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:631
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
_Mybase::iterator iterator
Definition: vector:699
template<class _Ty, class _Alloc = allocator<_Ty>>
const_iterator vector< _Ty, _Alloc >::begin ( ) const
inline
1062  { // return iterator for beginning of nonmutable sequence
1063  return (const_iterator(this->_Myfirst(), &this->_Get_data()));
1064  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:631
_Mybase::const_iterator const_iterator
Definition: vector:700
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
template<class _Ty, class _Alloc = allocator<_Ty>>
size_type vector< _Ty, _Alloc >::capacity ( ) const
inline
1042  { // return current length of allocated storage
1043  return (this->_Myend() - this->_Myfirst());
1044  }
pointer & _Myend() _NOEXCEPT
Definition: vector:661
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
template<class _Ty, class _Alloc = allocator<_Ty>>
const_iterator vector< _Ty, _Alloc >::cbegin ( ) const
inline
1102  { // return iterator for beginning of nonmutable sequence
1103  return (begin());
1104  }
iterator begin() _NOEXCEPT
Definition: vector:1056
template<class _Ty, class _Alloc = allocator<_Ty>>
const_iterator vector< _Ty, _Alloc >::cend ( ) const
inline
1107  { // return iterator for end of nonmutable sequence
1108  return (end());
1109  }
iterator end() _NOEXCEPT
Definition: vector:1066
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::clear ( )
inline
1539  { // erase all
1540  this->_Orphan_all();
1541  _Destroy(this->_Myfirst(), this->_Mylast());
1542  this->_Mylast() = this->_Myfirst();
1543  }
void _Orphan_all()
Definition: vector:611
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1579
template<class _Ty, class _Alloc = allocator<_Ty>>
const_reverse_iterator vector< _Ty, _Alloc >::crbegin ( ) const
inline
1112  { // return iterator for beginning of reversed nonmutable sequence
1113  return (rbegin());
1114  }
reverse_iterator rbegin() _NOEXCEPT
Definition: vector:1081
template<class _Ty, class _Alloc = allocator<_Ty>>
const_reverse_iterator vector< _Ty, _Alloc >::crend ( ) const
inline
1117  { // return iterator for end of reversed nonmutable sequence
1118  return (rend());
1119  }
reverse_iterator rend() _NOEXCEPT
Definition: vector:1091
template<class _Ty, class _Alloc = allocator<_Ty>>
_Ty* vector< _Ty, _Alloc >::data ( )
inline
1246  { // return address of first element
1247  return (_Unfancy(this->_Myfirst()));
1248  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:732
template<class _Ty, class _Alloc = allocator<_Ty>>
const _Ty* vector< _Ty, _Alloc >::data ( ) const
inline
1251  { // return address of first element
1252  return (_Unfancy(this->_Myfirst()));
1253  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:732
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class... _Valty>
iterator vector< _Ty, _Alloc >::emplace ( const_iterator  _Where,
_Valty &&...  _Val 
)
inline
936  { // insert by moving _Val at _Where
937  size_type _Off = _VIPTR(_Where) - this->_Myfirst();
938 
939  #if _ITERATOR_DEBUG_LEVEL == 2
940  if (size() < _Off)
941  _DEBUG_ERROR("vector emplace iterator outside range");
942  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
943 
944  emplace_back(_STD forward<_Valty>(_Val)...);
945  _STD rotate(begin() + _Off, end() - 1, end());
946  return (begin() + _Off);
947  }
_In_ int _Val
Definition: vcruntime_string.h:62
#define _VIPTR(it)
Definition: vector:697
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
iterator begin() _NOEXCEPT
Definition: vector:1056
size_type size() const _NOEXCEPT
Definition: vector:1178
void emplace_back(_Valty &&..._Val)
Definition: vector:924
_FwdIt rotate(_FwdIt _First, _FwdIt _Mid, _FwdIt _Last)
Definition: xutility:3623
iterator end() _NOEXCEPT
Definition: vector:1066
_Mybase::size_type size_type
Definition: vector:689
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class... _Valty>
void vector< _Ty, _Alloc >::emplace_back ( _Valty &&...  _Val)
inline
925  { // insert by moving into element at end
926  if (this->_Mylast() == this->_Myend())
927  _Reserve(1);
928  _Orphan_range(this->_Mylast(), this->_Mylast());
929  this->_Getal().construct(_Unfancy(this->_Mylast()),
930  _STD forward<_Valty>(_Val)...);
931  ++this->_Mylast();
932  }
pointer & _Myend() _NOEXCEPT
Definition: vector:661
_In_ int _Val
Definition: vcruntime_string.h:62
void _Orphan_range(pointer, pointer) const
Definition: vector:1792
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Reserve(size_type _Count)
Definition: vector:1625
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:732
template<class _Ty, class _Alloc = allocator<_Ty>>
bool vector< _Ty, _Alloc >::empty ( ) const
inline
1189  { // test if sequence is empty
1190  return (this->_Myfirst() == this->_Mylast());
1191  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::end ( )
inline
1067  { // return iterator for end of mutable sequence
1068  return (iterator(this->_Mylast(), &this->_Get_data()));
1069  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:631
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
_Mybase::iterator iterator
Definition: vector:699
template<class _Ty, class _Alloc = allocator<_Ty>>
const_iterator vector< _Ty, _Alloc >::end ( ) const
inline
1072  { // return iterator for end of nonmutable sequence
1073  return (const_iterator(this->_Mylast(), &this->_Get_data()));
1074  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:631
_Mybase::const_iterator const_iterator
Definition: vector:700
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::erase ( const_iterator  _Where)
inline
1484  { // erase element at where
1485  _Move_unchecked(_VIPTR(_Where) + 1, this->_Mylast(),
1486  _VIPTR(_Where));
1487  _Destroy(this->_Mylast() - 1, this->_Mylast());
1488  --this->_Mylast();
1489  return (_Make_iter(_Where));
1490  }
#define _VIPTR(it)
Definition: vector:697
_OutIt _Move_unchecked(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2595
iterator _Make_iter(const_iterator _Where) const
Definition: vector:1076
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1579
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::erase ( const_iterator  _First_arg,
const_iterator  _Last_arg 
)
inline
1495  { // erase [_First, _Last)
1496  if (_First_arg == begin() && _Last_arg == end())
1497  clear();
1498  else if (_First_arg != _Last_arg)
1499  { // clear partial
1500  iterator _First = _Make_iter(_First_arg);
1501  iterator _Last = _Make_iter(_Last_arg);
1502 
1503  if (_First != _Last)
1504  { // worth doing, copy down over hole
1505  #if _ITERATOR_DEBUG_LEVEL == 2
1506  if (_Last < _First || _VICONT(_First) != &this->_Get_data()
1507  || _VIPTR(_First) < this->_Myfirst()
1508  || this->_Mylast() < _VIPTR(_Last))
1509  _DEBUG_ERROR("vector erase iterator outside range");
1510  pointer _Ptr = _Move_unchecked(_VIPTR(_Last), this->_Mylast(),
1511  _VIPTR(_First));
1512  _Orphan_range(_VIPTR(_First), this->_Mylast());
1513 
1514  #else /* _ITERATOR_DEBUG_LEVEL == 2 */
1515  pointer _Ptr = _Move_unchecked(_VIPTR(_Last), this->_Mylast(),
1516  _VIPTR(_First));
1517  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1518 
1519  _Destroy(_Ptr, this->_Mylast());
1520  this->_Mylast() = _Ptr;
1521  }
1522  }
1523  return (_Make_iter(_First_arg));
1524  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:631
Definition: xutility:563
#define _VIPTR(it)
Definition: vector:697
#define _VICONT(it)
Definition: vector:696
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
_OutIt _Move_unchecked(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2595
iterator begin() _NOEXCEPT
Definition: vector:1056
iterator end() _NOEXCEPT
Definition: vector:1066
void _Orphan_range(pointer, pointer) const
Definition: vector:1792
void clear() _NOEXCEPT
Definition: vector:1538
iterator _Make_iter(const_iterator _Where) const
Definition: vector:1076
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1579
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
_Mybase::pointer pointer
Definition: vector:691
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
reference vector< _Ty, _Alloc >::front ( )
inline
1256  { // return first element of mutable sequence
1257  return (*begin());
1258  }
iterator begin() _NOEXCEPT
Definition: vector:1056
template<class _Ty, class _Alloc = allocator<_Ty>>
const_reference vector< _Ty, _Alloc >::front ( ) const
inline
1261  { // return first element of nonmutable sequence
1262  return (*begin());
1263  }
iterator begin() _NOEXCEPT
Definition: vector:1056
template<class _Ty, class _Alloc = allocator<_Ty>>
_Alloc vector< _Ty, _Alloc >::get_allocator ( ) const
inline
1194  { // return allocator object for values
1195  _Alloc _Ret(this->_Getal());
1196  return (_Ret);
1197  }
_Vec_base_types< _Ty, _Alloc >::_Alloc _Alloc
Definition: vector:502
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::insert ( const_iterator  _Where,
_Ty &&  _Val 
)
inline
919  { // insert by moving _Val at _Where
920  return (emplace(_Where, _STD move(_Val)));
921  }
_In_ int _Val
Definition: vcruntime_string.h:62
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1290
iterator emplace(const_iterator _Where, _Valty &&..._Val)
Definition: vector:935
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::insert ( const_iterator  _Where,
_XSTD initializer_list< value_type _Ilist 
)
inline
970  { // insert initializer_list
971  return (insert(_Where, _Ilist.begin(), _Ilist.end()));
972  }
iterator insert(const_iterator _Where, _Ty &&_Val)
Definition: vector:918
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::insert ( const_iterator  _Where,
const _Ty &  _Val 
)
inline
1359  { // insert _Val at _Where
1360  return (_Insert_n(_Where, (size_type)1, _Val));
1361  }
_In_ int _Val
Definition: vcruntime_string.h:62
_Mybase::size_type size_type
Definition: vector:689
iterator _Insert_n(const_iterator _Where, size_type _Count, const value_type &_Val)
Definition: vector:1663
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::insert ( const_iterator  _Where,
size_type  _Count,
const _Ty &  _Val 
)
inline
1365  { // insert _Count * _Val at _Where
1366  return (_Insert_n(_Where, _Count, _Val));
1367  }
unsigned int _Count
Definition: xcomplex:668
_In_ int _Val
Definition: vcruntime_string.h:62
iterator _Insert_n(const_iterator _Where, size_type _Count, const value_type &_Val)
Definition: vector:1663
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
enable_if<_Is_iterator<_Iter>::value, iterator>::type vector< _Ty, _Alloc >::insert ( const_iterator  _Where,
_Iter  _First,
_Iter  _Last 
)
inline
1373  { // insert [_First, _Last) at _Where
1374  size_type _Off = _VIPTR(_Where) - this->_Myfirst();
1375  _Insert(_Where, _First, _Last, _Iter_cat_t<_Iter>());
1376  return (begin() + _Off);
1377  }
typename iterator_traits< _Iter >::iterator_category _Iter_cat_t
Definition: xutility:655
#define _VIPTR(it)
Definition: vector:697
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
iterator begin() _NOEXCEPT
Definition: vector:1056
void _Insert(const_iterator _Where, _Iter _First, _Iter _Last, input_iterator_tag)
Definition: vector:1380
_Mybase::size_type size_type
Definition: vector:689
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
size_type vector< _Ty, _Alloc >::max_size ( ) const
inline
1184  { // return maximum possible length of sequence
1185  return (this->_Getal().max_size());
1186  }
size_type max_size() const _NOEXCEPT
Definition: vector:1183
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
template<class _Ty, class _Alloc = allocator<_Ty>>
_Myt& vector< _Ty, _Alloc >::operator= ( _Myt &&  _Right)
inline
854  { // assign by moving _Right
855  if (this != &_Right)
856  { // different, assign it
857  _Tidy();
858  if (_Alty::propagate_on_container_move_assignment::value
859  && this->_Getal() != _Right._Getal())
860  this->_Move_alloc(_Right._Getal());
861 
862  _Assign_rv(_STD forward<_Myt>(_Right));
863  }
864  return (*this);
865  }
void _Assign_rv(_Myt &&_Right, true_type)
Definition: vector:867
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
void _Tidy()
Definition: vector:1635
void _Move_alloc(_Alty &_Al)
Definition: vector:536
constexpr const _Ty &() _Right
Definition: algorithm:3591
template<class _Ty, class _Alloc = allocator<_Ty>>
_Myt& vector< _Ty, _Alloc >::operator= ( _XSTD initializer_list< value_type _Ilist)
inline
958  { // assign initializer_list
959  assign(_Ilist.begin(), _Ilist.end());
960  return (*this);
961  }
void assign(_XSTD initializer_list< value_type > _Ilist)
Definition: vector:963
template<class _Ty, class _Alloc = allocator<_Ty>>
_Myt& vector< _Ty, _Alloc >::operator= ( const _Myt _Right)
inline
980  { // assign _Right
981  if (this != &_Right)
982  { // different, assign it
983  if (this->_Getal() != _Right._Getal()
984  && _Alty::propagate_on_container_copy_assignment::value)
985  { // change allocator before copying
986  _Tidy();
987  this->_Copy_alloc(_Right._Getal());
988  }
989 
990  this->_Orphan_all();
991 
992  if (_Right.empty())
993  clear(); // new sequence empty, erase existing sequence
994  else if (_Right.size() <= size())
995  { // enough elements, copy new and destroy old
996  pointer _Ptr = _Copy_unchecked(_Right._Myfirst(),
997  _Right._Mylast(), this->_Myfirst()); // copy new
998  _Destroy(_Ptr, this->_Mylast()); // destroy old
999  this->_Mylast() = this->_Myfirst() + _Right.size();
1000  }
1001  else if (_Right.size() <= capacity())
1002  { // enough room, copy and construct new
1003  pointer _Ptr = _Right._Myfirst() + size();
1004  _Copy_unchecked(_Right._Myfirst(),
1005  _Ptr, this->_Myfirst());
1006  this->_Mylast() = _Ucopy(_Ptr, _Right._Mylast(),
1007  this->_Mylast());
1008  }
1009  else
1010  { // not enough room, allocate new array and construct new
1011  if (this->_Myfirst() != pointer())
1012  { // discard old array
1013  _Destroy(this->_Myfirst(), this->_Mylast());
1014  this->_Getal().deallocate(this->_Myfirst(),
1015  this->_Myend() - this->_Myfirst());
1016  }
1017  if (_Buy(_Right.size()))
1018  _TRY_BEGIN
1019  this->_Mylast() =
1020  _Ucopy(_Right._Myfirst(), _Right._Mylast(),
1021  this->_Myfirst());
1022  _CATCH_ALL
1023  _Tidy();
1024  _RERAISE;
1025  _CATCH_END
1026  }
1027  }
1028  return (*this);
1029  }
void _Orphan_all()
Definition: vector:611
#define _TRY_BEGIN
Definition: xstddef:60
pointer & _Myend() _NOEXCEPT
Definition: vector:661
#define _CATCH_END
Definition: xstddef:63
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
size_type capacity() const _NOEXCEPT
Definition: vector:1041
bool _Buy(size_type _Capacity)
Definition: vector:1560
size_type size() const _NOEXCEPT
Definition: vector:1178
void clear() _NOEXCEPT
Definition: vector:1538
#define _CATCH_ALL
Definition: xstddef:62
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1579
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
_OutIt _Copy_unchecked(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2330
_Mybase::pointer pointer
Definition: vector:691
#define _RERAISE
Definition: xstddef:74
void _Tidy()
Definition: vector:1635
pointer _Ucopy(_Iter _First, _Iter _Last, pointer _Ptr)
Definition: vector:1650
constexpr const _Ty &() _Right
Definition: algorithm:3591
void _Copy_alloc(const _Alty &_Al)
Definition: vector:531
template<class _Ty, class _Alloc = allocator<_Ty>>
const_reference vector< _Ty, _Alloc >::operator[] ( size_type  _Pos) const
inline
1214  { // subscript nonmutable sequence
1215  #if _ITERATOR_DEBUG_LEVEL == 2
1216  if (size() <= _Pos)
1217  { // report error
1218  _DEBUG_ERROR("vector subscript out of range");
1220  }
1221 
1222  #elif _ITERATOR_DEBUG_LEVEL == 1
1223  _SCL_SECURE_VALIDATE_RANGE(_Pos < size());
1224  #endif /* _ITERATOR_DEBUG_LEVEL */
1225 
1226  return (*(this->_Myfirst() + _Pos));
1227  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
#define _SCL_SECURE_OUT_OF_RANGE
Definition: yvals.h:396
size_type size() const _NOEXCEPT
Definition: vector:1178
#define _SCL_SECURE_VALIDATE_RANGE(cond)
Definition: yvals.h:392
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
template<class _Ty, class _Alloc = allocator<_Ty>>
reference vector< _Ty, _Alloc >::operator[] ( size_type  _Pos)
inline
1230  { // subscript mutable sequence
1231  #if _ITERATOR_DEBUG_LEVEL == 2
1232  if (size() <= _Pos)
1233  { // report error
1234  _DEBUG_ERROR("vector subscript out of range");
1236  }
1237 
1238  #elif _ITERATOR_DEBUG_LEVEL == 1
1239  _SCL_SECURE_VALIDATE_RANGE(_Pos < size());
1240  #endif /* _ITERATOR_DEBUG_LEVEL */
1241 
1242  return (*(this->_Myfirst() + _Pos));
1243  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
#define _SCL_SECURE_OUT_OF_RANGE
Definition: yvals.h:396
size_type size() const _NOEXCEPT
Definition: vector:1178
#define _SCL_SECURE_VALIDATE_RANGE(cond)
Definition: yvals.h:392
#define _DEBUG_ERROR(mesg)
Definition: xutility:32
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::pop_back ( )
inline
1313  { // erase element at end
1314  this->_Getal().destroy(_Unfancy(this->_Mylast() - 1));
1315  --this->_Mylast();
1316  }
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:732
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::push_back ( value_type &&  _Val)
inline
896  { // insert by moving into element at end
897  if (_Inside(_STD addressof(_Val)))
898  { // push back an element
899  size_type _Idx = _STD addressof(_Val) - _Unfancy(this->_Myfirst());
900  if (this->_Mylast() == this->_Myend())
901  _Reserve(1);
902  _Orphan_range(this->_Mylast(), this->_Mylast());
903  this->_Getal().construct(_Unfancy(this->_Mylast()),
904  _STD forward<value_type>(this->_Myfirst()[_Idx]));
905  ++this->_Mylast();
906  }
907  else
908  { // push back a non-element
909  if (this->_Mylast() == this->_Myend())
910  _Reserve(1);
911  _Orphan_range(this->_Mylast(), this->_Mylast());
912  this->_Getal().construct(_Unfancy(this->_Mylast()),
913  _STD forward<value_type>(_Val));
914  ++this->_Mylast();
915  }
916  }
constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:723
pointer & _Myend() _NOEXCEPT
Definition: vector:661
_In_ int _Val
Definition: vcruntime_string.h:62
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
void _Orphan_range(pointer, pointer) const
Definition: vector:1792
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Reserve(size_type _Count)
Definition: vector:1625
_Mybase::size_type size_type
Definition: vector:689
bool _Inside(const value_type *_Ptr) const
Definition: vector:1595
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:732
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::push_back ( const value_type _Val)
inline
1276  { // insert element at end
1277  if (_Inside(_STD addressof(_Val)))
1278  { // push back an element
1279  size_type _Idx = _STD addressof(_Val) - _Unfancy(this->_Myfirst());
1280  if (this->_Mylast() == this->_Myend())
1281  _Reserve(1);
1282  _Orphan_range(this->_Mylast(), this->_Mylast());
1283  this->_Getal().construct(_Unfancy(this->_Mylast()),
1284  this->_Myfirst()[_Idx]);
1285  ++this->_Mylast();
1286  }
1287  else
1288  { // push back a non-element
1289  if (this->_Mylast() == this->_Myend())
1290  _Reserve(1);
1291  _Orphan_range(this->_Mylast(), this->_Mylast());
1292  this->_Getal().construct(_Unfancy(this->_Mylast()),
1293  _Val);
1294  ++this->_Mylast();
1295  }
1296  }
constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:723
pointer & _Myend() _NOEXCEPT
Definition: vector:661
_In_ int _Val
Definition: vcruntime_string.h:62
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
void _Orphan_range(pointer, pointer) const
Definition: vector:1792
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Reserve(size_type _Count)
Definition: vector:1625
_Mybase::size_type size_type
Definition: vector:689
bool _Inside(const value_type *_Ptr) const
Definition: vector:1595
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:732
template<class _Ty, class _Alloc = allocator<_Ty>>
reverse_iterator vector< _Ty, _Alloc >::rbegin ( )
inline
1082  { // return iterator for beginning of reversed mutable sequence
1083  return (reverse_iterator(end()));
1084  }
iterator end() _NOEXCEPT
Definition: vector:1066
_STD reverse_iterator< iterator > reverse_iterator
Definition: vector:702
template<class _Ty, class _Alloc = allocator<_Ty>>
const_reverse_iterator vector< _Ty, _Alloc >::rbegin ( ) const
inline
1087  { // return iterator for beginning of reversed nonmutable sequence
1088  return (const_reverse_iterator(end()));
1089  }
iterator end() _NOEXCEPT
Definition: vector:1066
_STD reverse_iterator< const_iterator > const_reverse_iterator
Definition: vector:703
template<class _Ty, class _Alloc = allocator<_Ty>>
reverse_iterator vector< _Ty, _Alloc >::rend ( )
inline
1092  { // return iterator for end of reversed mutable sequence
1093  return (reverse_iterator(begin()));
1094  }
iterator begin() _NOEXCEPT
Definition: vector:1056
_STD reverse_iterator< iterator > reverse_iterator
Definition: vector:702
template<class _Ty, class _Alloc = allocator<_Ty>>
const_reverse_iterator vector< _Ty, _Alloc >::rend ( ) const
inline
1097  { // return iterator for end of reversed nonmutable sequence
1098  return (const_reverse_iterator(begin()));
1099  }
iterator begin() _NOEXCEPT
Definition: vector:1056
_STD reverse_iterator< const_iterator > const_reverse_iterator
Definition: vector:703
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::reserve ( size_type  _Count)
inline
1032  { // determine new minimum length of allocated storage
1033  if (capacity() < _Count)
1034  { // something to do, check and reallocate
1035  if (max_size() < _Count)
1036  _Xlen();
1038  }
1039  }
unsigned int _Count
Definition: xcomplex:668
void _Reallocate(size_type _Count)
Definition: vector:1600
size_type capacity() const _NOEXCEPT
Definition: vector:1041
size_type max_size() const _NOEXCEPT
Definition: vector:1183
void _Xlen() const
Definition: vector:1763
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::resize ( size_type  _Newsize)
inline
1133  { // determine new length, padding as needed
1134  if (_Newsize < size())
1135  _Pop_back_n(size() - _Newsize);
1136  else if (size() < _Newsize)
1137  { // pad as needed
1138  _Reserve(_Newsize - size());
1139  _TRY_BEGIN
1140  _Uninitialized_default_fill_n(this->_Mylast(), _Newsize - size(),
1141  this->_Getal());
1142  _CATCH_ALL
1143  _Tidy();
1144  _RERAISE;
1145  _CATCH_END
1146  this->_Mylast() += _Newsize - size();
1147  }
1148  }
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
size_type size() const _NOEXCEPT
Definition: vector:1178
#define _CATCH_ALL
Definition: xstddef:62
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Uninitialized_default_fill_n(_FwdIt _First, _Diff _Count, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory:477
void _Reserve(size_type _Count)
Definition: vector:1625
void _Pop_back_n(size_type _Count)
Definition: vector:1526
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
#define _RERAISE
Definition: xstddef:74
void _Tidy()
Definition: vector:1635
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::resize ( size_type  _Newsize,
const value_type _Val 
)
inline
1151  { // determine new length, padding with _Val elements as needed
1152  if (_Newsize < size())
1153  _Pop_back_n(size() - _Newsize);
1154  else if (size() < _Newsize)
1155  { // pad as needed
1156  const value_type *_Ptr = _STD addressof(_Val);
1157 
1158  if (_Inside(_Ptr))
1159  { // padding is inside vector, recompute _Ptr after reserve
1160  const difference_type _Idx = _Ptr
1161  - _Unfancy(this->_Myfirst());
1162  _Reserve(_Newsize - size());
1163  _Ptr = _Unfancy(this->_Myfirst()) + _Idx;
1164  }
1165  else
1166  _Reserve(_Newsize - size());
1167 
1168  _TRY_BEGIN
1169  _Ufill(this->_Mylast(), _Newsize - size(), _Ptr);
1170  _CATCH_ALL
1171  _Tidy();
1172  _RERAISE;
1173  _CATCH_END
1174  this->_Mylast() += _Newsize - size();
1175  }
1176  }
constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:723
#define _TRY_BEGIN
Definition: xstddef:60
#define _CATCH_END
Definition: xstddef:63
_In_ int _Val
Definition: vcruntime_string.h:62
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
_Mybase::difference_type difference_type
Definition: vector:690
size_type size() const _NOEXCEPT
Definition: vector:1178
_Mybase::value_type value_type
Definition: vector:688
#define _CATCH_ALL
Definition: xstddef:62
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Reserve(size_type _Count)
Definition: vector:1625
bool _Inside(const value_type *_Ptr) const
Definition: vector:1595
void _Pop_back_n(size_type _Count)
Definition: vector:1526
pointer _Ufill(pointer _Ptr, size_type _Count, const value_type *_Pval)
Definition: vector:1757
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:732
#define _RERAISE
Definition: xstddef:74
void _Tidy()
Definition: vector:1635
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::shrink_to_fit ( )
inline
1122  { // reduce capacity
1123  if (_Has_unused_capacity())
1124  { // worth shrinking, do it
1125  if (empty())
1126  _Tidy();
1127  else
1128  _Reallocate(size());
1129  }
1130  }
void _Reallocate(size_type _Count)
Definition: vector:1600
size_type size() const _NOEXCEPT
Definition: vector:1178
size_type _Has_unused_capacity() const _NOEXCEPT
Definition: vector:1051
void _Tidy()
Definition: vector:1635
bool empty() const _NOEXCEPT
Definition: vector:1188
template<class _Ty, class _Alloc = allocator<_Ty>>
size_type vector< _Ty, _Alloc >::size ( ) const
inline
1179  { // return length of sequence
1180  return (this->_Mylast() - this->_Myfirst());
1181  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::swap ( _Myt _Right)
inline
1548  { // exchange contents with _Right
1549  if (this != &_Right)
1550  { // (maybe) swap allocators, swap control information
1551  _Pocs(this->_Getal(), _Right._Getal());
1552  this->_Swap_all(_Right);
1553  _Swap_adl(this->_Myfirst(), _Right._Myfirst());
1554  _Swap_adl(this->_Mylast(), _Right._Mylast());
1555  _Swap_adl(this->_Myend(), _Right._Myend());
1556  }
1557  }
void _Swap_all(_Myt &_Right)
Definition: vector:616
pointer & _Myend() _NOEXCEPT
Definition: vector:661
pointer & _Myfirst() _NOEXCEPT
Definition: vector:641
pointer & _Mylast() _NOEXCEPT
Definition: vector:651
void _Swap_adl(_Ty &_Left, _Ty &_Right) _NOEXCEPT_OP(_Is_nothrow_swappable< _Ty >
Definition: utility:56
_Alty & _Getal() _NOEXCEPT
Definition: vector:621
void _Pocs(_Alty &_Left, _Alty &_Right, true_type) _NOEXCEPT
Definition: xmemory0:1069
constexpr const _Ty &() _Right
Definition: algorithm:3591

The documentation for this class was generated from the following file: