Originally Posted By: WretchedSid

Kind of, but it wouldn't work without templates either. If you declare it static, you would get an instantiation per compilation unit that makes use of it. Without static, your linker would complain about duplicated symbols. Because it's a template, the linker will collapse the multiple instantiations down to one.


Hmm I'm trying to make sure I get you right here (even if that collapses the thread miles into off-topic, but as it's my thread I guess I can do that), you say if I made this a non-templated method and did something like this
Code:
static Singleton& Instance(){
       static Singleton s;
       return s;
}



that would break when used in a library, too?

EDIT: And you're welcome to post more than one snippet.

Last edited by the_clown; 08/12/14 21:05.