Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2004-01-26 18:42:50


On Jan 26, 2004, at 3:12 PM, Daryle Walker wrote:

> What about:
>
> template < typename U > class my_template;
> //...
> template < typename T > class my_template<T[]> { /*...*/ };
> template < typename T > class my_template<T*> { /*...*/ };
>
> Are those last two entries considered the same? If so, then we can't
> use
> this technique.

template < typename U > struct my_template;
//...
template < typename T > struct my_template<T[]> { static const int
value = 1; };
template < typename T > struct my_template<T*> { static const int
value = 2; };

#include <iostream>

int main()
{
        std::cout << my_template<int[]>::value << ' '
                  << my_template<int*>::value << '\n';
        
}

prints out:

1 2

for me. Does that address your concern, or have I missed your point?

-Howard


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