Advertisement

Static variable initialization

Started by January 14, 2000 06:10 AM
1 comment, last by Gandalf 24 years, 11 months ago
Is it allowed to initialize a static class member in the constructor in C++? Im aware of this thing: (ex. variable class::name=0), but this does not work with a vector. Gandalf the White
Gandalf the Black
It is, but you will re-initialize it each time you create a new instance unless you specifically code your way around it (E.g. create a static boolean "g_bInitialized", which you set to true once the static member(s) is/are initialized).

/Niels
<b>/NJ</b>
Advertisement
I am currently using static STL vectors in my engine, and have no problem initializing it. If I knew a way to use the greater-than and less-than symbols on this message board then I''d show you how I do it.
However, if you''re not using STL (or templates) for your vector implementation than I guess this wouldn''t help you too much

JoeG
joeG

This topic is closed to new replies.

Advertisement