Please note that your code will only compile with the C ++ 11 compiler.
When you pass an integral literal, which by default is of type int, if you are not writing 1L, a temporary type object is created intthat is bound to the function parameter. This is similar to the first of the following initializations:
int &&      x = 1; //ok. valid in C++11 only.
int &       y = 1; //error, both in C++03, and C++11
const int & z = 1; //ok, both in C++03, and C++11
Nawaz  source
share