title: does push_back() "new" an object before to add to the std::list in c++
body: <p>I am new to c++ standard library. I want use std::list. I know if I create a list by myself instead of using stl, I should allocate memory to a new object, and then add it to the list.</p>
  
  <p><em>a c-style list of class A:</em></p>
  
  <pre><code>A *ptrA = new A();     
  ptrA-&gt;setElement(value);
  ptrA-&gt;next = null;
  currentPositionMyCstyleList-&gt;next = ptrA;
  ptrA-&gt;prev = currentPositionMyCstyleList;
  </code></pre>
  
  <p>If I using stl, is it necessity to "new" an object? Does push_back() "new" an object before to add to the std::list in c++?</p>
  
  <p><em>Does Code below correct?</em></p>
  
  <pre><code>A aObj(value);     
  listA.push_back(aObj); // Will push_back() "new" an object and copy the value of aObject to the object before add it to list
  </code></pre>
  
  <p><em>Will the value of aObj be released in code below:</em></p>
  
  <pre><code>funcAddToList() {
      A aObj(value);     
      listA.push_back(aObj);
  }
  funcDispList() {
      // display listA  // Does the value of aObj still in list?
  }
  </code></pre>
  
  <p>What does push_back() actually do? </p>
  
  <p>I still confuse after reading <a href="https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/stl_list.h#L1097" rel="noreferrer">stl_list.h_push_back()</a>  , <a href="https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/stl_list.h#L1768" rel="noreferrer">_M_insert</a>, <a href="https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/stl_list.h#L566" rel="noreferrer">_M_create_node</a></p>
  
  <p>Thanks for your time.</p>