|
-
September 22nd, 2002, 01:14 PM
#1
ANSI defined template design wont compile --->
From MCVC7.0 compiler error description:
invalid template argument 'number', constant expression expected
The template argument does not match the template declaration; a constant expression should appear within the angle brackets. Variables are not allowed as template actual arguments. Check the template definition to find the correct types.
The following sample generates C2975:
// C2975.cpp
template <char *P>
class x
{
char * f()
{
return P;
}
};
x<"abc"> *p = 0; // C2975 addr of object with internal linkage
Just what in all **** dont it like ? there is a simple const char design-time constant "abc" passed as a parameter to template.
I tried to compile this and it wont of course.... How to overcome this stupid glitch ? Isnt it a standard C++ ?!?!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|