Каково время жизни статических переменных класса в C ++?
Если у меня есть класс с именем Test ::
class Test
{
static std::vector<int> staticVector;
};
когдаstaticVector построить и когда он разрушается?
Это связано с созданием первого объекта класса Test или с обычными статическими переменными?
Just to clarify, this question came to my mind after reading Concepts of Programming Languages (Sebesta Ch-5.4.3.1) and it says ::
Note that when the static modifier appears in the declaration of a variable in a class definition in C++, Java and C#, it has nothing to do with the lifetime of the variable. In that context, it means the variable is a class variable, rather than an instance variable. The multiple use of a reserved word can be confusing particularly to those learning the language.
did you understand? :(