title: How to initialize static class member with nontrivial constructor?
body: <p>It is trivial in C#, but in C++ (native, Win32, Visual C++) I don't see solution. So, I have class MyClass1 with non-trivial constructor, and in MyClass2 I want to have static member of type MyClass1:</p>
  
  <p>MyClass1.h:</p>
  
  <pre><code>class MyClass1 
  {
     public MyClass1(type1 arg1, type2 arg2);
  }
  </code></pre>
  
  <p>MyClass2.h:</p>
  
  <pre><code>class MyClass2
  {
  public:
     static MyClass1 Field1;
  }
  </code></pre>
  
  <p>And MyClass2.cpp:</p>
  
  <pre><code>MyClass1 MyClass2::Field1(arg1, arg2);
  </code></pre>
  
  <p>I expect that such code will initialize MyClass2::Field and call MyClass1 constructor during this initialization. However, it looks like compiler allocates memory for Class1 only, and never calls constructor, like if I do this:</p>
  
  <pre><code>MyClass1 MyClass2::Field1 = *(MyClass1 *)malloc(sizeof(MyClass1));
  </code></pre>
  
  <p>Is there any "official" way in C++ to initialize static class member with nontrivial constructor?</p>