Function pop_front

Synopsis

#include <include/EASTL/deque.h>

void pop_front()

Description

No description yet.

Source

Lines 1697-1724 in include/EASTL/deque.h. Line 444 in include/EASTL/deque.h.

template <typename T, typename Allocator, unsigned kDequeSubarraySize>
void deque<T, Allocator, kDequeSubarraySize>::pop_front()
{
    #if EASTL_ASSERT_ENABLED
        if(EASTL_UNLIKELY((size_type)(mItEnd == mItBegin)))
            EASTL_FAIL_MSG("deque::pop_front -- empty deque");
    #endif
    if((mItBegin.mpCurrent + 1) != mItBegin.mpEnd) // If the operation is very simple...
        (mItBegin.mpCurrent++)->~value_type();
    else
    {
        // This is executed only when we are popping the end (last) item off the front-most subarray.
        // In this case we need to free the subarray and point mItBegin to the next subarray.
        #ifdef EA_DEBUG
            value_type** pp = mItBegin.mpCurrentArrayPtr;
        #endif
        mItBegin.mpCurrent->~value_type(); // mpCurrent == mpEnd - 1
        DoFreeSubarray(mItBegin.mpBegin);
        mItBegin.SetSubarray(mItBegin.mpCurrentArrayPtr + 1);
        mItBegin.mpCurrent = mItBegin.mpBegin;
        #ifdef EA_DEBUG
            *pp = NULL;
        #endif
    }
}





Add Discussion as Guest

Log in