#pragma once #include "ReverseIterator.Base.tlh" #include "ReverseIterator.Random.tlh" #include "VectorOfPtr.tlh" //----------------------------------------------------------------------------- // VectorOfPtr // 偏特化 - 常量 //----------------------------------------------------------------------------- namespace ReverseIterator { template class _VP_ConstIterator : public __RandomIterator ::const_reverse_iterator> { typedef __RandomIterator ::const_reverse_iterator> inherited; public: // using inherited::inherited; // VC2013 编译错误 // using __Iterator >::__Iterator >; _VP_ConstIterator () : inherited () { } _VP_ConstIterator (const VectorOfPtr & ar) { this->Iter = this->_begin = ar.crbegin (); this->_end = ar.crend (); this->m_Count = (int) ar.size (); this->m_Index = this->m_Count - 1; } _VP_ConstIterator (const _VP_ConstIterator & from) { CopyAssign (from); } _VP_ConstIterator (_VP_ConstIterator && from) { MoveAssign (from); } public: _VP_ConstIterator & operator = (const _VP_ConstIterator & from) { inherited::operator = (from); return (*this); } public: inline const T * Current () { return (*(this->Iter)).get (); } inline const T * operator () (void) { return Current (); } inline const T * operator * (void) { return Current (); } }; } //----------------------------------------------------------------------------- // VectorOfPtr // 偏特化 - 变量 //----------------------------------------------------------------------------- namespace ReverseIterator { template class _VP_Iterator : public __RandomIterator ::reverse_iterator> { typedef __RandomIterator ::reverse_iterator> inherited; public: // using inherited::inherited; // VC2013 编译错误 // using __Iterator >::__Iterator >; _VP_Iterator () : inherited () { } _VP_Iterator (VectorOfPtr & ar) { this->Iter = this->_begin = ar.rbegin (); this->_end = ar.rend (); this->m_Count = (int) ar.size (); this->m_Index = this->m_Count - 1; } _VP_Iterator (const _VP_Iterator & from) { CopyAssign (from); } _VP_Iterator (_VP_Iterator && from) { MoveAssign (from); } public: _VP_Iterator & operator = (const _VP_Iterator & from) { inherited::operator = (from); return (*this); } public: inline T * Current () { return (*(this->Iter)).get (); } inline T * operator () (void) { return Current (); } inline T * operator * (void) { return Current (); } }; }