
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

Mark Ruzon wrote:
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:
You seemed to redefine difference_type as private, then it is inaccessible from iterator users. You might want to place it in public or use a "different" name. private: typedef typename skip_iterator::iterator_adaptor_::difference_type diff_t; void advance(diff_t n); -- Shunsuke Sogame
participants (2)
-
Mark Ruzon
-
shunsuke