F
Frank Neuhaus
(Sorry I accidently submitted the question twice)
Hi
I've got a question on the initialization of static member variables. I have
some class that has a static member variable (some std::vector<something>*)
and a static member function. In the cpp corresponding to the class, the
variable is initialized like this:
std::vector<something>* TestClass::myStaticVar=new std::vector<something>();
Now my static function does something with this vector. I have observed
cases where the "myStaticVar" has a value of 0 when accessed from the static
function. I have tried to reproduce this behaviour in a smaller sample but
it always worked there for some reason.
Does anyone have an idea in what cases these static variables are properly
initialized?
Thanks alot
Hi
I've got a question on the initialization of static member variables. I have
some class that has a static member variable (some std::vector<something>*)
and a static member function. In the cpp corresponding to the class, the
variable is initialized like this:
std::vector<something>* TestClass::myStaticVar=new std::vector<something>();
Now my static function does something with this vector. I have observed
cases where the "myStaticVar" has a value of 0 when accessed from the static
function. I have tried to reproduce this behaviour in a smaller sample but
it always worked there for some reason.
Does anyone have an idea in what cases these static variables are properly
initialized?
Thanks alot