Boost logo

Boost Users :

From: Mark Ruzon (mark34_at_[hidden])
Date: 2007-06-29 13:38:15


In the private part of my own iterator adaptor called skip_iterator, I would
like to write the following:

private:
  typedef typename skip_iterator::iterator_adaptor_::difference_type
difference_type;
  void advance(difference_type n);
  difference_type distance_to(const skip_iterator& x) const;

because it looks nice. What I get from gcc 3.4.6 is strange:

skip_iterator.hpp:22: error: `typedef ptrdiff_t
skip_iterator<__gnu_cxx::__normal_iterator<float*, std::vector<float,
std::allocator<float> > > >::difference_type' is private
/usr/include/c++/boost_1_33_1/boost/iterator/iterator_facade.hpp:868: error:
within this context

However, if I forgo the typedef and write uglier code:

private:
  void advance(typename skip_iterator::iterator_adaptor_::difference_type n);
  typename skip_iterator::iterator_adaptor_::difference_type distance_to(const
skip_iterator& x) const;

then it compiles and works fine. What is the issue with my typedef?

Thanks,
Mark


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net