std::tuple<> of one std::shared_ptr<> does not work?
<p>I recently discovered a problem with using <code>std::tuple&lt;&gt;</code> for just one element. I created a class for type erasure and retaining N number of reference counted objects. However the reference counted object is not retained if it is the only one in the <code>std::tuple&lt;&gt;</code>.</p>

<p>Am I doing something wrong?</p>

<pre><code>class token {
public:
  template&lt;typename... Types&gt;
  token(Types... types) : _self(std::make_shared&lt;const std::tuple&lt;Types...&gt;&gt;(std::make_tuple(std::move(types)...))) {}

  // Why do I need this special version of the constructor?
  // Uncomment and the code will work!
  //template&lt;typename T&gt;
  //token(T t) : _self(std::make_shared&lt;const T&gt;(std::move(t))) {}
private:
  std::shared_ptr&lt;const void&gt; _self;
};
</code></pre>

<p>Example (tested with Xcode 8.0):</p>

<pre><code>token make_token() {
  std::shared_ptr&lt;int&gt; shared(new int(), [](int* i) {
    // Called immediately if using only tuple constructor!
  });
  return token(shared);
}
token my_token = make_token(); // std::shared_ptr&lt;&gt; is already gone!
</code></pre>