Initialize variable of derived struct type in compile time in c++
<p>I have the next structs:</p>

<pre><code>struct B
{
   int a;
   int b;
};

struct D: public B
{
   int c;
};
</code></pre>

<p>I want to initialize some variable of struct D in compile time, like if I would initialize the struct B it would looks like:</p>

<pre><code>B b1 = { value_of_a, value_of_b };
</code></pre>

<p>I tried to do this in next ways, but it didn't compile:</p>

<pre><code>D d1 = { { value_of_a, value_of_b } , value_of_c };
D d2 = { value_of_a, value_of_b , value_of_c };
</code></pre>

<p>If I change the struct to:</p>

<pre><code>struct D
{
   B bb;
   int c;
};
</code></pre>

<p>it compiles with "d1" and "d2" initialization.</p>

<p>So, the question is how I can initialize the derived struct?
And if there is now rule for initializing derived struct, what is the reasons?</p>

<p>Thank you.</p>
