I am trying to write a simple STL iterator for CArray MFC class using boost iterator adaptor. This is my code:
#include <boost/iterator/iterator_adaptor.hpp>
#include <afxtempl.h>
class CArrIter : public boost::iterator_adaptor< CArrIter ,
int,
int,
boost::random_access_traversal_tag >
{
public:
CArrIter(CArray<int,int>& arr, int index = 0) : m_arr(arr)
{
this->base_reference() = index;
}
private:
friend class boost::iterator_core_access;
int dereference() const{
return m_arr.GetAt(base());
}
private:
CArray<int,int>& m_arr;
};
This compiles fine with VC9 compiler. But when I try compiling this with VC7 I get the following error:
\include\boost\iterator\iterator_traits.hpp(49) : erro r C2039: 'difference_type' : is not a member of 'boost::detail::iterator_traits< Iterator>' with [ Iterator=int ]
\include\boost\mpl\eval_if.hpp(41) : see refer ence to class template instantiation 'boost::iterator_difference' bein g compiled with [ Iterator=int ]
.... Some more ....
Any clues what could be wrong? I have to include some other header files? I am quite new to boost library.