C++ : Aliases in function argument
<p>I have an issue with the use of aliases in function arguments. Here is my problem.</p>

<p>Let's consider this function definition</p>

<pre><code>void thisIsSparta(int&amp; number){
    ...
}
</code></pre>

<p>at call time, it works perfectly well with the following code :</p>

<pre><code>int king = 1;
thisIsSparta(king);
</code></pre>

<p>but I have a mismatch error when I try this :</p>

<pre><code>thisIsSparta(1);
</code></pre>

<p>I can easily guess that the error occurs because there is simply no variable to alias, hence the error. However, I don't want the programmer to worry about using only one of the two approaches, this second function call should work as fine !</p>

<p>The only solution I see is to create another function with no alias argument, in addition to the first one :</p>

<pre><code>void thisIsSparta(int number){

}
</code></pre>

<p>But this would result in an awful code duplication, and I'm not a huge fan of this. </p>

<p>Furthermore, the program could decide to use this second definition instead of the former when I use a variable. I then loose the interest of the alias, whose purpose is to avoid variable copy.</p>

<p>Does anyone have a solution to my problem ? Indeed, this is a simplified example, in practice I have a generic type in argument for this function, and it could be arbitrarily big. This is why I'd like to use an alias to avoid copy.</p>
