title: What is the lifetime of class static variables in C++?
body: <p>If I have a class called Test ::</p>
  
  <pre><code>class Test
  {
      static std::vector&lt;int&gt; staticVector;
  };
  </code></pre>
  
  <p>when does <strong>staticVector</strong> get constructed and when does it get destructed ?</p>
  
  <p>Is it with the instantiation of the first object of Test class, or just like regular static variables ?</p>
  
  <p><em>Just to clarify, this question came to my mind after reading Concepts of Programming Languages (Sebesta Ch-5.4.3.1) and it says ::</em></p>
  
  <blockquote>
    <p>Note that when the <strong>static</strong> 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.</p>
  </blockquote>
  
  <p><strong>did you understand? :(</strong></p>