--- David Abrahams <dave@boost-consulting.com> wrote:
Need more details. Post a reproducible test that fails compilation and I might be able to solve your problem.
Okay, here's all the code for the test: #include <map> #include <boost/iterator/transform_iterator.hpp> #include <boost/iterator/indirect_iterator.hpp> template< class Pair > struct select_second { typedef typename Pair::second_type result_type; typename Pair::second_type& operator( )( Pair& pair ) { return pair.second; } const typename Pair::second_type& operator( )( const Pair& pair ) const { return pair.second; } }; template< class Iterator > struct map_iterator { typedef boost::transform_iterator< select_second< typename Iterator::value_type >, Iterator > type; static type Create( const Iterator& iter ) { return type( iter ); } }; template< class Iterator > struct pointer_map_iterator { typedef typename map_iterator< Iterator >::type inner_type; typedef boost::indirect_iterator< inner_type > type; static type Create( const Iterator& iter ) { return type( inner_type( iter ) ); } }; typedef std::map< int, int* > MapType; typedef pointer_map_iterator< MapType::iterator > iterator_generator; typedef pointer_map_iterator< MapType::const_iterator
const_iterator_generator; typedef iterator_generator::type iterator; typedef const_iterator_generator::type const_iterator;
struct Foo { iterator begin( void ) { return iterator_generator::Create( m.begin( ) ); } iterator end( void ) { return iterator_generator::Create( m.end( ) ); } MapType m; }; void foo( void ) { Foo f; for( const_iterator i = f.begin( ); i != f.end( ); ++i ) { } } When compiled with VC7.1, this produces: src\util\test.cpp(53) : error C2440: 'initializing' : cannot convert from 'iterator' to boost::indirect_iterator<Iterator>' with [ Iterator=pointer_map_iterator<std::map<int,int *>::const_iterator>::inner_type ] No constructor could take the source type, or constructor overload resolution was ambiguous src\util\test.cpp(53) : error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'const_iterator' (or there is no acceptable conversion) Thanks, Kris __________________________________ Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want. http://antispam.yahoo.com/tools