title: Is guaranteed that class members are disposed at the time that the class is disposed
body: <p>I have the following situation:</p>
  
  <p>I have class A that contains a stack member object from class B:</p>
  
  <pre><code>Class A{
      B b;
  }
  </code></pre>
  
  <p>I am using B object to redefine the behavior of the initialization and destruction of A.</p>
  
  <pre><code>Class B{
      B(){cout&lt;&lt;"taken care of some specific context initialization"&lt;&lt;endl;}
      ~B(){cout&lt;&lt;"cleaning the context initialization done before"&lt;&lt;endl;}
  }
  </code></pre>
  
  <p>This is working so far because ~B() is being called when b is destroyed (I guess it is done after A destructor).</p>
  
  <p>This is the behavior I am looking for, but I am scared about the possibility of the compiler saying: "Hey, you are not using the object, I am going to reclaim the memory before". I guess it should to happen, but is it possible in any compiler? I mean, is it set on the standard that you have to wait for A to be destroyed?</p>
  
  <p>Thanks in advance</p>