title: Is it a good practice to instantiate an object with auto?
body: <p><strong>solution 1 :</strong></p>
  
  <pre><code>auto a = A()
  </code></pre>
  
  <p><strong>Solution 2 :</strong></p>
  
  <pre><code>A a;
  </code></pre>
  
  <p>I was wondering which one of the two solutions is the best manner to instantiate an object ?</p>
  
  <p>I know that the <strong>solution 1</strong> calls the default constructor and then the copy constructor, but I really don't know if there is any advantages of writing that. </p>
  
  <p><strong>Edit:</strong>  I wrote a small class to test by my own and it appears that in accordance with the comments, these two "solutions" have exactly the same behavior. </p>
  
  <pre><code>class A
  { 
      public: 
      A(){
          std::cout &lt;&lt;"default_constructor\n";
      }
      A(const A &amp;g){
          std::cout &lt;&lt;"copy_constructor\n";
      }
  }; 
  </code></pre>
  
  <p>solution 1 :  </p>
  
  <blockquote>
    <p>default_constructor</p>
  </blockquote>
  
  <p>solution 2 :</p>
  
  <blockquote>
    <p>default_constructor</p>
  </blockquote>