Template Class Static Data Instantiation?
<p>Any one can tell me what on earth is going on in this code?</p>

<pre><code>#include &lt;iostream&gt;

class BBB {

    public:

    BBB() { std::cout &lt;&lt; std::endl &lt;&lt; "BBB()" &lt;&lt; std::endl; }

    ~BBB() { std::cout &lt;&lt; std::endl &lt;&lt; "~BBB()" &lt;&lt; std::endl; }

};

template&lt;class T&gt; 
class AAA {

    public:

    AAA(){}
   ~AAA(){}

   void foo() {}

   private:

   static BBB b;
};

template&lt;class T&gt;
BBB AAA&lt;T&gt;::b;

//class CCC {
//
//private:
//    
//    static BBB bb;
//
//};
//
//BBB CCC::bb;

AAA&lt;int&gt; a;

int main()
{
    //AAA&lt;int&gt; a;
    a.foo();

    return 0;
}
</code></pre>

<p>It seems that the constructor of "b" object in AAA is not called when the containing class is template.   Try uncomment the CCC class definition and the "bb" object constructor will be called.  This is strange since the template class A is instantiated.</p>

<p>Help is greatly appreciated.</p>
