Different classes instantiated from templates SHARE static members!!!
Different classes instantiated from templates SHARE static members!!!
- Subject: Different classes instantiated from templates SHARE static members!!!
- From: Scott Ribe <email@hidden>
- Date: Fri, 05 Jan 2007 16:48:19 -0700
- Thread-topic: Different classes instantiated from templates SHARE static members!!!
Holy Cow! Am I going to have to keep a machine with CodeWarrior on it for
the next 10 years???
The following outputs "foo2 - foo2" instead of "foo1 - foo2"!
template< typename T > class t { public: static const char * foo; };
typedef t< char > c1;
template< typename T > const char * c1::foo = "foo1";
typedef t< float > c2;
template< typename T > const char * c2::foo = "foo2";
int main (int argc, char * const argv[]) {
c1 obj1; c2 obj2;
std::cout << obj1.foo << " - " << obj2.foo << std::endl << std::flush;
return 0;
}
radar://4911573
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden