Can we initialize structure memebers through smart pointer in initialization list?
<pre><code>#include &lt;boost/scoped_ptr.hpp&gt;

class classA
{
protected:
    struct StructB
    {
        int iAge;
        double dPrice;
    };

    boost::scoped_ptr&lt;StructB&gt; m_scpStructB;

public:
    classA(int age, double price)
        : m_scpStructB(new StructB)
    {
        m_scpStructB-&gt;iAge = age;
        m_scpStructB-&gt;dPrice = price;
    }

    /* DO NOT COMPILE  &lt;= second block
    classA(int age, double price)
        : m_scpStructB(new StructB),
          m_scpStructB-&gt;iAge(age),
          m_scpStructB-&gt;dPrice(price)
    {}
    */

};
</code></pre>

<p>Question1> I have found that I cannot use the second block of code to initialize structure members pointed by a smart pointer. Is it a general c++ rule that we just cannot do it.</p>

<p>Please discard this question if the answer to the first question is "You cannot do it".</p>

<p>Question2> As far as I know, the order of assignment on initialization list is based on the order of member variables definition. Assume that you can initialize the member variables through smart pointer. How can you guarantee the order so that the smart point is initialized always first?</p>
