Re: PeerInfo and PeerId

Hi Petr,

I thought so at first (class can be considered as a namespace from my point of view), but then I did a little bit of searching and found that “namespace scope” != “class scope”.[snip]

They are different, but I think it does not make a big difference in our case. This page sheds some light on the issue:

“Static data members of a class in namespace scope have external linkage.”

“The definition of a static data member is equivalent to an external variable definition. You must define the static member outside of the class declaration in namespace scope.”

“Once you define a static data member, it exists even though no objects of the static data member’s class exist.”

So static data members are just like static variables declared in namespace scope.

Well, if we don’t want to restrict our classes to use only intrinsic/primitive types, then initializing complex objects in the Test class ctor seems to me as the only solution, too.

We should do so then!

Regards,

Peter

Would you like to post a relpy?


This post is a reply to:
Re: PeerInfo and PeerId
Hi Peter, Do static objects of class scope belong to the objects of namespace scope? I thought so at first (class can be considered as a namespace from my point of view), (more...)

Follow-ups:
Re: PeerInfo and PeerId
Hi Peter, They are different, but I think it does not make a big difference in our case. This page sheds some light on the issue: [snip] So static data members are just (more...)