libstdc++
GNU C++ library
Loading...
Searching...
No Matches

◆ operator=() [1/3]

template<typename _Tp, typename _Alloc>
deque< _Tp, _Alloc > & deque::operator= ( const deque< _Tp, _Alloc > & __x)

Deque assignment operator.

Parameters
__xA deque of identical element and allocator types.

All the elements of x are copied.

The newly-created deque uses a copy of the allocator object used by __x (unless the allocator traits dictate a different object).

Definition at line 95 of file deque.tcc.

97 {
98 if (std::__addressof(__x) != this)
99 {
100#if __cplusplus >= 201103L
102 {
105 {
106 // Replacement allocator cannot free existing storage,
107 // so deallocate everything and take copy of __x's data.
111 return *this;
112 }
115 }
116#endif
117 const size_type __len = size();
118 if (__len >= __x.size())
121 else
122 {
125 _M_range_insert_aux(this->_M_impl._M_finish, __mid, __x.end(),
127 }
128 }
129 return *this;
130 }
constexpr _OIter copy(_IIter, _IIter, _OIter)
size_type size() const noexcept
Definition stl_deque.h:1330
ptrdiff_t difference_type
Definition stl_deque.h:827
void _M_range_insert_aux(iterator __pos, _InputIterator __first, _InputIterator __last, std::input_iterator_tag)
Definition deque.tcc:635
allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
Definition stl_deque.h:1203
_Deque_impl _M_impl
Definition stl_deque.h:616
void _M_erase_at_end(iterator __pos)
Definition stl_deque.h:2248
iterator end() noexcept
Definition stl_deque.h:1232
size_t size_type
Definition stl_deque.h:826
_Base::const_iterator const_iterator
Definition stl_deque.h:823
void _M_replace_map(_Args &&... __args)
Definition stl_deque.h:2358
_Tp_alloc_type & _M_get_Tp_allocator() noexcept
Definition stl_deque.h:571
iterator begin() noexcept
Definition stl_deque.h:1213
A standard container using fixed-size memory allocation and constant-time manipulation of elements at...
Definition stl_deque.h:792

References deque(), std::__addressof(), _M_erase_at_end(), _M_get_Tp_allocator(), _M_impl, _M_range_insert_aux(), _M_replace_map(), __gnu_cxx::__alloc_traits< _Tp_alloc_type >::_S_always_equal(), __gnu_cxx::__alloc_traits< _Tp_alloc_type >::_S_propagate_on_copy_assign(), begin(), std::copy(), end(), get_allocator(), and size().

Here is the call graph for this function: