OSDN Git Service

stl_iterator_to_roast.hpp Update (100702_foreach)
authorMyun2 <myun2@nwhite.info>
Sat, 18 Dec 2010 17:11:43 +0000 (02:11 +0900)
committerMyun2 <myun2@nwhite.info>
Sat, 18 Dec 2010 17:11:43 +0000 (02:11 +0900)
roast/include/roast/container/stl_iterator_to_roast.hpp

index 5945596..1ae1cb9 100644 (file)
@@ -15,22 +15,24 @@ namespace roast
 
        template <typename _Container>
        class _stllike_uni_iterator_to_roast_impl
-               : public _begin_end_iterator_impl< typename _Container::iterator >
+               : public _begin_end_iterator_impl<
+                       /*typename _Container::iterator::value_type,*/ typename _Container::iterator >
        {
        private:
-               typedef _begin_end_iterator_impl< typename _Container::iterator > _Base;
+               typedef _begin_end_iterator_impl<
+                       /*typename _Container::iterator::value_type,*/ typename _Container::iterator > _Base;
        public:
                //typedef ::std::vector<T> _Vector;
                //typedef ::std::vector<T>::iterator _VectorIterator, _VecIterator;
-               
-               typedef typename _Container::iterator Iterator,IteratorType,_Iterator;
 
                typedef typename _Container::value_type ValueType;
-               typedef ValueType& ValueTypeRef;
                typedef ValueType* ValueTypePtr;
+               typedef ValueType& ValueTypeRef;
                typedef const ValueType CValueType;
-               typedef const ValueType& CValueTypeRef;
                typedef const ValueType* CValueTypePtr;
+               typedef const ValueType& CValueTypeRef;
+
+               typedef typename _Container::iterator _Iterator;
        public:
                _stllike_uni_iterator_to_roast_impl(){}
                _stllike_uni_iterator_to_roast_impl(_Container& con)
@@ -39,15 +41,9 @@ namespace roast
                _stllike_uni_iterator_to_roast_impl(_Iterator& _beg, _Iterator& _end)
                        : _Base(_beg, _end)
                        {}
-                       
-               //      IsValid?
-               bool is_valid(){ return m_it != m_end; }
 
                //      Value
-               ValueType& get_value_ref() const
-               {
-                       return *m_it;
-               }
+               ValueTypeRef get_value_ref(){ return *(_Base::get_value_ref().operator ->()); }
        };
        //typedef _iterator<_stllike_uni_iterator_to_roast_impl> stllike_uni_iterator_to_roast;
 
@@ -74,43 +70,6 @@ namespace roast
        class stl_vector_iterator_to_roast_t : public
                _iterator< _stllike_uni_iterator_to_roast_impl< ::std::vector<T> > > {};
 
-       /*template <typename T>
-       class vector_roast_iterator : public
-               _iterator< _stllike_uni_iterator_to_roast_impl< ::std::vector<T> > >  {};*/
-       template <typename T>
-       class vector_roast_iterator : public
-               _iterator< _stllike_uni_iterator_to_roast_impl<::std::vector<T>> >
-       {
-       private:
-               typedef _stllike_uni_iterator_to_roast_impl<::std::vector<T>> _Impl;
-               typedef _iterator<_Impl> _Base;
-               typedef typename ::std::vector<T> _Container;
-               typedef typename _Container::iterator _Iterator;
-       public:
-               vector_roast_iterator(){}
-               vector_roast_iterator(const _Impl& impl) : _Base(impl){}
-               vector_roast_iterator(_Container& con)
-                       : _Base(_Impl(con))
-                       {}
-               vector_roast_iterator(const _Iterator& _beg, const _Iterator& _end)
-                       : _Base(_Impl(_beg, _end))
-                       {}
-       };
-       
-       /*template <typename T>
-       _stllike_uni_iterator_to_roast_impl<::std::vector<T>>
-               make_vector_roast_iterator(::std::vector<T> &v)
-       {
-               return _stllike_uni_iterator_to_roast_impl<::std::vector<T>>(v);
-       }
-       
-       template <typename T>
-       _stllike_uni_iterator_to_roast_impl<::std::vector<T>>
-               make_vector_roast_iterator(const typename ::std::vector<T>::iterator &_beg, const typename ::std::vector<T>::iterator &_end)
-       {
-               return _stllike_uni_iterator_to_roast_impl<::std::vector<T>>(_beg,_end);
-       }*/
-
        ///
 
        template <typename T>