example sources in both Python and C++
Bill McClain
wmcclain at salamander.com
Mon Oct 2 22:43:54 EDT 2000
> > * Template arguments cannot be local types. That means STL
> > containers must use types declared at the outer scope, which
> > is ugly.
> Wait, what?
> Explain what you mean, this is confusing.
> If you mean you can only use types in the outermost, or global scope,
> as template arguments, your compiler is severely broken.
Try this on your compiler and tell me what happens:
***********
#include <list>
class Legal {
int a;
};
int main() {
class Illegal {
int a;
};
list<Legal> ok; // compiles
list<Illegal> nogood; // does not compile
return 0;
}
// g++
// temp.cpp:13: type `main()::Illegal' composed from a local type is not a valid template-argument
// VMS
// %CXX-E-LOCALTYPTMPLARG, a template argument may not reference a local type
// at line number 13 in file CTS_DEVELOPER:[WMCCLAIN]TEMP.CPP;1
***********
I'm too tired to turn on NT to try VC++.
-Bill
More information about the Python-list
mailing list