/////////////////////////////////////////////////////////
template <typename _Iterator>
- class _begin_end_iterator_impl : public linear_iterator_base<_Iterator>
+ class _begin_end_iterator_impl : public _linear_iterator_impl_base<_Iterator>
{
- typedef linear_iterator_base<_Iterator> _Base;
+ typedef _linear_iterator_impl_base<_Iterator> _Base;
public:
typedef _Iterator _IteratorType;
//typedef T _T, _Ty, _Value, _ValueType, ValueType;
- typedef _Iterator _ValueType, ValueType;
+ typedef _Iterator ValueType;
protected:
_Iterator m_end;
}
// Value
- _ValueType get_value_ref() const
+ ValueType get_value_ref() const
{
return m_it;
}
typedef _IndexType IndexType;
protected:
- _ContainerType *m_pcon;
+ _ContainerType m_con;
public:
//////////////////////////////////////////
: _Base(IndexType(0),IndexType(0)),
m_pcon(NULL)
{}
- indexer_iterator_impl(ContainerType &array_in, const IndexType& length)
+ indexer_iterator_impl(ContainerType con_in, const IndexType& length)
: _Base(IndexType(0),length),
- m_pcon(&array_in)
+ m_con(con_in)
{}
- indexer_iterator_impl(ContainerType &array_in, const IndexType& start, const IndexType& end)
+ indexer_iterator_impl(ContainerType con_in, const IndexType& start, const IndexType& end)
: _Base(start,end),
- m_pcon(&array_in)
+ m_con(con_in)
{}
//////////////////////////////////////////
// Value
- ValueType& get_value_ref() const { return m_pcon->operator[](m_index); }
+ ValueType& get_value_ref() const { return m_con[m_it]; }
//////////////////////////////////////////
indexer_iterator_impl operator =(const indexer_iterator_impl& from)
{
_Base::operator =(from);
- m_pcon = from.m_pcon;
+ m_con = from.m_con;
return *this;
}
};
class _linear_iterator_impl_base
{
public:
- typedef T _IteratorType, IteratorType;
- typedef T _ValueType, ValueType;
+ typedef T IteratorType;
+ typedef T ValueType;
protected:
T m_it;
#include "stdafx.h"
#include "roast/container/indexer_iterator.hpp"
+#include <stdio.h>
using namespace roast;
indexer_iterator<char*, char>::type a = indexer_iterator_impl<char*, char>(work, (size_t)32);
do
{
- work
+ *a = 0;
+ }while(a.in_dowhile());
+
+ a = indexer_iterator_impl<char*, char>(work, (size_t)32);
+ do
+ {
+ printf("%d, ", *a);
}while(a.in_dowhile());
}