Boost logo

Boost :

From: Roland Richter (roland_at_[hidden])
Date: 2003-01-13 10:12:20


Hi,

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

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?

- Roland


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk