const TYPE& VECTOR<TYPE>::rotateLeft() { if(mVectorSize >= 2) { // Shift right and set shifted element to index 0 mpObjPtrs[0] = shiftRightFromPosition(0); } return (*this)[0]; }
void VECTOR<TYPE>::push_front(const TYPE& element) { if(mVectorSize >= mVectorCapacity) { changeCapacity( (mVectorCapacity + mGrowthRate) ); } // Right-most item that was shifted out is retained at the last position. mpData[mVectorSize] = shiftRightFromPosition(0); // 1st element was moved to 2nd by shifting right, place new item at 1st location. mpData[0] = element; mVectorSize++; }
void VECTOR<TYPE>::push_front(const TYPE& element) { if(mVectorSize >= mVectorCapacity) { changeCapacity( (mVectorCapacity + mGrowthRate) ); } // Make room to put new item at mpData[0] by moving free right-most pointer back to 0 if( mVectorSize++ >= 1) { mpObjPtrs[0] = shiftRightFromPosition(0); } // 1st element was moved to 2nd by shifting right, place new item at 1st location. *mpObjPtrs[0] = element; }