
"Kris Braun" <kbraun@rim.net> writes:
Hi there,
I could really use the features provided by iterator adaptors part of the library, but I'm having a lot of trouble getting a nested set of adaptors to compile. In one case, I'd like to return an iterator into std::map< std::string, boost::shared_ptr< ApiOption > >, and have it return references to options in which option->isTemplate( ) is false. Conceptually, I'd like a filter_iterator->indirect_iterator-
projection_iterator chain.
I've been using this typedef to project onto the second member of the pair: typedef boost::projection_iterator_pair_generator< select_second< std::string, boost::shared_ptr< ApiOption > >, ^^^^^^^^^^^^^ Where is select_second defined with two template parameters?
OptionMap::iterator, OptionMap::const_iterator > OptionMapIterators;
Do you need both const and non-const iterators? If not, the pair_generator is probably overkill.
but I've been at a loss to add indirect_iterator and filter_iterator into the mix. Can anyone help me get unstuck?
I can't really tell what's going on here, but it looks like you haven't got step 1 right. Maybe you should try to compile a test program that just uses the projection you want. Also, I don't think the existing iterator adaptor fulfills its promise to work properly with smart pointers. I am sure that you can do it (and more easily too) using the sandbox iterator adaptors if that's an option for you. // untested filter_iterator< std::logical_not< boost::mem_fun_ref_t<bool, &ApiOption::isTemplate>
, indirect_iterator< transform_iterator< select_second<boost::shared_ptr<ApiOption> > , OptionMap::iterator> >
HTH, -- Dave Abrahams Boost Consulting www.boost-consulting.com