title: std::find_if map to object
body: <p>Should I use example 1 or example 2 for map pointer from find_if to object
  Which one is the best?</p>
  
  <pre><code>struct test {
   INT id
  }
  
  std::vector&lt;std::shared_ptr&lt;test&gt;&gt; vec;
  
  int ID = 75;
  
  auto obj = std::find_if(vec.begin(), vec.end(), [&amp;ID](std::shared_ptr&lt;test&gt;&amp; r){
   return r-&gt;id == ID;
  });
  
  if ( obj != vec.end() ) {
   // example 1
   std::shared_ptr&lt;test&gt; example1 = (*obj);
  
   // example 2 by reference
   std::shared_ptr&lt;test&gt;&amp; example2 = (*obj);
  }
  </code></pre>