How can a class template store either reference or value? : <p>Reading about <a href="https://isocpp.org/blog/2012/11/universal-references-in-c11-scott-meyers" rel="noreferrer">universal references</a> led me to wonder: how can I construct a class template such that it stores by reference if possible, or by value if it must?</p>

<p>That is, can I do something like this</p>

<pre><code>template &lt;class T&gt;
class holder {
    T  obj_m;  // should be a reference if possible...
public:
    holder(T t) :obj_m { t } {}
}

auto 
hold_this(T &amp;&amp; t) { return holder&lt;T&gt;(t); }
</code></pre>

<p>Except that when <code>hold_this()</code> is given an <em>lvalue</em> the holder will hold a reference, and when given an <em>rvalue</em> the holder will make a copy?</p>
