Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-08-06 19:39:19


> -----Original Message-----
> From: tamboril_at_[hidden] [mailto:tamboril_at_[hidden]]

> I can't compile this on MSVC SP 5:
>
> template <typename T>
> class foo
> {
> typedef
> boost::iterator_traits_generator::value_type<T>::reference<int&> jj;
> };
>

boost::iterator_traits_generator::value_type<T> is a dependent type, so in
fact you need to write:

template <typename T>
class foo
{
    typedef typename boost::iterator_traits_generator
        ::value_type<T>
        ::template reference<int&>
        jj;
};

Hmm, I tried it and MSVC doesn't accept it either. You can force it to
compile this particular example by changing the order of 'value_type<T>' and
'reference<int&>' template-ids, i.e.

template <typename T>
class foo
{
    // note that you don't need 'typename' & 'template' here
    typedef boost::iterator_traits_generator
        ::reference<int&>
        ::value_type<T>
        jj;
};

but probably you real case is more complicated, so I am afraid you'll have
to give up on named template parameters and write
'boost::iterator_traits_generator<T, T&, ...> instead.

Aleksey


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