title: Passing shared pointers as arguments
body: <p>If I declare an object wrapped in a shared pointer:</p>
  
  <pre><code>std::shared_ptr&lt;myClass&gt; myClassObject(new myClass());
  </code></pre>
  
  <p>then I wanted to pass it as an argument to a method:</p>
  
  <pre><code>DoSomething(myClassObject);
  
  //the called method
  void DoSomething(std::shared_ptr&lt;myClass&gt; arg1)
  {
     arg1-&gt;someField = 4;
  }
  </code></pre>
  
  <p>Does the above simply increment the shared_pt's reference count and everything is cool? Or does it leave a dangling pointer?</p>
  
  <p>Are you still supposed to do this?:</p>
  
  <pre><code>DoSomething(myClassObject.Get());
  
  void DoSomething(std::shared_ptr&lt;myClass&gt;* arg1)
  {
     (*arg1)-&gt;someField = 4;
  }
  </code></pre>
  
  <p>I think that the 2nd way may be more efficient because it only has to copy 1 address (as opposed to the whole smart pointer), but the 1st way seems more readable and I do not anticipate pushing performance limits. I just want to make sure there's not something dangerous about it.</p>
  
  <p>Thank you.</p>