Roland Richter <[EMAIL PROTECTED]> writes: > David Abrahams wrote: >> This is going to break every boost library and every user which is >> depending on the current CVS version of iterator_adaptors. The new >> adaptors are so much better designed and easier to use that making the >> transition should be cake, but before I do anything drastic I want to >> hear how loud the pre-emptive screaming is ;-) >> Objections? >> > > No objections, Your Honour :-) ... just two remarks. > > I tried to update the view library (uses iterator_adaptors a lot), > and generally it turned out to be straight-forward. However: > > + permutation_iterator is missing - when will it be due?
I guess there's no plan. If you found it easy to use the new iterator adaptors, I'm sure you could write it in a jiffy. Or you could petition Toon to do a new one. > (It would be easier to "port" derived iterator types if there was > a detailed how-to somewhere.) Really? There's almost nothing to it, unless they need to calculate complicated default types. The permutation iterator in particular is *really* easy. Off-the-cuff: template <class ElementIterator, IndexIterator> class permutation_iterator : public iterator_adaptor< permutation_iterator<ElementIterator, IndexIterator> , ElementIterator > { typedef iterator_adaptor< permutation_iterator<ElementIterator, IndexIterator> , ElementIterator> super_t; friend class iterator_core_access; public: permutation_iterator() : order_it_() {} explicit permutation_iterator(ElementIterator x, OrderIterator y) : super_t(x), order_it_(y) {} template<class OtherElementIterator, OtherIndexIterator> permutation_iterator( permutation_iterator<OtherIterator> const& r , typename enable_if_convertible<OtherElementIterator, ElementIterator>::type* = 0 , typename enable_if_convertible<OtherIndexIterator, IndexIterator>::type* = 0 ) : super_t(r.base()) {} private: typename super_t::reference dereference() const { return *(this->base() + *this->order_it_); } void increment() { ++this->order_it_; } void decrement() { --this->order_it_; } void advance(typename super_t::difference_type n) { this->order_it_ += -n; } template<class OtherElementIterator, OtherIndexIterator> typename super_t::difference_type distance_to(reverse_iterator<OtherElementIterator, OtherIndexIterator> const& y) const { return y.order_it_ - this->order_it_; } IndexIterator order_it_; }; I'm just guessing. Why don't you put this through its paces, then contribute revised documentation and tests for the new library? > + Problems with MSVC++ 7.0 (as ever) and dereference (I guess this is > a problem with default types). Demonstrated with reverse_iterator: > > > int numbers[] = { 1,2,3,4,5,6,7 }; > const int N = sizeof(numbers)/sizeof(int); > std::vector<int> v( numbers, numbers + N ); > > typedef boost::reverse_iterator< std::vector<int>::iterator > > reverse_iterator; > reverse_iterator rit( v.begin() ); > > if( *rit == v[0] ) // Does not compile > { } > > if( v[0] == *rit ) // Does not compile > { } What is the error message you get? ** Did you read it? ** The problem is most likely that vc7 has no partial specialization and thus can't deduce the value_type of an int*. If you manually specialize boost::detail::iterator_traits it should work. -- Dave Abrahams Boost Consulting www.boost-consulting.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost