| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"Alexander Stippler" |
| Date: |
03 Sep 2003 07:33:47 AM |
| Object: |
usage of keyword template / standard |
Hi,
I'm not quite sure if I have to use the keyword template in a situation,
where my compiler enforces it, though I think it is not neccessary. My
question is: Who is wrong with respect to the standard - the compiler or I?
template <typename T>
struct A
{
template <typename C>
bool
test();
static size_t value = sizeof(A<T>::test<T>());
};
Do I need to qualify test by 'template'. IMO no.
It would be different in a context like
sizeof(T::template test<T>())
Am I wrong?
regards,
alex
.
|
|
| User: "Attila Feher" |
|
| Title: Re: usage of keyword template / standard |
03 Sep 2003 07:40:18 AM |
|
|
Alexander Stippler wrote:
Hi,
I'm not quite sure if I have to use the keyword template in a
situation, where my compiler enforces it, though I think it is not
neccessary. My question is: Who is wrong with respect to the standard
- the compiler or I?
template <typename T>
struct A
{
template <typename C>
bool
test();
static size_t value = sizeof(A<T>::test<T>());
};
Do I need to qualify test by 'template'. IMO no.
It would be different in a context like
sizeof(T::template test<T>())
Am I wrong?
You are. A<T> is also dependent on T.
--
Attila aka WW
.
|
|
|
| User: "Attila Feher" |
|
| Title: Re: usage of keyword template / standard |
03 Sep 2003 07:44:26 AM |
|
|
Attila Feher wrote:
[SNIP]
template <typename T>
struct A
{
template <typename C>
bool
test();
static size_t value = sizeof(A<T>::test<T>());
};
Do I need to qualify test by 'template'. IMO no.
It would be different in a context like
sizeof(T::template test<T>())
Am I wrong?
You are. A<T> is also dependent on T.
From the standard, where it says what is dependent:
— a templateid in which either the template name is a template parameter or
any of the template arguments is a dependent type or an expression that is
typedependent
or valuedependent.
Clearly A is a template ID and the template argument is clearly a dependent
type.
--
Attila aka WW
.
|
|
|
|
|

|
Related Articles |
|
|