
Using gcc 3.2 (on MinGW) the template parameter defaults for indirect_iterator_generator don't work with shared_ptr. This has been discussed* on the list before, but there doesn't seem to have been a user-friendly resolution to the issues involved (at least not in release 1_30_0). Using my compiler, the current situation requires the client code to supply all five of the template parameters. *some previous threads on the subject: http://groups.yahoo.com/group/Boost-Users/message/1618 http://lists.boost.org/MailArchives/boost/msg33273.php http://lists.boost.org/MailArchives/boost/msg33316.php My sample code: #include <boost/iterator_adaptors.hpp> #include <boost/shared_ptr.hpp> #include <list> int main () { typedef std::list<boost::shared_ptr<int> > ListType; typedef ListType::iterator BaseIterator; typedef boost::indirect_iterator_generator<BaseIterator>::type Adapter; } Error output: f:/mingw/include/c++/3.2/bits/stl_iterator_base_types.h: In instantiation of `std::iterator_traits<boost::shared_ptr<int> >': d:/CVS/boost/boost/boost/iterator_adaptors.hpp:1111: instantiated from `boost::detail::iterator_traits<boost::shared_ptr<int> >' d:/CVS/boost/boost/boost/iterator_adaptors.hpp:1111: instantiated from `boost::detail::traits_of_value_type<main()::BaseIterator>' iterator_adapter.cc:9: instantiated from here f:/mingw/include/c++/3.2/bits/stl_iterator_base_types.h:123: no type named ` iterator_category' in `class boost::shared_ptr<int>' f:/mingw/include/c++/3.2/bits/stl_iterator_base_types.h:125: no type named ` difference_type' in `class boost::shared_ptr<int>' Looking at iterator_adaptors.hpp:1111 we have (reformatted): struct traits_of_value_type { typedef typename boost::detail::iterator_traits<T>::value_type outer_value; typedef typename boost::detail::iterator_traits<outer_value>::value_type value_type; typedef typename boost::detail::iterator_traits<outer_value>::reference reference; typedef typename boost::detail::iterator_traits<outer_value>::pointer pointer; }; So traits_of_value_type tries to look up the *iterator_traits* of the *value type* for the supplied iterator. Does the value type really need to have complete iterator traits for the compiler to figure out the defaults here? Is anybody working on improving the ease-of-use for indirect_iterator_generator? -- Raoul Gough "Let there be one measure for wine throughout our kingdom, and one measure for ale, and one measure for corn" - Magna Carta