STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private 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 _Ty value_type
 
typedef _Alloc allocator_type
 
typedef _Mybase::pointer pointer
 
typedef _Mybase::const_pointer const_pointer
 
typedef _Ty & reference
 
typedef const _Ty & const_reference
 
typedef _Mybase::size_type size_type
 
typedef _Mybase::difference_type difference_type
 
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::size_type size_type
 
typedef _Val_types::difference_type difference_type
 
typedef _Val_types::pointer pointer
 
typedef _Val_types::const_pointer const_pointer
 
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 (_CRT_GUARDOVERFLOW const size_type _Count, const _Alloc &_Al=_Alloc())
 
 vector (_CRT_GUARDOVERFLOW const size_type _Count, const _Ty &_Val, const _Alloc &_Al=_Alloc())
 
template<class _Iter , class = enable_if_t<_Is_iterator<_Iter>::value>>
 vector (_Iter _First, _Iter _Last, const _Alloc &_Al=_Alloc())
 
 vector (initializer_list< _Ty > _Ilist, const _Alloc &_Al=_Alloc())
 
 vector (const vector &_Right)
 
 vector (const vector &_Right, const _Alloc &_Al)
 
 vector (vector &&_Right) _NOEXCEPT
 
 vector (vector &&_Right, const _Alloc &_Al)
 
vectoroperator= (vector &&_Right) _NOEXCEPT_OP(_Alty
 
 ~vector () _NOEXCEPT
 
template<class... _Valty>
void emplace_back (_Valty &&..._Val)
 
void push_back (const _Ty &_Val)
 
void push_back (_Ty &&_Val)
 
template<class... _Valty>
iterator emplace (const_iterator _Where, _Valty &&..._Val)
 
iterator insert (const_iterator _Where, const _Ty &_Val)
 
iterator insert (const_iterator _Where, _Ty &&_Val)
 
iterator insert (const_iterator _Where, _CRT_GUARDOVERFLOW const size_type _Count, const _Ty &_Val)
 
template<class _Iter >
enable_if_t< _Is_iterator< _Iter >::value, iteratorinsert (const_iterator _Where, _Iter _First, _Iter _Last)
 
iterator insert (const_iterator _Where, initializer_list< _Ty > _Ilist)
 
void assign (_CRT_GUARDOVERFLOW const size_type _Newsize, const _Ty &_Val)
 
template<class _Iter >
enable_if_t< _Is_iterator< _Iter >::value, voidassign (_Iter _First, _Iter _Last)
 
void assign (initializer_list< _Ty > _Ilist)
 
vectoroperator= (const vector &_Right)
 
vectoroperator= (initializer_list< _Ty > _Ilist)
 
void resize (_CRT_GUARDOVERFLOW const size_type _Newsize)
 
void resize (_CRT_GUARDOVERFLOW const size_type _Newsize, const _Ty &_Val)
 
void reserve (_CRT_GUARDOVERFLOW const size_type _Newcapacity)
 
void shrink_to_fit ()
 
void pop_back ()
 
iterator erase (const_iterator _Where)
 
iterator erase (const_iterator _First, const_iterator _Last)
 
void clear () _NOEXCEPT
 
void swap (vector &_Right) _NOEXCEPT_OP(_Alty
 
_Ty * data () _NOEXCEPT
 
const _Ty * data () const _NOEXCEPT
 
iterator begin () _NOEXCEPT
 
const_iterator begin () const _NOEXCEPT
 
iterator end () _NOEXCEPT
 
const_iterator end () const _NOEXCEPT
 
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
 
bool empty () const _NOEXCEPT
 
size_type size () const _NOEXCEPT
 
size_type max_size () const _NOEXCEPT
 
size_type capacity () const _NOEXCEPT
 
_Ty & operator[] (const size_type _Pos)
 
const _Ty & operator[] (const size_type _Pos) const
 
_Ty & at (const size_type _Pos)
 
const _Ty & at (const size_type _Pos) const
 
_Ty & front ()
 
const _Ty & front () const
 
_Ty & back ()
 
const _Ty & back () const
 
_Alloc get_allocator () const _NOEXCEPT
 
- 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
 

Private Types

typedef _Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
 
typedef _Mybase::_Alty _Alty
 

Private Member Functions

template<class _Iter >
void _Range_construct_or_tidy (_Iter _First, _Iter _Last, input_iterator_tag)
 
template<class _Iter >
void _Range_construct_or_tidy (_Iter _First, _Iter _Last, forward_iterator_tag)
 
void _Move_from (vector &&_Right, true_type)
 
void _Move_from (vector &&_Right, false_type)
 
template<class... _Valty>
void _Emplace_back_with_unused_capacity (_Valty &&..._Val)
 
template<class _Iter >
void _Insert_range (const_iterator _Where, _Iter _First, _Iter _Last, input_iterator_tag)
 
template<class _Iter >
void _Insert_range (const_iterator _Where, _Iter _First, _Iter _Last, forward_iterator_tag)
 
template<class _Iter >
void _Assign_range (_Iter _First, _Iter _Last, input_iterator_tag)
 
template<class _Iter >
void _Assign_range (_Iter _First, _Iter _Last, forward_iterator_tag)
 
template<class _Lambda >
void _Resize (const size_type _Newsize, _Lambda _Udefault_or_fill)
 
void _Reallocate_exactly (const size_type _Newcapacity)
 
size_type _Unused_capacity () const _NOEXCEPT
 
bool _Has_unused_capacity () const _NOEXCEPT
 
pointer _Udefault (pointer _Dest, const size_type _Count)
 
pointer _Ufill (pointer _Dest, const size_type _Count, const _Ty &_Val)
 
template<class _Iter >
pointer _Ucopy (_Iter _First, _Iter _Last, pointer _Dest)
 
pointer _Umove (pointer _First, pointer _Last, pointer _Dest)
 
void _Umove_if_noexcept1 (pointer _First, pointer _Last, pointer _Dest, true_type)
 
void _Umove_if_noexcept1 (pointer _First, pointer _Last, pointer _Dest, false_type)
 
void _Umove_if_noexcept (pointer _First, pointer _Last, pointer _Dest)
 
void _Destroy (pointer _First, pointer _Last)
 
size_type _Calculate_growth (const size_type _Newsize) const
 
bool _Buy (const size_type _Newcapacity)
 
void _Change_array (const pointer _Newvec, const size_type _Newsize, const size_type _Newcapacity)
 
void _Tidy ()
 
void _Orphan_range (pointer, pointer) const
 

Static Private Member Functions

static void _Xlength ()
 
static void _Xrange ()
 

Member Typedef Documentation

template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Mybase::_Alty vector< _Ty, _Alloc >::_Alty
private
template<class _Ty, class _Alloc = allocator<_Ty>>
typedef _Vector_alloc<_Vec_base_types<_Ty, _Alloc> > vector< _Ty, _Alloc >::_Mybase
private
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 const _Ty& 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 _Ty& 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 _Ty vector< _Ty, _Alloc >::value_type

Constructor & Destructor Documentation

template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( )
inline
721  : _Mybase()
722  { // construct empty vector
723  }
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:703
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( const _Alloc _Al)
inlineexplicit
726  : _Mybase(_Al)
727  { // construct empty vector, allocator
728  }
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:703
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( _CRT_GUARDOVERFLOW const size_type  _Count,
const _Alloc _Al = _Alloc() 
)
inlineexplicit
731  : _Mybase(_Al)
732  { // construct from _Count * _Ty(), optional allocator
733  if (_Buy(_Count))
734  { // nonzero, fill it
735  _TRY_BEGIN
736  this->_Mylast() = _Udefault(this->_Myfirst(), _Count);
737  _CATCH_ALL
738  _Tidy();
739  _RERAISE;
740  _CATCH_END
741  }
742  }
#define _TRY_BEGIN
Definition: xstddef:26
pointer _Udefault(pointer _Dest, const size_type _Count)
Definition: vector:1846
#define _CATCH_END
Definition: xstddef:29
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
bool _Buy(const size_type _Newcapacity)
Definition: vector:1907
#define _CATCH_ALL
Definition: xstddef:28
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:703
_Diff _Count
Definition: algorithm:1941
#define _RERAISE
Definition: xstddef:32
void _Tidy()
Definition: vector:1945
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( _CRT_GUARDOVERFLOW const size_type  _Count,
const _Ty &  _Val,
const _Alloc _Al = _Alloc() 
)
inline
745  : _Mybase(_Al)
746  { // construct from _Count * _Val, optional allocator
747  if (_Buy(_Count))
748  { // nonzero, fill it
749  _TRY_BEGIN
750  this->_Mylast() = _Ufill(this->_Myfirst(), _Count, _Val);
751  _CATCH_ALL
752  _Tidy();
753  _RERAISE;
754  _CATCH_END
755  }
756  }
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
bool _Buy(const size_type _Newcapacity)
Definition: vector:1907
#define _CATCH_ALL
Definition: xstddef:28
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:703
_Diff _Count
Definition: algorithm:1941
pointer _Ufill(pointer _Dest, const size_type _Count, const _Ty &_Val)
Definition: vector:1851
#define _RERAISE
Definition: xstddef:32
_FwdIt const _Ty _Val
Definition: algorithm:1938
void _Tidy()
Definition: vector:1945
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter , class = enable_if_t<_Is_iterator<_Iter>::value>>
vector< _Ty, _Alloc >::vector ( _Iter  _First,
_Iter  _Last,
const _Alloc _Al = _Alloc() 
)
inline
791  : _Mybase(_Al)
792  { // construct from [_First, _Last) with optional allocator
793  _DEBUG_RANGE(_First, _Last);
795  }
#define _DEBUG_RANGE(first, last)
Definition: xutility:902
typename iterator_traits< _Iter >::iterator_category _Iter_cat_t
Definition: xutility:657
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:703
_Vector_const_iterator< _Myvec >::_Unchecked_type _Unchecked(_Vector_const_iterator< _Myvec > _Iter)
Definition: vector:261
void _Range_construct_or_tidy(_Iter _First, _Iter _Last, input_iterator_tag)
Definition: vector:760
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( initializer_list< _Ty >  _Ilist,
const _Alloc _Al = _Alloc() 
)
inline
798  : _Mybase(_Al)
799  { // construct from initializer_list, optional allocator
801  }
Definition: xutility:531
constexpr const _Elem * end() const _NOEXCEPT
Definition: initializer_list:44
constexpr const _Elem * begin() const _NOEXCEPT
Definition: initializer_list:39
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:703
void _Range_construct_or_tidy(_Iter _First, _Iter _Last, input_iterator_tag)
Definition: vector:760
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( const vector< _Ty, _Alloc > &  _Right)
inline
804  : _Mybase(_Right._Getal().select_on_container_copy_construction())
805  { // construct by copying _Right
806  if (_Buy(_Right.size()))
807  { // nonzero, fill it
808  _TRY_BEGIN
809  this->_Mylast() = _Ucopy(_Right._Myfirst(), _Right._Mylast(), this->_Myfirst());
810  _CATCH_ALL
811  _Tidy();
812  _RERAISE;
813  _CATCH_END
814  }
815  }
pointer _Ucopy(_Iter _First, _Iter _Last, pointer _Dest)
Definition: vector:1857
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
bool _Buy(const size_type _Newcapacity)
Definition: vector:1907
size_type size() const _NOEXCEPT
Definition: vector:1708
#define _CATCH_ALL
Definition: xstddef:28
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:703
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
#define _RERAISE
Definition: xstddef:32
void _Tidy()
Definition: vector:1945
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( const vector< _Ty, _Alloc > &  _Right,
const _Alloc _Al 
)
inline
818  : _Mybase(_Al)
819  { // construct by copying _Right, allocator
820  if (_Buy(_Right.size()))
821  { // nonzero, fill it
822  _TRY_BEGIN
823  this->_Mylast() = _Ucopy(_Right._Myfirst(), _Right._Mylast(), this->_Myfirst());
824  _CATCH_ALL
825  _Tidy();
826  _RERAISE;
827  _CATCH_END
828  }
829  }
pointer _Ucopy(_Iter _First, _Iter _Last, pointer _Dest)
Definition: vector:1857
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
bool _Buy(const size_type _Newcapacity)
Definition: vector:1907
size_type size() const _NOEXCEPT
Definition: vector:1708
#define _CATCH_ALL
Definition: xstddef:28
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:703
#define _RERAISE
Definition: xstddef:32
void _Tidy()
Definition: vector:1945
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( vector< _Ty, _Alloc > &&  _Right)
inline
859  : _Mybase(_STD move(_Right._Getal()))
860  { // construct by moving _Right
861  _Move_from(_STD move(_Right), true_type{});
862  }
Definition: xtr1common:23
void _Move_from(vector &&_Right, true_type)
Definition: vector:832
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:703
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::vector ( vector< _Ty, _Alloc > &&  _Right,
const _Alloc _Al 
)
inline
865  : _Mybase(_Al)
866  { // construct by moving _Right, allocator
867  _TRY_BEGIN
868  // performance note: partially unnecessary EH machinery for stateful allocators
869  _Move_from(_STD move(_Right), typename _Alty::is_always_equal{});
870  _CATCH_ALL
871  _Tidy();
872  _RERAISE;
873  _CATCH_END
874  }
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
void _Move_from(vector &&_Right, true_type)
Definition: vector:832
#define _CATCH_ALL
Definition: xstddef:28
_Vector_alloc< _Vec_base_types< _Ty, _Alloc > > _Mybase
Definition: vector:703
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
#define _RERAISE
Definition: xstddef:32
void _Tidy()
Definition: vector:1945
template<class _Ty, class _Alloc = allocator<_Ty>>
vector< _Ty, _Alloc >::~vector ( )
inline
891  { // destroy the object
892  _Tidy();
893  }
void _Tidy()
Definition: vector:1945

Member Function Documentation

template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Assign_range ( _Iter  _First,
_Iter  _Last,
input_iterator_tag   
)
inlineprivate
1329  { // assign [_First, _Last), input iterators
1330  this->_Orphan_all();
1331 
1332  pointer _Next = this->_Myfirst();
1333 
1334  for (; _First != _Last && _Next != this->_Mylast(); ++_First, (void)++_Next)
1335  {
1336  *_Next = *_First;
1337  }
1338 
1339  // Code size optimization: we've exhausted only the source, only the dest, or both.
1340  // If we've exhausted only the source: we Trim, then Append does nothing.
1341  // If we've exhausted only the dest: Trim does nothing, then we Append.
1342  // If we've exhausted both: Trim does nothing, then Append does nothing.
1343 
1344  // Trim.
1345  _Destroy(_Next, this->_Mylast());
1346  this->_Mylast() = _Next;
1347 
1348  // Append.
1349  for (; _First != _Last; ++_First)
1350  {
1351  emplace_back(*_First); // performance note: emplace_back()'s strong guarantee is unnecessary here
1352  }
1353  }
void _Orphan_all()
Definition: vector:619
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
void emplace_back(_Valty &&..._Val)
Definition: vector:907
_CRT_BEGIN_C_HEADER typedef void(__CRTDECL *terminate_handler)()
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1883
_Mybase::pointer pointer
Definition: vector:709
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Assign_range ( _Iter  _First,
_Iter  _Last,
forward_iterator_tag   
)
inlineprivate
1357  { // assign [_First, _Last), forward iterators
1358  const size_type _Newsize = _STD distance(_First, _Last);
1359 
1360  this->_Orphan_all();
1361 
1362  const size_type _Oldsize = size();
1363  const size_type _Oldcapacity = capacity();
1364 
1365  if (_Newsize > _Oldcapacity)
1366  { // reallocate
1367  if (_Newsize > max_size())
1368  {
1369  _Xlength();
1370  }
1371 
1372  const size_type _Newcapacity = _Calculate_growth(_Newsize);
1373 
1374  if (this->_Myfirst() != pointer())
1375  { // destroy and deallocate old array
1376  _Destroy(this->_Myfirst(), this->_Mylast());
1377  this->_Getal().deallocate(this->_Myfirst(), _Oldcapacity);
1378  }
1379 
1380  _Buy(_Newcapacity);
1381 
1382  this->_Mylast() = _Ucopy(_First, _Last, this->_Myfirst());
1383  }
1384  else if (_Newsize > _Oldsize)
1385  {
1386  const _Iter _Mid = _STD next(_First, _Oldsize); // performance note: traversing [_First, _Mid) twice
1387  _Copy_unchecked(_First, _Mid, this->_Myfirst());
1388  this->_Mylast() = _Ucopy(_Mid, _Last, this->_Mylast());
1389  }
1390  else
1391  {
1392  const pointer _Newlast = this->_Myfirst() + _Newsize;
1393  _Copy_unchecked(_First, _Last, this->_Myfirst());
1394  _Destroy(_Newlast, this->_Mylast());
1395  this->_Mylast() = _Newlast;
1396  }
1397  }
void _Orphan_all()
Definition: vector:619
pointer _Ucopy(_Iter _First, _Iter _Last, pointer _Dest)
Definition: vector:1857
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
size_type capacity() const _NOEXCEPT
Definition: vector:1718
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1111
bool _Buy(const size_type _Newcapacity)
Definition: vector:1907
size_type size() const _NOEXCEPT
Definition: vector:1708
size_type max_size() const _NOEXCEPT
Definition: vector:1713
static void _Xlength()
Definition: vector:1960
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Mybase::size_type size_type
Definition: vector:713
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1883
_InIt next(_InIt _First, _Iter_diff_t< _InIt > _Off=1)
Definition: xutility:1118
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_OutIt _Copy_unchecked(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2324
_Mybase::pointer pointer
Definition: vector:709
size_type _Calculate_growth(const size_type _Newsize) const
Definition: vector:1888
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
bool vector< _Ty, _Alloc >::_Buy ( const size_type  _Newcapacity)
inlineprivate
1908  { // allocate array with _Newcapacity elements
1909  this->_Myfirst() = pointer();
1910  this->_Mylast() = pointer();
1911  this->_Myend() = pointer();
1912 
1913  if (_Newcapacity == 0)
1914  {
1915  return (false);
1916  }
1917 
1918  if (_Newcapacity > max_size())
1919  {
1920  _Xlength();
1921  }
1922 
1923  this->_Myfirst() = this->_Getal().allocate(_Newcapacity);
1924  this->_Mylast() = this->_Myfirst();
1925  this->_Myend() = this->_Myfirst() + _Newcapacity;
1926 
1927  return (true);
1928  }
pointer & _Myend() _NOEXCEPT
Definition: vector:669
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
size_type max_size() const _NOEXCEPT
Definition: vector:1713
static void _Xlength()
Definition: vector:1960
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_Mybase::pointer pointer
Definition: vector:709
template<class _Ty, class _Alloc = allocator<_Ty>>
size_type vector< _Ty, _Alloc >::_Calculate_growth ( const size_type  _Newsize) const
inlineprivate
1889  { // given _Oldcapacity and _Newsize, calculate geometric growth
1890  const size_type _Oldcapacity = capacity();
1891 
1892  if (_Oldcapacity > max_size() - _Oldcapacity / 2)
1893  {
1894  return (_Newsize); // geometric growth would overflow
1895  }
1896 
1897  const size_type _Geometric = _Oldcapacity + _Oldcapacity / 2;
1898 
1899  if (_Geometric < _Newsize)
1900  {
1901  return (_Newsize); // geometric growth would be insufficient
1902  }
1903 
1904  return (_Geometric); // geometric growth is sufficient
1905  }
size_type capacity() const _NOEXCEPT
Definition: vector:1718
size_type max_size() const _NOEXCEPT
Definition: vector:1713
_Mybase::size_type size_type
Definition: vector:713
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Change_array ( const pointer  _Newvec,
const size_type  _Newsize,
const size_type  _Newcapacity 
)
inlineprivate
1931  { // orphan all iterators, discard old array, acquire new array
1932  this->_Orphan_all();
1933 
1934  if (this->_Myfirst() != pointer())
1935  { // destroy and deallocate old array
1936  _Destroy(this->_Myfirst(), this->_Mylast());
1937  this->_Getal().deallocate(this->_Myfirst(), this->_Myend() - this->_Myfirst());
1938  }
1939 
1940  this->_Myfirst() = _Newvec;
1941  this->_Mylast() = _Newvec + _Newsize;
1942  this->_Myend() = _Newvec + _Newcapacity;
1943  }
void _Orphan_all()
Definition: vector:619
pointer & _Myend() _NOEXCEPT
Definition: vector:669
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1883
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_Mybase::pointer pointer
Definition: vector:709
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Destroy ( pointer  _First,
pointer  _Last 
)
inlineprivate
1884  { // destroy [_First, _Last) using allocator
1885  _Destroy_range(_First, _Last, this->_Getal());
1886  }
void _Destroy_range(_Ptr _First, _Ptr _Last, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory0:1213
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class... _Valty>
void vector< _Ty, _Alloc >::_Emplace_back_with_unused_capacity ( _Valty &&...  _Val)
inlineprivate
898  { // insert by perfectly forwarding into element at end, provide strong guarantee
899  // Pre: _Has_unused_capacity()
900  this->_Getal().construct(_Unfancy(this->_Mylast()), _STD forward<_Valty>(_Val)...);
901  _Orphan_range(this->_Mylast(), this->_Mylast());
902  ++this->_Mylast();
903  }
void _Orphan_range(pointer, pointer) const
Definition: vector:1994
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:635
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty, class _Alloc = allocator<_Ty>>
bool vector< _Ty, _Alloc >::_Has_unused_capacity ( ) const
inlineprivate
1730  { // micro-optimization for capacity() != size()
1731  return (this->_Myend() != this->_Mylast());
1732  }
pointer & _Myend() _NOEXCEPT
Definition: vector:669
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Insert_range ( const_iterator  _Where,
_Iter  _First,
_Iter  _Last,
input_iterator_tag   
)
inlineprivate
1123  { // insert [_First, _Last) at _Where, input iterators
1124  if (_First == _Last)
1125  {
1126  return; // nothing to do, avoid invalidating iterators
1127  }
1128 
1129  const size_type _Whereoff = _Where._Ptr - this->_Myfirst();
1130  const size_type _Oldsize = size();
1131 
1132  // For one-at-back, provide strong guarantee.
1133  // Otherwise, provide basic guarantee (despite N4606 23.3.11.5 [vector.modifiers]/1).
1134  // Performance note: except for one-at-back, emplace_back()'s strong guarantee is unnecessary here.
1135 
1136  for (; _First != _Last; ++_First)
1137  {
1138  emplace_back(*_First);
1139  }
1140 
1141  _Orphan_range(this->_Myfirst() + _Whereoff, this->_Myfirst() + _Oldsize);
1142 
1143  _Rotate_unchecked(this->_Myfirst() + _Whereoff, this->_Myfirst() + _Oldsize, this->_Mylast());
1144  }
_FwdIt _Rotate_unchecked(_FwdIt _First, _FwdIt _Mid, _FwdIt _Last)
Definition: xutility:3496
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
size_type size() const _NOEXCEPT
Definition: vector:1708
void emplace_back(_Valty &&..._Val)
Definition: vector:907
void _Orphan_range(pointer, pointer) const
Definition: vector:1994
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Mybase::size_type size_type
Definition: vector:713
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Insert_range ( const_iterator  _Where,
_Iter  _First,
_Iter  _Last,
forward_iterator_tag   
)
inlineprivate
1148  { // insert [_First, _Last) at _Where, forward iterators
1149  const size_type _Count = _STD distance(_First, _Last);
1150  const size_type _Whereoff = _Where._Ptr - this->_Myfirst();
1151  const bool _One_at_back = _Count == 1 && _Where._Ptr == this->_Mylast();
1152 
1153  if (_Count == 0)
1154  { // nothing to do, avoid invalidating iterators
1155  }
1156  else if (_Count > _Unused_capacity())
1157  { // reallocate
1158  const size_type _Oldsize = size();
1159 
1160  if (_Count > max_size() - _Oldsize)
1161  {
1162  _Xlength();
1163  }
1164 
1165  const size_type _Newsize = _Oldsize + _Count;
1166  const size_type _Newcapacity = _Calculate_growth(_Newsize);
1167 
1168  const pointer _Newvec = this->_Getal().allocate(_Newcapacity);
1169  const pointer _Constructed_last = _Newvec + _Whereoff + _Count;
1170  pointer _Constructed_first = _Constructed_last;
1171 
1172  _TRY_BEGIN
1173  _Ucopy(_First, _Last, _Newvec + _Whereoff);
1174  _Constructed_first = _Newvec + _Whereoff;
1175 
1176  if (_One_at_back)
1177  { // provide strong guarantee
1178  _Umove_if_noexcept(this->_Myfirst(), this->_Mylast(), _Newvec);
1179  }
1180  else
1181  { // provide basic guarantee
1182  _Umove(this->_Myfirst(), _Where._Ptr, _Newvec);
1183  _Constructed_first = _Newvec;
1184  _Umove(_Where._Ptr, this->_Mylast(), _Newvec + _Whereoff + _Count);
1185  }
1186  _CATCH_ALL
1187  _Destroy(_Constructed_first, _Constructed_last);
1188  this->_Getal().deallocate(_Newvec, _Newcapacity);
1189  _RERAISE;
1190  _CATCH_END
1191 
1192  _Change_array(_Newvec, _Newsize, _Newcapacity);
1193  }
1194  else
1195  { // Attempt to provide the strong guarantee for EmplaceConstructible failure.
1196  // If we encounter copy/move construction/assignment failure, provide the basic guarantee.
1197  // (For one-at-back, this provides the strong guarantee.)
1198 
1199  const pointer _Oldlast = this->_Mylast();
1200  const size_type _Affected_elements = _Oldlast - _Where._Ptr;
1201 
1202  if (_Count < _Affected_elements)
1203  { // some affected elements must be assigned
1204  this->_Mylast() = _Umove(_Oldlast - _Count, _Oldlast, _Oldlast);
1205  _Move_backward_unchecked(_Where._Ptr, _Oldlast - _Count, _Oldlast);
1206  _Destroy(_Where._Ptr, _Where._Ptr + _Count);
1207 
1208  _TRY_BEGIN
1209  _Ucopy(_First, _Last, _Where._Ptr);
1210  _CATCH_ALL
1211  // glue the broken pieces back together
1212 
1213  _TRY_BEGIN
1214  _Umove(_Where._Ptr + _Count, _Where._Ptr + 2 * _Count, _Where._Ptr);
1215  _CATCH_ALL
1216  // vaporize the detached piece
1217  _Orphan_range(_Where._Ptr, _Oldlast);
1218  _Destroy(_Where._Ptr + _Count, this->_Mylast());
1219  this->_Mylast() = _Where._Ptr;
1220  _RERAISE;
1221  _CATCH_END
1222 
1223  _Move_unchecked(_Where._Ptr + 2 * _Count, this->_Mylast(), _Where._Ptr + _Count);
1224  _Destroy(_Oldlast, this->_Mylast());
1225  this->_Mylast() = _Oldlast;
1226  _RERAISE;
1227  _CATCH_END
1228  }
1229  else
1230  { // affected elements don't overlap before/after
1231  const pointer _Relocated = _Where._Ptr + _Count;
1232  this->_Mylast() = _Umove(_Where._Ptr, _Oldlast, _Relocated);
1233  _Destroy(_Where._Ptr, _Oldlast);
1234 
1235  _TRY_BEGIN
1236  _Ucopy(_First, _Last, _Where._Ptr);
1237  _CATCH_ALL
1238  // glue the broken pieces back together
1239 
1240  _TRY_BEGIN
1241  _Umove(_Relocated, this->_Mylast(), _Where._Ptr);
1242  _CATCH_ALL
1243  // vaporize the detached piece
1244  _Orphan_range(_Where._Ptr, _Oldlast);
1245  _Destroy(_Relocated, this->_Mylast());
1246  this->_Mylast() = _Where._Ptr;
1247  _RERAISE;
1248  _CATCH_END
1249 
1250  _Destroy(_Relocated, this->_Mylast());
1251  this->_Mylast() = _Oldlast;
1252  _RERAISE;
1253  _CATCH_END
1254  }
1255 
1256  _Orphan_range(_Where._Ptr, _Oldlast);
1257  }
1258  }
void _Change_array(const pointer _Newvec, const size_type _Newsize, const size_type _Newcapacity)
Definition: vector:1930
pointer _Ucopy(_Iter _First, _Iter _Last, pointer _Dest)
Definition: vector:1857
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
_OutIt _Move_unchecked(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2548
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1111
size_type size() const _NOEXCEPT
Definition: vector:1708
return * this
Definition: variant:950
size_type max_size() const _NOEXCEPT
Definition: vector:1713
static void _Xlength()
Definition: vector:1960
void _Orphan_range(pointer, pointer) const
Definition: vector:1994
#define _CATCH_ALL
Definition: xstddef:28
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_BidIt2 _Move_backward_unchecked(_BidIt1 _First, _BidIt1 _Last, _BidIt2 _Dest)
Definition: xutility:2613
_Mybase::size_type size_type
Definition: vector:713
size_type _Unused_capacity() const _NOEXCEPT
Definition: vector:1724
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1883
_Diff _Count
Definition: algorithm:1941
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_Mybase::pointer pointer
Definition: vector:709
#define _RERAISE
Definition: xstddef:32
size_type _Calculate_growth(const size_type _Newsize) const
Definition: vector:1888
_FwdIt _Last
Definition: algorithm:1936
void _Umove_if_noexcept(pointer _First, pointer _Last, pointer _Dest)
Definition: vector:1877
pointer _Umove(pointer _First, pointer _Last, pointer _Dest)
Definition: vector:1862
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Move_from ( vector< _Ty, _Alloc > &&  _Right,
true_type   
)
inlineprivate
833  { // move from _Right, stealing its contents
834  this->_Swap_all(_Right);
835 
836  this->_Myfirst() = _Right._Myfirst();
837  this->_Mylast() = _Right._Mylast();
838  this->_Myend() = _Right._Myend();
839 
840  _Right._Myfirst() = pointer();
841  _Right._Mylast() = pointer();
842  _Right._Myend() = pointer();
843  }
void _Swap_all(_Myt &_Right)
Definition: vector:624
pointer & _Myend() _NOEXCEPT
Definition: vector:669
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Mybase::pointer pointer
Definition: vector:709
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Move_from ( vector< _Ty, _Alloc > &&  _Right,
false_type   
)
inlineprivate
846  { // move from _Right, possibly moving its contents
847  if (this->_Getal() == _Right._Getal())
848  {
849  _Move_from(_STD move(_Right), true_type{});
850  }
851  else if (_Buy(_Right.size()))
852  { // nonzero, fill it
853  this->_Mylast() = _Umove(_Right._Myfirst(), _Right._Mylast(), this->_Myfirst());
854  }
855  }
Definition: xtr1common:23
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
void _Move_from(vector &&_Right, true_type)
Definition: vector:832
bool _Buy(const size_type _Newcapacity)
Definition: vector:1907
size_type size() const _NOEXCEPT
Definition: vector:1708
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
pointer _Umove(pointer _First, pointer _Last, pointer _Dest)
Definition: vector:1862
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Orphan_range ( pointer  ,
pointer   
) const
inlineprivate
1995  { // orphan iterators within specified (inclusive) range
1996  }
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Range_construct_or_tidy ( _Iter  _First,
_Iter  _Last,
input_iterator_tag   
)
inlineprivate
761  { // initialize with [_First, _Last), avoid leaking, input iterators
762  _TRY_BEGIN
763  for (; _First != _Last; ++_First)
764  {
765  emplace_back(*_First); // performance note: emplace_back()'s strong guarantee is unnecessary here
766  }
767  _CATCH_ALL
768  _Tidy();
769  _RERAISE;
770  _CATCH_END
771  }
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
void emplace_back(_Valty &&..._Val)
Definition: vector:907
#define _CATCH_ALL
Definition: xstddef:28
#define _RERAISE
Definition: xstddef:32
void _Tidy()
Definition: vector:1945
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
void vector< _Ty, _Alloc >::_Range_construct_or_tidy ( _Iter  _First,
_Iter  _Last,
forward_iterator_tag   
)
inlineprivate
775  { // initialize with [_First, _Last), avoid leaking, forward iterators
776  if (_Buy(_STD distance(_First, _Last)))
777  { // nonzero, fill it
778  _TRY_BEGIN
779  this->_Mylast() = _Ucopy(_First, _Last, this->_Myfirst());
780  _CATCH_ALL
781  _Tidy();
782  _RERAISE;
783  _CATCH_END
784  }
785  }
pointer _Ucopy(_Iter _First, _Iter _Last, pointer _Dest)
Definition: vector:1857
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
_Iter_diff_t< _InIt > distance(_InIt _First, _InIt _Last)
Definition: xutility:1111
bool _Buy(const size_type _Newcapacity)
Definition: vector:1907
#define _CATCH_ALL
Definition: xstddef:28
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
#define _RERAISE
Definition: xstddef:32
void _Tidy()
Definition: vector:1945
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Reallocate_exactly ( const size_type  _Newcapacity)
inlineprivate
1511  { // set capacity to _Newcapacity (without geometric growth), provide strong guarantee
1512  const size_type _Size = size();
1513 
1514  const pointer _Newvec = this->_Getal().allocate(_Newcapacity);
1515 
1516  _TRY_BEGIN
1517  _Umove_if_noexcept(this->_Myfirst(), this->_Mylast(), _Newvec);
1518  _CATCH_ALL
1519  this->_Getal().deallocate(_Newvec, _Newcapacity);
1520  _RERAISE;
1521  _CATCH_END
1522 
1523  _Change_array(_Newvec, _Size, _Newcapacity);
1524  }
void _Change_array(const pointer _Newvec, const size_type _Newsize, const size_type _Newcapacity)
Definition: vector:1930
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
_CRT_BEGIN_C_HEADER _Check_return_ _Ret_maybenull_ _In_ size_t _Size
Definition: corecrt_malloc.h:58
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
size_type size() const _NOEXCEPT
Definition: vector:1708
#define _CATCH_ALL
Definition: xstddef:28
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Mybase::size_type size_type
Definition: vector:713
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_Mybase::pointer pointer
Definition: vector:709
#define _RERAISE
Definition: xstddef:32
void _Umove_if_noexcept(pointer _First, pointer _Last, pointer _Dest)
Definition: vector:1877
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Lambda >
void vector< _Ty, _Alloc >::_Resize ( const size_type  _Newsize,
_Lambda  _Udefault_or_fill 
)
inlineprivate
1442  { // trim or append elements, provide strong guarantee
1443  const size_type _Oldsize = size();
1444  const size_type _Oldcapacity = capacity();
1445 
1446  if (_Newsize > _Oldcapacity)
1447  { // reallocate
1448  if (_Newsize > max_size())
1449  {
1450  _Xlength();
1451  }
1452 
1453  const size_type _Newcapacity = _Calculate_growth(_Newsize);
1454 
1455  const pointer _Newvec = this->_Getal().allocate(_Newcapacity);
1456  const pointer _Appended_first = _Newvec + _Oldsize;
1457  pointer _Appended_last = _Appended_first;
1458 
1459  _TRY_BEGIN
1460  _Appended_last = _Udefault_or_fill(_Appended_first, _Newsize - _Oldsize);
1461  _Umove_if_noexcept(this->_Myfirst(), this->_Mylast(), _Newvec);
1462  _CATCH_ALL
1463  _Destroy(_Appended_first, _Appended_last);
1464  this->_Getal().deallocate(_Newvec, _Newcapacity);
1465  _RERAISE;
1466  _CATCH_END
1467 
1468  _Change_array(_Newvec, _Newsize, _Newcapacity);
1469  }
1470  else if (_Newsize > _Oldsize)
1471  { // append
1472  const pointer _Oldlast = this->_Mylast();
1473  this->_Mylast() = _Udefault_or_fill(_Oldlast, _Newsize - _Oldsize);
1474  _Orphan_range(_Oldlast, _Oldlast);
1475  }
1476  else if (_Newsize == _Oldsize)
1477  { // nothing to do, avoid invalidating iterators
1478  }
1479  else
1480  { // trim
1481  const pointer _Newlast = this->_Myfirst() + _Newsize;
1482  _Orphan_range(_Newlast, this->_Mylast());
1483  _Destroy(_Newlast, this->_Mylast());
1484  this->_Mylast() = _Newlast;
1485  }
1486  }
void _Change_array(const pointer _Newvec, const size_type _Newsize, const size_type _Newcapacity)
Definition: vector:1930
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
size_type capacity() const _NOEXCEPT
Definition: vector:1718
size_type size() const _NOEXCEPT
Definition: vector:1708
size_type max_size() const _NOEXCEPT
Definition: vector:1713
static void _Xlength()
Definition: vector:1960
void _Orphan_range(pointer, pointer) const
Definition: vector:1994
#define _CATCH_ALL
Definition: xstddef:28
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Mybase::size_type size_type
Definition: vector:713
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1883
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_Mybase::pointer pointer
Definition: vector:709
#define _RERAISE
Definition: xstddef:32
size_type _Calculate_growth(const size_type _Newsize) const
Definition: vector:1888
void _Umove_if_noexcept(pointer _First, pointer _Last, pointer _Dest)
Definition: vector:1877
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Tidy ( )
inlineprivate
1946  { // free all storage
1947  this->_Orphan_all();
1948 
1949  if (this->_Myfirst() != pointer())
1950  { // destroy and deallocate old array
1951  _Destroy(this->_Myfirst(), this->_Mylast());
1952  this->_Getal().deallocate(this->_Myfirst(), this->_Myend() - this->_Myfirst());
1953 
1954  this->_Myfirst() = pointer();
1955  this->_Mylast() = pointer();
1956  this->_Myend() = pointer();
1957  }
1958  }
void _Orphan_all()
Definition: vector:619
pointer & _Myend() _NOEXCEPT
Definition: vector:669
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1883
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_Mybase::pointer pointer
Definition: vector:709
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
pointer vector< _Ty, _Alloc >::_Ucopy ( _Iter  _First,
_Iter  _Last,
pointer  _Dest 
)
inlineprivate
1858  { // copy [_First, _Last) to raw _Dest, using allocator
1859  return (_Uninitialized_copy(_First, _Last, _Dest, this->_Getal()));
1860  }
unsigned _Dest
Definition: mbstring.h:107
_FwdIt _Uninitialized_copy(_InIt _First, _InIt _Last, _FwdIt _Dest, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory:115
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
pointer vector< _Ty, _Alloc >::_Udefault ( pointer  _Dest,
const size_type  _Count 
)
inlineprivate
1847  { // fill raw _Dest with _Count value-initialized objects, using allocator
1848  return (_Uninitialized_default_fill_n(_Dest, _Count, this->_Getal()));
1849  }
unsigned _Dest
Definition: mbstring.h:107
_FwdIt _Uninitialized_default_fill_n(_FwdIt _First, _Diff _Count, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory:258
_Diff _Count
Definition: algorithm:1941
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
template<class _Ty, class _Alloc = allocator<_Ty>>
pointer vector< _Ty, _Alloc >::_Ufill ( pointer  _Dest,
const size_type  _Count,
const _Ty &  _Val 
)
inlineprivate
1852  { // fill raw _Dest with _Count copies of _Val, using allocator
1853  return (_Uninitialized_fill_n(_Dest, _Count, _Val, this->_Getal()));
1854  }
unsigned _Dest
Definition: mbstring.h:107
_Diff _Count
Definition: algorithm:1941
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_FwdIt _Uninitialized_fill_n(_FwdIt _First, _Diff _Count, const _Iter_value_t< _FwdIt > &_Val, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory:214
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty, class _Alloc = allocator<_Ty>>
pointer vector< _Ty, _Alloc >::_Umove ( pointer  _First,
pointer  _Last,
pointer  _Dest 
)
inlineprivate
1863  { // move [_First, _Last) to raw _Dest, using allocator
1864  return (_Uninitialized_move(_First, _Last, _Dest, this->_Getal()));
1865  }
unsigned _Dest
Definition: mbstring.h:107
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_FwdIt _Uninitialized_move(_InIt _First, _InIt _Last, _FwdIt _Dest, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory:164
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Umove_if_noexcept ( pointer  _First,
pointer  _Last,
pointer  _Dest 
)
inlineprivate
1878  { // move_if_noexcept [_First, _Last) to raw _Dest, using allocator
1879  _Umove_if_noexcept1(_First, _Last, _Dest,
1881  }
unsigned _Dest
Definition: mbstring.h:107
Definition: type_traits:1171
Definition: type_traits:561
Definition: type_traits:732
typename disjunction< _Traits...>::type _Disjunction_t
Definition: type_traits:1167
_FwdIt _Last
Definition: algorithm:1936
void _Umove_if_noexcept1(pointer _First, pointer _Last, pointer _Dest, true_type)
Definition: vector:1867
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Umove_if_noexcept1 ( pointer  _First,
pointer  _Last,
pointer  _Dest,
true_type   
)
inlineprivate
1868  { // move [_First, _Last) to raw _Dest, using allocator
1869  _Uninitialized_move(_First, _Last, _Dest, this->_Getal());
1870  }
unsigned _Dest
Definition: mbstring.h:107
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_FwdIt _Uninitialized_move(_InIt _First, _InIt _Last, _FwdIt _Dest, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory:164
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::_Umove_if_noexcept1 ( pointer  _First,
pointer  _Last,
pointer  _Dest,
false_type   
)
inlineprivate
1873  { // copy [_First, _Last) to raw _Dest, using allocator
1874  _Uninitialized_copy(_First, _Last, _Dest, this->_Getal());
1875  }
unsigned _Dest
Definition: mbstring.h:107
_FwdIt _Uninitialized_copy(_InIt _First, _InIt _Last, _FwdIt _Dest, _Wrap_alloc< _Alloc > &_Al)
Definition: xmemory:115
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
size_type vector< _Ty, _Alloc >::_Unused_capacity ( ) const
inlineprivate
1725  { // micro-optimization for capacity() - size()
1726  return (this->_Myend() - this->_Mylast());
1727  }
pointer & _Myend() _NOEXCEPT
Definition: vector:669
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
template<class _Ty, class _Alloc = allocator<_Ty>>
static void vector< _Ty, _Alloc >::_Xlength ( )
inlinestaticprivate
1961  { // report a length_error
1962  _Xlength_error("vector<T> too long");
1963  }
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Xlength_error(_In_z_ const char *)
template<class _Ty, class _Alloc = allocator<_Ty>>
static void vector< _Ty, _Alloc >::_Xrange ( )
inlinestaticprivate
1966  { // report an out_of_range error
1967  _Xout_of_range("invalid vector<T> subscript");
1968  }
_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 ( _CRT_GUARDOVERFLOW const size_type  _Newsize,
const _Ty &  _Val 
)
inline
1287  { // assign _Newsize * _Val
1288  this->_Orphan_all();
1289 
1290  const size_type _Oldsize = size();
1291  const size_type _Oldcapacity = capacity();
1292 
1293  if (_Newsize > _Oldcapacity)
1294  { // reallocate
1295  if (_Newsize > max_size())
1296  {
1297  _Xlength();
1298  }
1299 
1300  const size_type _Newcapacity = _Calculate_growth(_Newsize);
1301 
1302  if (this->_Myfirst() != pointer())
1303  { // destroy and deallocate old array
1304  _Destroy(this->_Myfirst(), this->_Mylast());
1305  this->_Getal().deallocate(this->_Myfirst(), _Oldcapacity);
1306  }
1307 
1308  _Buy(_Newcapacity);
1309 
1310  this->_Mylast() = _Ufill(this->_Myfirst(), _Newsize, _Val);
1311  }
1312  else if (_Newsize > _Oldsize)
1313  {
1314  _Fill_unchecked(this->_Myfirst(), this->_Mylast(), _Val);
1315  this->_Mylast() = _Ufill(this->_Mylast(), _Newsize - _Oldsize, _Val);
1316  }
1317  else
1318  {
1319  const pointer _Newlast = this->_Myfirst() + _Newsize;
1320  _Fill_unchecked(this->_Myfirst(), _Newlast, _Val);
1321  _Destroy(_Newlast, this->_Mylast());
1322  this->_Mylast() = _Newlast;
1323  }
1324  }
void _Orphan_all()
Definition: vector:619
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
size_type capacity() const _NOEXCEPT
Definition: vector:1718
bool _Buy(const size_type _Newcapacity)
Definition: vector:1907
size_type size() const _NOEXCEPT
Definition: vector:1708
size_type max_size() const _NOEXCEPT
Definition: vector:1713
static void _Xlength()
Definition: vector:1960
void _Fill_unchecked(_FwdIt _First, _FwdIt _Last, const _Ty &_Val)
Definition: xutility:2702
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Mybase::size_type size_type
Definition: vector:713
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1883
pointer _Ufill(pointer _Dest, const size_type _Count, const _Ty &_Val)
Definition: vector:1851
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_Mybase::pointer pointer
Definition: vector:709
_FwdIt const _Ty _Val
Definition: algorithm:1938
size_type _Calculate_growth(const size_type _Newsize) const
Definition: vector:1888
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
enable_if_t<_Is_iterator<_Iter>::value, void> vector< _Ty, _Alloc >::assign ( _Iter  _First,
_Iter  _Last 
)
inline
1403  { // assign [_First, _Last)
1404  _DEBUG_RANGE(_First, _Last);
1406  }
#define _DEBUG_RANGE(first, last)
Definition: xutility:902
typename iterator_traits< _Iter >::iterator_category _Iter_cat_t
Definition: xutility:657
void _Assign_range(_Iter _First, _Iter _Last, input_iterator_tag)
Definition: vector:1328
_Vector_const_iterator< _Myvec >::_Unchecked_type _Unchecked(_Vector_const_iterator< _Myvec > _Iter)
Definition: vector:261
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::assign ( initializer_list< _Ty >  _Ilist)
inline
1409  { // assign initializer_list
1410  _Assign_range(_Ilist.begin(), _Ilist.end(), random_access_iterator_tag{});
1411  }
Definition: xutility:531
constexpr const _Elem * end() const _NOEXCEPT
Definition: initializer_list:44
void _Assign_range(_Iter _First, _Iter _Last, input_iterator_tag)
Definition: vector:1328
constexpr const _Elem * begin() const _NOEXCEPT
Definition: initializer_list:39
template<class _Ty, class _Alloc = allocator<_Ty>>
_Ty& vector< _Ty, _Alloc >::at ( const size_type  _Pos)
inline
1764  { // subscript mutable sequence with checking
1765  if (size() <= _Pos)
1766  {
1767  _Xrange();
1768  }
1769 
1770  return (this->_Myfirst()[_Pos]);
1771  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
size_type size() const _NOEXCEPT
Definition: vector:1708
static void _Xrange()
Definition: vector:1965
template<class _Ty, class _Alloc = allocator<_Ty>>
const _Ty& vector< _Ty, _Alloc >::at ( const size_type  _Pos) const
inline
1774  { // subscript nonmutable sequence with checking
1775  if (size() <= _Pos)
1776  {
1777  _Xrange();
1778  }
1779 
1780  return (this->_Myfirst()[_Pos]);
1781  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
size_type size() const _NOEXCEPT
Definition: vector:1708
static void _Xrange()
Definition: vector:1965
template<class _Ty, class _Alloc = allocator<_Ty>>
_Ty& vector< _Ty, _Alloc >::back ( )
inline
1812  { // return last element of mutable sequence
1813  #if _ITERATOR_DEBUG_LEVEL == 2
1814  if (empty())
1815  { // report error
1816  _DEBUG_ERROR("back() called on empty vector");
1817  }
1818  #elif _ITERATOR_DEBUG_LEVEL == 1
1820  #endif /* _ITERATOR_DEBUG_LEVEL */
1821 
1822  return (this->_Mylast()[-1]);
1823  }
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
#define _SCL_SECURE_VALIDATE_RANGE(cond)
Definition: yvals.h:432
#define _DEBUG_ERROR(mesg)
Definition: xutility:33
bool empty() const _NOEXCEPT
Definition: vector:1703
template<class _Ty, class _Alloc = allocator<_Ty>>
const _Ty& vector< _Ty, _Alloc >::back ( ) const
inline
1826  { // return last element of nonmutable sequence
1827  #if _ITERATOR_DEBUG_LEVEL == 2
1828  if (empty())
1829  { // report error
1830  _DEBUG_ERROR("back() called on empty vector");
1831  }
1832  #elif _ITERATOR_DEBUG_LEVEL == 1
1834  #endif /* _ITERATOR_DEBUG_LEVEL */
1835 
1836  return (this->_Mylast()[-1]);
1837  }
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
#define _SCL_SECURE_VALIDATE_RANGE(cond)
Definition: yvals.h:432
#define _DEBUG_ERROR(mesg)
Definition: xutility:33
bool empty() const _NOEXCEPT
Definition: vector:1703
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::begin ( )
inline
1644  { // return iterator for beginning of mutable sequence
1645  return (iterator(this->_Myfirst(), _STD addressof(this->_Get_data())));
1646  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:639
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
_Mybase::iterator iterator
Definition: vector:715
template<class _Ty, class _Alloc = allocator<_Ty>>
const_iterator vector< _Ty, _Alloc >::begin ( ) const
inline
1649  { // return iterator for beginning of nonmutable sequence
1650  return (const_iterator(this->_Myfirst(), _STD addressof(this->_Get_data())));
1651  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:639
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
_Mybase::const_iterator const_iterator
Definition: vector:716
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
template<class _Ty, class _Alloc = allocator<_Ty>>
size_type vector< _Ty, _Alloc >::capacity ( ) const
inline
1719  { // return current length of allocated storage
1720  return (this->_Myend() - this->_Myfirst());
1721  }
pointer & _Myend() _NOEXCEPT
Definition: vector:669
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
template<class _Ty, class _Alloc = allocator<_Ty>>
const_iterator vector< _Ty, _Alloc >::cbegin ( ) const
inline
1684  { // return iterator for beginning of nonmutable sequence
1685  return (begin());
1686  }
iterator begin() _NOEXCEPT
Definition: vector:1643
template<class _Ty, class _Alloc = allocator<_Ty>>
const_iterator vector< _Ty, _Alloc >::cend ( ) const
inline
1689  { // return iterator for end of nonmutable sequence
1690  return (end());
1691  }
iterator end() _NOEXCEPT
Definition: vector:1653
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::clear ( )
inline
1614  { // erase all
1615  this->_Orphan_all();
1616  _Destroy(this->_Myfirst(), this->_Mylast());
1617  this->_Mylast() = this->_Myfirst();
1618  }
void _Orphan_all()
Definition: vector:619
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1883
template<class _Ty, class _Alloc = allocator<_Ty>>
const_reverse_iterator vector< _Ty, _Alloc >::crbegin ( ) const
inline
1694  { // return iterator for beginning of reversed nonmutable sequence
1695  return (rbegin());
1696  }
reverse_iterator rbegin() _NOEXCEPT
Definition: vector:1663
template<class _Ty, class _Alloc = allocator<_Ty>>
const_reverse_iterator vector< _Ty, _Alloc >::crend ( ) const
inline
1699  { // return iterator for end of reversed nonmutable sequence
1700  return (rend());
1701  }
reverse_iterator rend() _NOEXCEPT
Definition: vector:1673
template<class _Ty, class _Alloc = allocator<_Ty>>
_Ty* vector< _Ty, _Alloc >::data ( )
inline
1634  { // return address of first element
1635  return (_Unfancy_maybe_null(this->_Myfirst()));
1636  }
auto _Unfancy_maybe_null(_Ptrty _Ptr)
Definition: vector:685
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
template<class _Ty, class _Alloc = allocator<_Ty>>
const _Ty* vector< _Ty, _Alloc >::data ( ) const
inline
1639  { // return address of first element
1640  return (_Unfancy_maybe_null(this->_Myfirst()));
1641  }
auto _Unfancy_maybe_null(_Ptrty _Ptr)
Definition: vector:685
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class... _Valty>
iterator vector< _Ty, _Alloc >::emplace ( const_iterator  _Where,
_Valty &&...  _Val 
)
inline
957  { // insert by perfectly forwarding _Val at _Where
958  #if _ITERATOR_DEBUG_LEVEL == 2
959  if (_Where._Getcont() != _STD addressof(this->_Get_data())
960  || _Where._Ptr < this->_Myfirst()
961  || this->_Mylast() < _Where._Ptr)
962  {
963  _DEBUG_ERROR("vector emplace iterator outside range");
964  }
965  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
966 
967  const size_type _Whereoff = _Where._Ptr - this->_Myfirst();
968  const bool _At_back = _Where._Ptr == this->_Mylast();
969 
970  if (!_Has_unused_capacity())
971  { // reallocate
972  const size_type _Oldsize = size();
973 
974  if (_Oldsize == max_size())
975  {
976  _Xlength();
977  }
978 
979  const size_type _Newsize = _Oldsize + 1;
980  const size_type _Newcapacity = _Calculate_growth(_Newsize);
981 
982  const pointer _Newvec = this->_Getal().allocate(_Newcapacity);
983  const pointer _Constructed_last = _Newvec + _Whereoff + 1;
984  pointer _Constructed_first = _Constructed_last;
985 
986  _TRY_BEGIN
987  this->_Getal().construct(_Unfancy(_Newvec + _Whereoff), _STD forward<_Valty>(_Val)...);
988  _Constructed_first = _Newvec + _Whereoff;
989 
990  if (_At_back)
991  { // provide strong guarantee
992  _Umove_if_noexcept(this->_Myfirst(), this->_Mylast(), _Newvec);
993  }
994  else
995  { // provide basic guarantee
996  _Umove(this->_Myfirst(), _Where._Ptr, _Newvec);
997  _Constructed_first = _Newvec;
998  _Umove(_Where._Ptr, this->_Mylast(), _Newvec + _Whereoff + 1);
999  }
1000  _CATCH_ALL
1001  _Destroy(_Constructed_first, _Constructed_last);
1002  this->_Getal().deallocate(_Newvec, _Newcapacity);
1003  _RERAISE;
1004  _CATCH_END
1005 
1006  _Change_array(_Newvec, _Newsize, _Newcapacity);
1007  }
1008  else if (_At_back)
1009  { // provide strong guarantee
1010  _Emplace_back_with_unused_capacity(_STD forward<_Valty>(_Val)...);
1011  }
1012  else
1013  {
1014  _Ty _Obj(_STD forward<_Valty>(_Val)...); // handle aliasing
1015  // after constructing _Obj, provide basic guarantee
1016  const pointer _Oldlast = this->_Mylast();
1017  _Orphan_range(_Where._Ptr, _Oldlast);
1018  this->_Getal().construct(_Unfancy(_Oldlast), _STD move(_Oldlast[-1]));
1019  ++this->_Mylast();
1020  _Move_backward_unchecked(_Where._Ptr, _Oldlast - 1, _Oldlast);
1021  *_Where._Ptr = _STD move(_Obj);
1022  }
1023 
1024  return (begin() + _Whereoff);
1025  }
void _Change_array(const pointer _Newvec, const size_type _Newsize, const size_type _Newcapacity)
Definition: vector:1930
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:639
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
bool _Has_unused_capacity() const _NOEXCEPT
Definition: vector:1729
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
iterator begin() _NOEXCEPT
Definition: vector:1643
size_type size() const _NOEXCEPT
Definition: vector:1708
return * this
Definition: variant:950
size_type max_size() const _NOEXCEPT
Definition: vector:1713
static void _Xlength()
Definition: vector:1960
void _Orphan_range(pointer, pointer) const
Definition: vector:1994
#define _CATCH_ALL
Definition: xstddef:28
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_BidIt2 _Move_backward_unchecked(_BidIt1 _First, _BidIt1 _Last, _BidIt2 _Dest)
Definition: xutility:2613
void _Emplace_back_with_unused_capacity(_Valty &&..._Val)
Definition: vector:897
_Mybase::size_type size_type
Definition: vector:713
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1883
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
#define _DEBUG_ERROR(mesg)
Definition: xutility:33
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_Mybase::pointer pointer
Definition: vector:709
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:635
#define _RERAISE
Definition: xstddef:32
_FwdIt const _Ty _Val
Definition: algorithm:1938
size_type _Calculate_growth(const size_type _Newsize) const
Definition: vector:1888
void _Umove_if_noexcept(pointer _First, pointer _Last, pointer _Dest)
Definition: vector:1877
pointer _Umove(pointer _First, pointer _Last, pointer _Dest)
Definition: vector:1862
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class... _Valty>
void vector< _Ty, _Alloc >::emplace_back ( _Valty &&...  _Val)
inline
908  { // insert by perfectly forwarding into element at end, provide strong guarantee
909  if (_Has_unused_capacity())
910  {
911  _Emplace_back_with_unused_capacity(_STD forward<_Valty>(_Val)...);
912  }
913  else
914  { // reallocate
915  const size_type _Oldsize = size();
916 
917  if (_Oldsize == max_size())
918  {
919  _Xlength();
920  }
921 
922  const size_type _Newsize = _Oldsize + 1;
923  const size_type _Newcapacity = _Calculate_growth(_Newsize);
924  bool _Emplaced = false;
925  const pointer _Newvec = this->_Getal().allocate(_Newcapacity);
926 
927  _TRY_BEGIN
928  this->_Getal().construct(_Unfancy(_Newvec + _Oldsize), _STD forward<_Valty>(_Val)...);
929  _Emplaced = true;
930  _Umove_if_noexcept(this->_Myfirst(), this->_Mylast(), _Newvec);
931  _CATCH_ALL
932  if (_Emplaced)
933  {
934  this->_Getal().destroy(_Unfancy(_Newvec + _Oldsize));
935  }
936 
937  this->_Getal().deallocate(_Newvec, _Newcapacity);
938  _RERAISE;
939  _CATCH_END
940 
941  _Change_array(_Newvec, _Newsize, _Newcapacity);
942  }
943  }
void _Change_array(const pointer _Newvec, const size_type _Newsize, const size_type _Newcapacity)
Definition: vector:1930
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
bool _Has_unused_capacity() const _NOEXCEPT
Definition: vector:1729
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
size_type size() const _NOEXCEPT
Definition: vector:1708
size_type max_size() const _NOEXCEPT
Definition: vector:1713
static void _Xlength()
Definition: vector:1960
#define _CATCH_ALL
Definition: xstddef:28
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
void _Emplace_back_with_unused_capacity(_Valty &&..._Val)
Definition: vector:897
_Mybase::size_type size_type
Definition: vector:713
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_Mybase::pointer pointer
Definition: vector:709
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:635
#define _RERAISE
Definition: xstddef:32
_FwdIt const _Ty _Val
Definition: algorithm:1938
size_type _Calculate_growth(const size_type _Newsize) const
Definition: vector:1888
void _Umove_if_noexcept(pointer _First, pointer _Last, pointer _Dest)
Definition: vector:1877
template<class _Ty, class _Alloc = allocator<_Ty>>
bool vector< _Ty, _Alloc >::empty ( ) const
inline
1704  { // test if sequence is empty
1705  return (this->_Myfirst() == this->_Mylast());
1706  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::end ( )
inline
1654  { // return iterator for end of mutable sequence
1655  return (iterator(this->_Mylast(), _STD addressof(this->_Get_data())));
1656  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:639
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Mybase::iterator iterator
Definition: vector:715
template<class _Ty, class _Alloc = allocator<_Ty>>
const_iterator vector< _Ty, _Alloc >::end ( ) const
inline
1659  { // return iterator for end of nonmutable sequence
1660  return (const_iterator(this->_Mylast(), _STD addressof(this->_Get_data())));
1661  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:639
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
_Mybase::const_iterator const_iterator
Definition: vector:716
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::erase ( const_iterator  _Where)
inline
1571  { // erase element at _Where
1572  #if _ITERATOR_DEBUG_LEVEL == 2
1573  if (_Where._Getcont() != _STD addressof(this->_Get_data())
1574  || _Where._Ptr < this->_Myfirst()
1575  || this->_Mylast() <= _Where._Ptr)
1576  {
1577  _DEBUG_ERROR("vector erase iterator outside range");
1578  }
1579 
1580  _Orphan_range(_Where._Ptr, this->_Mylast());
1581  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1582 
1583  _Move_unchecked(_Where._Ptr + 1, this->_Mylast(), _Where._Ptr);
1584  this->_Getal().destroy(_Unfancy(this->_Mylast() - 1));
1585  --this->_Mylast();
1586  return (iterator(_Where._Ptr, _STD addressof(this->_Get_data())));
1587  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:639
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
_OutIt _Move_unchecked(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2548
return * this
Definition: variant:950
void _Orphan_range(pointer, pointer) const
Definition: vector:1994
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Mybase::iterator iterator
Definition: vector:715
#define _DEBUG_ERROR(mesg)
Definition: xutility:33
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:635
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::erase ( const_iterator  _First,
const_iterator  _Last 
)
inline
1590  { // erase [_First, _Last)
1591  #if _ITERATOR_DEBUG_LEVEL == 2
1592  if (_First._Getcont() != _STD addressof(this->_Get_data())
1593  || _Last._Getcont() != _STD addressof(this->_Get_data())
1594  || _First._Ptr < this->_Myfirst()
1595  || _Last._Ptr < _First._Ptr
1596  || this->_Mylast() < _Last._Ptr)
1597  {
1598  _DEBUG_ERROR("vector erase iterator outside range");
1599  }
1600  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1601 
1602  if (_First._Ptr != _Last._Ptr)
1603  { // something to do, invalidate iterators
1604  _Orphan_range(_First._Ptr, this->_Mylast());
1605  const pointer _Newlast = _Move_unchecked(_Last._Ptr, this->_Mylast(), _First._Ptr);
1606  _Destroy(_Newlast, this->_Mylast());
1607  this->_Mylast() = _Newlast;
1608  }
1609 
1610  return (iterator(_First._Ptr, _STD addressof(this->_Get_data())));
1611  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:639
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
_OutIt _Move_unchecked(_InIt _First, _InIt _Last, _OutIt _Dest)
Definition: xutility:2548
return * this
Definition: variant:950
void _Orphan_range(pointer, pointer) const
Definition: vector:1994
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Mybase::iterator iterator
Definition: vector:715
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1883
#define _DEBUG_ERROR(mesg)
Definition: xutility:33
_Mybase::pointer pointer
Definition: vector:709
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
_Ty& vector< _Ty, _Alloc >::front ( )
inline
1784  { // return first element of mutable sequence
1785  #if _ITERATOR_DEBUG_LEVEL == 2
1786  if (empty())
1787  { // report error
1788  _DEBUG_ERROR("front() called on empty vector");
1789  }
1790  #elif _ITERATOR_DEBUG_LEVEL == 1
1792  #endif /* _ITERATOR_DEBUG_LEVEL */
1793 
1794  return (*this->_Myfirst());
1795  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
#define _SCL_SECURE_VALIDATE_RANGE(cond)
Definition: yvals.h:432
#define _DEBUG_ERROR(mesg)
Definition: xutility:33
bool empty() const _NOEXCEPT
Definition: vector:1703
template<class _Ty, class _Alloc = allocator<_Ty>>
const _Ty& vector< _Ty, _Alloc >::front ( ) const
inline
1798  { // return first element of nonmutable sequence
1799  #if _ITERATOR_DEBUG_LEVEL == 2
1800  if (empty())
1801  { // report error
1802  _DEBUG_ERROR("front() called on empty vector");
1803  }
1804  #elif _ITERATOR_DEBUG_LEVEL == 1
1806  #endif /* _ITERATOR_DEBUG_LEVEL */
1807 
1808  return (*this->_Myfirst());
1809  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
#define _SCL_SECURE_VALIDATE_RANGE(cond)
Definition: yvals.h:432
#define _DEBUG_ERROR(mesg)
Definition: xutility:33
bool empty() const _NOEXCEPT
Definition: vector:1703
template<class _Ty, class _Alloc = allocator<_Ty>>
_Alloc vector< _Ty, _Alloc >::get_allocator ( ) const
inline
1840  { // return allocator object for values
1841  _Alloc _Ret(this->_Getal());
1842  return (_Ret);
1843  }
_Vec_base_types< _Ty, _Alloc >::_Alloc _Alloc
Definition: vector:493
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::insert ( const_iterator  _Where,
const _Ty &  _Val 
)
inline
1028  { // insert _Val at _Where
1029  return (emplace(_Where, _Val));
1030  }
iterator emplace(const_iterator _Where, _Valty &&..._Val)
Definition: vector:956
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::insert ( const_iterator  _Where,
_Ty &&  _Val 
)
inline
1033  { // insert by moving _Val at _Where
1034  return (emplace(_Where, _STD move(_Val)));
1035  }
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
iterator emplace(const_iterator _Where, _Valty &&..._Val)
Definition: vector:956
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::insert ( const_iterator  _Where,
_CRT_GUARDOVERFLOW const size_type  _Count,
const _Ty &  _Val 
)
inline
1038  { // insert _Count * _Val at _Where
1039  #if _ITERATOR_DEBUG_LEVEL == 2
1040  if (_Where._Getcont() != _STD addressof(this->_Get_data())
1041  || _Where._Ptr < this->_Myfirst()
1042  || this->_Mylast() < _Where._Ptr)
1043  {
1044  _DEBUG_ERROR("vector insert iterator outside range");
1045  }
1046  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1047 
1048  const size_type _Whereoff = _Where._Ptr - this->_Myfirst();
1049  const bool _One_at_back = _Count == 1 && _Where._Ptr == this->_Mylast();
1050 
1051  if (_Count == 0)
1052  { // nothing to do, avoid invalidating iterators
1053  }
1054  else if (_Count > _Unused_capacity())
1055  { // reallocate
1056  const size_type _Oldsize = size();
1057 
1058  if (_Count > max_size() - _Oldsize)
1059  {
1060  _Xlength();
1061  }
1062 
1063  const size_type _Newsize = _Oldsize + _Count;
1064  const size_type _Newcapacity = _Calculate_growth(_Newsize);
1065 
1066  const pointer _Newvec = this->_Getal().allocate(_Newcapacity);
1067  const pointer _Constructed_last = _Newvec + _Whereoff + _Count;
1068  pointer _Constructed_first = _Constructed_last;
1069 
1070  _TRY_BEGIN
1071  _Ufill(_Newvec + _Whereoff, _Count, _Val);
1072  _Constructed_first = _Newvec + _Whereoff;
1073 
1074  if (_One_at_back)
1075  { // provide strong guarantee
1076  _Umove_if_noexcept(this->_Myfirst(), this->_Mylast(), _Newvec);
1077  }
1078  else
1079  { // provide basic guarantee
1080  _Umove(this->_Myfirst(), _Where._Ptr, _Newvec);
1081  _Constructed_first = _Newvec;
1082  _Umove(_Where._Ptr, this->_Mylast(), _Newvec + _Whereoff + _Count);
1083  }
1084  _CATCH_ALL
1085  _Destroy(_Constructed_first, _Constructed_last);
1086  this->_Getal().deallocate(_Newvec, _Newcapacity);
1087  _RERAISE;
1088  _CATCH_END
1089 
1090  _Change_array(_Newvec, _Newsize, _Newcapacity);
1091  }
1092  else if (_One_at_back)
1093  { // provide strong guarantee
1095  }
1096  else
1097  { // provide basic guarantee
1098  const _Ty _Tmp = _Val; // handle aliasing
1099  const pointer _Oldlast = this->_Mylast();
1100  const size_type _Affected_elements = _Oldlast - _Where._Ptr;
1101  _Orphan_range(_Where._Ptr, _Oldlast);
1102 
1103  if (_Count > _Affected_elements)
1104  { // new stuff spills off end
1105  this->_Mylast() = _Ufill(_Oldlast, _Count - _Affected_elements, _Tmp);
1106  this->_Mylast() = _Umove(_Where._Ptr, _Oldlast, this->_Mylast());
1107  _Fill_unchecked(_Where._Ptr, _Oldlast, _Tmp);
1108  }
1109  else
1110  { // new stuff can all be assigned
1111  this->_Mylast() = _Umove(_Oldlast - _Count, _Oldlast, _Oldlast);
1112  _Move_backward_unchecked(_Where._Ptr, _Oldlast - _Count, _Oldlast);
1113  _Fill_unchecked(_Where._Ptr, _Where._Ptr + _Count, _Tmp);
1114  }
1115  }
1116 
1117  return (begin() + _Whereoff);
1118  }
void _Change_array(const pointer _Newvec, const size_type _Newsize, const size_type _Newcapacity)
Definition: vector:1930
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:639
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
#define _TRY_BEGIN
Definition: xstddef:26
#define _CATCH_END
Definition: xstddef:29
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
iterator begin() _NOEXCEPT
Definition: vector:1643
size_type size() const _NOEXCEPT
Definition: vector:1708
return * this
Definition: variant:950
size_type max_size() const _NOEXCEPT
Definition: vector:1713
static void _Xlength()
Definition: vector:1960
void _Orphan_range(pointer, pointer) const
Definition: vector:1994
void _Fill_unchecked(_FwdIt _First, _FwdIt _Last, const _Ty &_Val)
Definition: xutility:2702
#define _CATCH_ALL
Definition: xstddef:28
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_BidIt2 _Move_backward_unchecked(_BidIt1 _First, _BidIt1 _Last, _BidIt2 _Dest)
Definition: xutility:2613
void _Emplace_back_with_unused_capacity(_Valty &&..._Val)
Definition: vector:897
_Mybase::size_type size_type
Definition: vector:713
size_type _Unused_capacity() const _NOEXCEPT
Definition: vector:1724
void _Destroy(pointer _First, pointer _Last)
Definition: vector:1883
_Diff _Count
Definition: algorithm:1941
#define _DEBUG_ERROR(mesg)
Definition: xutility:33
pointer _Ufill(pointer _Dest, const size_type _Count, const _Ty &_Val)
Definition: vector:1851
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
_Mybase::pointer pointer
Definition: vector:709
#define _RERAISE
Definition: xstddef:32
_FwdIt const _Ty _Val
Definition: algorithm:1938
size_type _Calculate_growth(const size_type _Newsize) const
Definition: vector:1888
void _Umove_if_noexcept(pointer _First, pointer _Last, pointer _Dest)
Definition: vector:1877
pointer _Umove(pointer _First, pointer _Last, pointer _Dest)
Definition: vector:1862
template<class _Ty, class _Alloc = allocator<_Ty>>
template<class _Iter >
enable_if_t<_Is_iterator<_Iter>::value, iterator> vector< _Ty, _Alloc >::insert ( const_iterator  _Where,
_Iter  _First,
_Iter  _Last 
)
inline
1264  { // insert [_First, _Last) at _Where
1265  #if _ITERATOR_DEBUG_LEVEL == 2
1266  if (_Where._Getcont() != _STD addressof(this->_Get_data())
1267  || _Where._Ptr < this->_Myfirst()
1268  || this->_Mylast() < _Where._Ptr)
1269  {
1270  _DEBUG_ERROR("vector insert iterator outside range");
1271  }
1272  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1273 
1274  _DEBUG_RANGE(_First, _Last);
1275 
1276  const size_type _Whereoff = _Where._Ptr - this->_Myfirst();
1278  return (begin() + _Whereoff);
1279  }
_Vector_val< _Val_types > & _Get_data() _NOEXCEPT
Definition: vector:639
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
#define _DEBUG_RANGE(first, last)
Definition: xutility:902
typename iterator_traits< _Iter >::iterator_category _Iter_cat_t
Definition: xutility:657
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
iterator begin() _NOEXCEPT
Definition: vector:1643
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Mybase::size_type size_type
Definition: vector:713
_Vector_const_iterator< _Myvec >::_Unchecked_type _Unchecked(_Vector_const_iterator< _Myvec > _Iter)
Definition: vector:261
#define _DEBUG_ERROR(mesg)
Definition: xutility:33
void _Insert_range(const_iterator _Where, _Iter _First, _Iter _Last, input_iterator_tag)
Definition: vector:1122
_FwdIt _Last
Definition: algorithm:1936
template<class _Ty, class _Alloc = allocator<_Ty>>
iterator vector< _Ty, _Alloc >::insert ( const_iterator  _Where,
initializer_list< _Ty >  _Ilist 
)
inline
1282  { // insert initializer_list at _Where
1283  return (insert(_Where, _Ilist.begin(), _Ilist.end()));
1284  }
constexpr const _Elem * end() const _NOEXCEPT
Definition: initializer_list:44
constexpr const _Elem * begin() const _NOEXCEPT
Definition: initializer_list:39
iterator insert(const_iterator _Where, const _Ty &_Val)
Definition: vector:1027
template<class _Ty, class _Alloc = allocator<_Ty>>
size_type vector< _Ty, _Alloc >::max_size ( ) const
inline
1714  { // return maximum possible length of sequence
1715  return (this->_Getal().max_size());
1716  }
size_type max_size() const _NOEXCEPT
Definition: vector:1713
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
template<class _Ty, class _Alloc = allocator<_Ty>>
vector& vector< _Ty, _Alloc >::operator= ( vector< _Ty, _Alloc > &&  _Right)
inline
878  { // assign by moving _Right
879  if (this != _STD addressof(_Right))
880  { // different, assign it
881  _Tidy();
882  this->_Move_alloc(_Right._Getal());
884  typename _Alty::propagate_on_container_move_assignment,
885  typename _Alty::is_always_equal>{});
886  }
887  return (*this);
888  }
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
void _Move_from(vector &&_Right, true_type)
Definition: vector:832
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
typename disjunction< _Traits...>::type _Disjunction_t
Definition: type_traits:1167
void _Tidy()
Definition: vector:1945
void _Move_alloc(_Alty &_Al)
Definition: vector:524
template<class _Ty, class _Alloc = allocator<_Ty>>
vector& vector< _Ty, _Alloc >::operator= ( const vector< _Ty, _Alloc > &  _Right)
inline
1414  { // assign _Right
1415  if (this != _STD addressof(_Right))
1416  { // different, assign it
1417 #pragma warning(push)
1418 #pragma warning(disable: 4127) // conditional expression is constant
1419  if (_Alty::propagate_on_container_copy_assignment::value && this->_Getal() != _Right._Getal())
1420  { // reload array
1421  _Tidy();
1422  }
1423 #pragma warning(pop)
1424 
1425  this->_Copy_alloc(_Right._Getal());
1426 
1427  assign(_Right._Myfirst(), _Right._Mylast());
1428  }
1429 
1430  return (*this);
1431  }
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
void assign(_CRT_GUARDOVERFLOW const size_type _Newsize, const _Ty &_Val)
Definition: vector:1286
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
void _Tidy()
Definition: vector:1945
void _Copy_alloc(const _Alty &_Al)
Definition: vector:519
template<class _Ty, class _Alloc = allocator<_Ty>>
vector& vector< _Ty, _Alloc >::operator= ( initializer_list< _Ty >  _Ilist)
inline
1434  { // assign initializer_list
1435  _Assign_range(_Ilist.begin(), _Ilist.end(), random_access_iterator_tag{});
1436  return (*this);
1437  }
Definition: xutility:531
constexpr const _Elem * end() const _NOEXCEPT
Definition: initializer_list:44
void _Assign_range(_Iter _First, _Iter _Last, input_iterator_tag)
Definition: vector:1328
constexpr const _Elem * begin() const _NOEXCEPT
Definition: initializer_list:39
template<class _Ty, class _Alloc = allocator<_Ty>>
_Ty& vector< _Ty, _Alloc >::operator[] ( const size_type  _Pos)
inline
1736  { // subscript mutable sequence
1737  #if _ITERATOR_DEBUG_LEVEL == 2
1738  if (size() <= _Pos)
1739  { // report error
1740  _DEBUG_ERROR("vector subscript out of range");
1741  }
1742  #elif _ITERATOR_DEBUG_LEVEL == 1
1743  _SCL_SECURE_VALIDATE_RANGE(_Pos < size());
1744  #endif /* _ITERATOR_DEBUG_LEVEL */
1745 
1746  return (this->_Myfirst()[_Pos]);
1747  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
size_type size() const _NOEXCEPT
Definition: vector:1708
#define _SCL_SECURE_VALIDATE_RANGE(cond)
Definition: yvals.h:432
#define _DEBUG_ERROR(mesg)
Definition: xutility:33
template<class _Ty, class _Alloc = allocator<_Ty>>
const _Ty& vector< _Ty, _Alloc >::operator[] ( const size_type  _Pos) const
inline
1750  { // subscript nonmutable sequence
1751  #if _ITERATOR_DEBUG_LEVEL == 2
1752  if (size() <= _Pos)
1753  { // report error
1754  _DEBUG_ERROR("vector subscript out of range");
1755  }
1756  #elif _ITERATOR_DEBUG_LEVEL == 1
1757  _SCL_SECURE_VALIDATE_RANGE(_Pos < size());
1758  #endif /* _ITERATOR_DEBUG_LEVEL */
1759 
1760  return (this->_Myfirst()[_Pos]);
1761  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
size_type size() const _NOEXCEPT
Definition: vector:1708
#define _SCL_SECURE_VALIDATE_RANGE(cond)
Definition: yvals.h:432
#define _DEBUG_ERROR(mesg)
Definition: xutility:33
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::pop_back ( )
inline
1556  { // erase element at end
1557  #if _ITERATOR_DEBUG_LEVEL == 2
1558  if (empty())
1559  {
1560  _DEBUG_ERROR("vector empty before pop");
1561  }
1562 
1563  _Orphan_range(this->_Mylast() - 1, this->_Mylast());
1564  #endif /* _ITERATOR_DEBUG_LEVEL == 2 */
1565 
1566  this->_Getal().destroy(_Unfancy(this->_Mylast() - 1));
1567  --this->_Mylast();
1568  }
void _Orphan_range(pointer, pointer) const
Definition: vector:1994
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
#define _DEBUG_ERROR(mesg)
Definition: xutility:33
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
auto _Unfancy(_Ptrty _Ptr)
Definition: xstddef:635
bool empty() const _NOEXCEPT
Definition: vector:1703
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::push_back ( const _Ty &  _Val)
inline
946  { // insert element at end, provide strong guarantee
948  }
void emplace_back(_Valty &&..._Val)
Definition: vector:907
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::push_back ( _Ty &&  _Val)
inline
951  { // insert by moving into element at end, provide strong guarantee
953  }
void emplace_back(_Valty &&..._Val)
Definition: vector:907
constexpr remove_reference< _Ty >::type && move(_Ty &&_Arg) _NOEXCEPT
Definition: type_traits:1349
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty, class _Alloc = allocator<_Ty>>
reverse_iterator vector< _Ty, _Alloc >::rbegin ( )
inline
1664  { // return iterator for beginning of reversed mutable sequence
1665  return (reverse_iterator(end()));
1666  }
iterator end() _NOEXCEPT
Definition: vector:1653
_STD reverse_iterator< iterator > reverse_iterator
Definition: vector:717
template<class _Ty, class _Alloc = allocator<_Ty>>
const_reverse_iterator vector< _Ty, _Alloc >::rbegin ( ) const
inline
1669  { // return iterator for beginning of reversed nonmutable sequence
1670  return (const_reverse_iterator(end()));
1671  }
iterator end() _NOEXCEPT
Definition: vector:1653
_STD reverse_iterator< const_iterator > const_reverse_iterator
Definition: vector:718
template<class _Ty, class _Alloc = allocator<_Ty>>
reverse_iterator vector< _Ty, _Alloc >::rend ( )
inline
1674  { // return iterator for end of reversed mutable sequence
1675  return (reverse_iterator(begin()));
1676  }
iterator begin() _NOEXCEPT
Definition: vector:1643
_STD reverse_iterator< iterator > reverse_iterator
Definition: vector:717
template<class _Ty, class _Alloc = allocator<_Ty>>
const_reverse_iterator vector< _Ty, _Alloc >::rend ( ) const
inline
1679  { // return iterator for end of reversed nonmutable sequence
1680  return (const_reverse_iterator(begin()));
1681  }
iterator begin() _NOEXCEPT
Definition: vector:1643
_STD reverse_iterator< const_iterator > const_reverse_iterator
Definition: vector:718
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::reserve ( _CRT_GUARDOVERFLOW const size_type  _Newcapacity)
inline
1528  { // increase capacity to _Newcapacity (without geometric growth), provide strong guarantee
1529  if (_Newcapacity > capacity())
1530  { // something to do (reserve() never shrinks)
1531  if (_Newcapacity > max_size())
1532  {
1533  _Xlength();
1534  }
1535 
1536  _Reallocate_exactly(_Newcapacity);
1537  }
1538  }
size_type capacity() const _NOEXCEPT
Definition: vector:1718
void _Reallocate_exactly(const size_type _Newcapacity)
Definition: vector:1510
size_type max_size() const _NOEXCEPT
Definition: vector:1713
static void _Xlength()
Definition: vector:1960
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::resize ( _CRT_GUARDOVERFLOW const size_type  _Newsize)
inline
1490  { // trim or append value-initialized elements, provide strong guarantee
1491  auto _Lambda_default = [this](pointer _Dest, const size_type _Count)
1492  {
1493  return (_Udefault(_Dest, _Count));
1494  };
1495 
1496  _Resize(_Newsize, _Lambda_default);
1497  }
unsigned _Dest
Definition: mbstring.h:107
pointer _Udefault(pointer _Dest, const size_type _Count)
Definition: vector:1846
void _Resize(const size_type _Newsize, _Lambda _Udefault_or_fill)
Definition: vector:1441
_Mybase::size_type size_type
Definition: vector:713
_Diff _Count
Definition: algorithm:1941
_Mybase::pointer pointer
Definition: vector:709
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::resize ( _CRT_GUARDOVERFLOW const size_type  _Newsize,
const _Ty &  _Val 
)
inline
1500  { // trim or append copies of _Val, provide strong guarantee
1501  auto _Lambda_fill = [this, &_Val](pointer _Dest, const size_type _Count)
1502  {
1503  return (_Ufill(_Dest, _Count, _Val));
1504  };
1505 
1506  _Resize(_Newsize, _Lambda_fill);
1507  }
unsigned _Dest
Definition: mbstring.h:107
void _Resize(const size_type _Newsize, _Lambda _Udefault_or_fill)
Definition: vector:1441
_Mybase::size_type size_type
Definition: vector:713
_Diff _Count
Definition: algorithm:1941
pointer _Ufill(pointer _Dest, const size_type _Count, const _Ty &_Val)
Definition: vector:1851
_Mybase::pointer pointer
Definition: vector:709
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::shrink_to_fit ( )
inline
1541  { // reduce capacity to size, provide strong guarantee
1542  if (_Has_unused_capacity())
1543  { // something to do
1544  if (empty())
1545  {
1546  _Tidy();
1547  }
1548  else
1549  {
1551  }
1552  }
1553  }
bool _Has_unused_capacity() const _NOEXCEPT
Definition: vector:1729
void _Reallocate_exactly(const size_type _Newcapacity)
Definition: vector:1510
size_type size() const _NOEXCEPT
Definition: vector:1708
void _Tidy()
Definition: vector:1945
bool empty() const _NOEXCEPT
Definition: vector:1703
template<class _Ty, class _Alloc = allocator<_Ty>>
size_type vector< _Ty, _Alloc >::size ( ) const
inline
1709  { // return length of sequence
1710  return (this->_Mylast() - this->_Myfirst());
1711  }
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
template<class _Ty, class _Alloc = allocator<_Ty>>
void vector< _Ty, _Alloc >::swap ( vector< _Ty, _Alloc > &  _Right)
inline
1622  { // exchange contents with _Right
1623  if (this != _STD addressof(_Right))
1624  { // (maybe) swap allocators, swap control information
1625  _Pocs(this->_Getal(), _Right._Getal());
1626  this->_Swap_all(_Right);
1627  _Swap_adl(this->_Myfirst(), _Right._Myfirst());
1628  _Swap_adl(this->_Mylast(), _Right._Mylast());
1629  _Swap_adl(this->_Myend(), _Right._Myend());
1630  }
1631  }
void _Swap_all(_Myt &_Right)
Definition: vector:624
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
pointer & _Myend() _NOEXCEPT
Definition: vector:669
pointer & _Myfirst() _NOEXCEPT
Definition: vector:649
pointer & _Mylast() _NOEXCEPT
Definition: vector:659
void _Swap_adl(_Ty &_Left, _Ty &_Right) _NOEXCEPT_OP(_Is_nothrow_swappable< _Ty >
Definition: utility:73
_Alty & _Getal() _NOEXCEPT
Definition: vector:629
void _Pocs(_Alty &_Left, _Alty &_Right, true_type) _NOEXCEPT
Definition: xmemory0:1169

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