Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 32,688 of 33,346    |
|    =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All    |
|    Re: Singletons    |
|    24 Nov 12 15:59:16    |
      From: daniel.kruegler@googlemail.com              Am 24.11.2012 19:47, schrieb Frank Birbacher:       > Am 22.11.12 06:26, schrieb Daniel Krügler:       >> So you suggest that everyone who uses your singleton is supposed       >> to call the init function? The advantage of a singleton is to hide       >> such internal issues.       >       > So, what if you need to pass arguments to initialization?       >       >> I also don't see how you can compile-time enforce the essential       >> invariant of a singleton - namely that only one object of type X       >> exists.       >       > The header does not even define a class type. So how could anyone       > create an instance of it? The mapping that Matthew proposes is:       >       > Logger::GetInstance().doFoo() becomes Logger::doFoo()       > where Logger is changed from a class to a namespace. All data is       > defined only in the cpp.       >       > The concept is old. Before object orientation this approach was the       > way to go.              I must say that I haven't understood that from the OP. I'm familiar with       what you describe above but I don't consider it as a classical singleton       and I surely had not recognized by the posting.              I agree that it has in common with the singleton pattern that it       provides a global point of access of functionality. It might be useful       to add in this context (and to keep some relation to C++ in this       discussion) that CORBA's ORB_init / destroy functions corresponds to       what the OP describes here.              Greetings from Bremen,              Daniel Krügler                     --        [ See http://www.gotw.ca/resources/clcm.htm for info about ]        [ comp.lang.c++.moderated. First time posters: Do this! ]              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca