Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: static vars and templates



I had a real problem with static classes within template classes, which doesn't sound like what you are talking about.

In my case, I had something of the form

template <class F> class FOO
{
private:
....
class BAR
{
public:
int *p;
}
static BAR b;
...
}

The compiler didn't buy it (and wasn't helpful in narrowing down the problem). I finally worked around the problem by declaring the 'int *' as static.

Regards,

Justin

On Sunday, December 22, 2002, at 02:21 PM, Yarden Livnat wrote:

Searching the archive I have found several posts about
the problem of a static var in templated code. However,
I haven't seen any answers or solutions (other then change
the code and define static vars outside the templated code.

so, is there any solution ?

thanks,

Yarden
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.


--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | If you're not confused,
| You're not paying attention
*--------------------------------------*-------------------------------*
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >static vars and templates (From: Yarden Livnat <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.