title: Avoid exponential grow of const references and rvalue references in constructor
body: <p>I am coding some templated classes for a machine learning library, and I'm facing this issue a lot of times. I'm using mostly the policy pattern, where classes receive as template argument policies for different functionalities, for example:</p>
  
  <pre><code>template &lt;class Loss, class Optimizer&gt; class LinearClassifier { ... }
  </code></pre>
  
  <p>The problem is with the constructors. As the amount of policies (template parameters) grows, the combinations of const references and rvalue references grow exponentially. In the previous example:</p>
  
  <pre><code>LinearClassifier(const Loss&amp; loss, const Optimizer&amp; optimizer) : _loss(loss), _optimizer(optimizer) {}
  
  LinearClassifier(Loss&amp;&amp; loss, const Optimizer&amp; optimizer) : _loss(std::move(loss)), _optimizer(optimizer) {}
  
  LinearClassifier(const Loss&amp; loss, Optimizer&amp;&amp; optimizer) : _loss(loss), _optimizer(std::move(optimizer)) {}
  
  LinearClassifier(Loss&amp;&amp; loss, Optimizer&amp;&amp; optimizer) : _loss(std::move(loss)), _optimizer(std::move(optimizer)) {}
  </code></pre>
  
  <p>Is there some way to avoid this? </p>