123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- #pragma once
- #include "Iterator.Base.tlh"
- #include "Iterator.Sequence.tlh"
- #include "ListOfPtr.tlh"
- //-----------------------------------------------------------------------------
- // ListOfPtr
- // Æ«ÌØ»¯ - ³£Á¿
- //-----------------------------------------------------------------------------
- namespace Iterator
- {
- template <typename T>
- class _LP_ConstIterator : public __SequenceIterator <typename ListOfPtr <T>::const_iterator>
- {
- typedef __SequenceIterator <typename ListOfPtr <T>::const_iterator> inherited;
- public:
- // using inherited::inherited; // VC2013 ±àÒë´íÎó
- // using __Iterator <ListOfPtr <T>>::__Iterator <ListOfPtr <T>>;
- using deref_type = const T;
- using value_type = const T *;
- using data_type = const T *;
- _LP_ConstIterator () : inherited ()
- {
- }
- _LP_ConstIterator (const ListOfPtr <T> & ar)
- {
- InitFrom (ar);
- }
- _LP_ConstIterator (const _LP_ConstIterator & from) : inherited (from)
- {
- }
- _LP_ConstIterator (_LP_ConstIterator && from) : inherited (from)
- {
- }
- public:
- _LP_ConstIterator & operator = (const _LP_ConstIterator & from)
- {
- inherited::operator = (from);
- return (*this);
- }
- _LP_ConstIterator & operator = (_LP_ConstIterator && from)
- {
- inherited::operator = (from);
- return (*this);
- }
- public:
- inline data_type Current () { return (*(this->m_stdIter)).get (); }
- inline data_type operator () () { return Current (); }
- inline data_type operator * () { return Current (); }
- protected:
- void InitFrom (const ListOfPtr <T> & ar)
- {
- this->m_stdIter = this->m_stdBegin = ar.cbegin ();
- this->m_stdEnd = ar.cend ();
- this->m_Count = (int) ar.size ();
- this->m_Index = 0;
- }
- };
- }
- //-----------------------------------------------------------------------------
- // ListOfPtr
- // Æ«ÌØ»¯ - ±äÁ¿
- //-----------------------------------------------------------------------------
- namespace Iterator
- {
- template <typename T>
- class _LP_Iterator : public __SequenceIterator <typename ListOfPtr <T>::iterator>
- {
- typedef __SequenceIterator <typename ListOfPtr <T>::iterator> inherited;
- public:
- // using inherited::inherited; // VC2013 ±àÒë´íÎó
- // using __Iterator <ListOfPtr <T>>::__Iterator <ListOfPtr <T>>;
- using deref_type = T;
- using value_type = T *;
- using data_type = T *;
- _LP_Iterator () : inherited ()
- {
- }
- _LP_Iterator (ListOfPtr <T> & ar)
- {
- InitFrom (ar);
- }
- _LP_Iterator (const _LP_Iterator & from) : inherited (from)
- {
- }
- _LP_Iterator (_LP_Iterator && from) : inherited (from)
- {
- }
- public:
- inline _LP_Iterator & operator = (const _LP_Iterator & from)
- {
- inherited::operator = (from);
- return (*this);
- }
- inline _LP_Iterator & operator = (_LP_Iterator && from)
- {
- inherited::operator = (from);
- return (*this);
- }
- public:
- inline data_type Current () { return (*(this->m_stdIter)).get (); }
- inline data_type operator () () { return Current (); }
- inline data_type operator * () { return Current (); }
- protected:
- void InitFrom (ListOfPtr <T> & ar)
- {
- this->m_stdIter = this->m_stdBegin = ar.begin ();
- this->m_stdEnd = ar.end ();
- this->m_Count = (int)ar.size ();
- this->m_Index = 0;
- }
- };
- }
|