Function operator=
Summary
#include <include/EASTL/deque.h>
(1) this_type & operator=(const this_type &x)
(2) this_type & operator=(std::initializer_list< value_type > ilist)
(3) this_type & operator=(this_type &&x)
Function overload
Synopsis
#include <include/EASTL/deque.h>
this_type & operator=(const this_type &x)
Description
No description yet.
Source
Lines 1271-1303 in include/EASTL/deque.h. Line 386 in include/EASTL/deque.h.
template <typename T, typename Allocator, unsigned kDequeSubarraySize>
typename deque<T, Allocator, kDequeSubarraySize>::this_type&
deque<T, Allocator, kDequeSubarraySize>::operator=(const this_type& x)
{
if(&x != this) // If not assigning to ourselves...
{
// If (EASTL_ALLOCATOR_COPY_ENABLED == 1) and the current contents are allocated by an
// allocator that's unequal to x's allocator, we need to reallocate our elements with
// our current allocator and reallocate it with x's allocator. If the allocators are
// equal then we can use a more optimal algorithm that doesn't reallocate our elements
// but instead can copy them in place.
#if EASTL_ALLOCATOR_COPY_ENABLED
bool bSlowerPathwayRequired = (mAllocator != x.mAllocator);
#else
bool bSlowerPathwayRequired = false;
#endif
if(bSlowerPathwayRequired)
{
// We can't currently use set_capacity(0) or shrink_to_fit, because they
// leave a remaining allocation with our old allocator. So we do a similar
// thing but set our allocator to x.mAllocator while doing so.
this_type temp(x.mAllocator);
DoSwap(temp);
// Now we have an empty container with an allocator equal to x.mAllocator, ready to assign from x.
}
DoAssign(x.begin(), x.end(), eastl::false_type());
}
return *this;
}
Synopsis
#include <include/EASTL/deque.h>
this_type & operator=(std::initializer_list< value_type > ilist)
Description
No description yet.
Source
Lines 1319-1325 in include/EASTL/deque.h. Line 387 in include/EASTL/deque.h.
template <typename T, typename Allocator, unsigned kDequeSubarraySize>
inline typename deque<T, Allocator, kDequeSubarraySize>::this_type&
deque<T, Allocator, kDequeSubarraySize>::operator=(std::initializer_list<value_type> ilist)
{
DoAssign(ilist.begin(), ilist.end(), false_type());
return *this;
}
Synopsis
#include <include/EASTL/deque.h>
this_type & operator=(this_type &&x)
Description
No description yet.
Source
Lines 1306-1316 in include/EASTL/deque.h. Line 388 in include/EASTL/deque.h.
template <typename T, typename Allocator, unsigned kDequeSubarraySize>
inline typename deque<T, Allocator, kDequeSubarraySize>::this_type&
deque<T, Allocator, kDequeSubarraySize>::operator=(this_type&& x)
{
if(this != &x)
{
set_capacity(0); // To consider: Are we really required to clear here? x is going away soon and will clear itself in its dtor.
swap(x); // member swap handles the case that x has a different allocator than our allocator by doing a copy.
}
return *this;
}