title: How I can use emplace for unordered_set that holds shared_ptr to the object?
body: <p>Say I have an object:</p>
  
  <pre><code>struct Foo {
      Foo(const std::string&amp; str1, const std::string&amp; str1) 
          : mStr1(str1), mStr2(str2)
      {}
  
      std::string mStr1;
      std::string mStr2;
  };
  </code></pre>
  
  <p>And set</p>
  
  <pre><code>typedef std::unordered_set&lt;std::shared_ptr&lt;Foo&gt; , Hash, Compare&gt; Set;
  </code></pre>
  
  <p>I have custom hasher and compare. But when I say:</p>
  
  <pre><code>Set set;
  set.emplace(str1, str2);
  </code></pre>
  
  <p>I receive compile error, because the constructor of <code>Foo</code> is obviously not a constructor of <code>std::shared_ptr&lt;Foo&gt;</code>. What I would like is when emplace needs to construct a pointer to use <code>std::make_shared&lt;Foo&gt;(str1, str2)</code></p>
  
  <p>It seems that I also need a custom allocator for that, but I did not manage to implement one that satisfy the compiler.</p>
  
  <p>My question is: Is what I want possible. If yes, how - is the allocator the right way to go. If yes, can you point me to an example.  </p>