Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-03-05 06:10:35


David Abrahams wrote:
> I was just getting ready to propose a new config macro called
> BOOST_ARG_DEPENDENT_TYPENAME based on this test:
>
> struct id { typedef int type; };
>
> template <class T> struct foo;
>
> template <class T>
> void f(T)
> {
> typedef foo<typename T::type> y;
> }
>
> int main()
> {
> f(id());
> return 0;
> }
>
> But it turns out that this test is very similar to the one for
> BOOST_DEDUCED_TYPENAME, and in fact it finds the same compiler (VC6).
> So I guess the question is, do we currently have the right name for
> the test and macro? VC6 will support typename on template arguments
> in some contexts:
>
>
> struct id { typedef int type; };
>
> template <class T>
> void f(T)
> {
> typedef typename T::type x;
> }
>
> int main()
> {
> f(id());
> return 0;
> }

This means that you could have rewritten the above f as

template <class T>
void f(T)
{
    typedef typename T::type x;
    typedef foo<x> y;
}

Perhaps you should test

template <class T> foo<typename T::type> f(T);

instead, if that's what you need.


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