Roland Richter <[EMAIL PROTECTED]> writes:

> Hi,
>
> as mentioned in the docs, it is necessary to tell MS VC++
> all template parameters of an iterator_adaptor *explicitly*.

No, not usually.  If the docs say that, they should be fixed.

> Unfortunately, it seems one cannot do that for a permutation_iterator,
> since permutation_iterator_generator just takes ElementIterator
> and IndexIterator as its template parameters.
>
> I propose extending the code like this:
>
> template< typename ElementIterator, typename IndexIterator,
>            // Reasonable default, but can be passed explicitly for MSVC:
>            typename ValueType = 
>boost::detail::iterator_traits<ElementIterator>::value_type
>            // etc.
>           >
> struct permutation_iterator_generator
> {
>      typedef boost::iterator_adaptor
>      < ElementIterator,
>        permutation_iterator_policies< IndexIterator >,
>        ValueType
>        // etc.
>      > type;
> };
>
> in order to write something like
>
> typedef permutation_iterator_generator<
>      element_range_type::iterator,
>      index_type::iterator,
>      element_range_type::value_type // tells MSVC++ the value_type
>    >::type
>
>
> to keep MSVC quiet.
>
> I'm not sure, but I think I saw the same trick for some other
> iterator adaptors. Comments?

IIRC, it doesn't work if ElementIterator happens to be a pointer,
because the default expression is evaluated even if you supply that
argument.  On the other hand, the new strategy for pointer iterators
is to ask the user to specialize boost::detail::iterator_traits
manually.  We supply boost::detail::ptr_iterator_traits to help with
that.

We are working on a redesign of the library, currently in
$BOOST_SANDBOX/boost/iterator/iterator_adaptors.hpp.  We don't have a
permutation iterator in there yet.

HTH,
-- 
                       David Abrahams
   [EMAIL PROTECTED] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to