title: How to combine type constraints & implicit conversions with C++11 universal references?
body: <p>In a function I need to distinguish among lvalue and rvalue references, so the obvious path is to overload:</p>
  
  <pre><code>void myfunc(A&amp;&amp; a);
  void myfunc(const A&amp; a);
  </code></pre>
  
  <p>This has exactly the desired behaviour, with well defined type and implicit conversions. However there's too much code duplication and I'd prefer to encapsulate the relevant decisions inside, keeping only a single function, therefore passing by universal reference might be an option:</p>
  
  <pre><code>template &lt;typename A&gt;  void myfunc(A&amp;&amp; a);
  </code></pre>
  
  <p>However this has the unfortunate drawback that now any object can be passed as first parameter, so one might impose constraints via enable_if:</p>
  
  <pre><code>template &lt;typename T, class  = typename enable_if&lt;
      is_same&lt;typename remove_const&lt;typename    remove_reference&lt;T&gt;::type&gt;::type, A&gt;::value,
      T&gt;::type&gt;   
  void myfunc( T&amp;&amp;  a);
  </code></pre>
  
  <p>This almost seems to do the job, but (I guess by templatizing already) we have lost a nice property of overloads which can trigger implicit conversion constructors to type A (say from type C parameters). Overloads are NOT an option since some functions might have 3 or more A&amp;&amp; parameters, no intention to deal with combinatorial explosion. Can implicit conversions be somehow recovered? 
  Of course one workaround might be e.g. to add other allowed parameter types for A, and perform any needed conversion in the main function, but this is intrusive, ugly, explicits implicits and generates confusion (the original C parameter might be an lvalue [reference] and yet produce an rvalue by conversion). Any better way?</p>