I'm playing around with user-defined-literals (with GCC 4.7).
double operator"" _lb(long double n)
{
return n * 0.453592; // convert pounds to kilos
}
This works fine when passing it a floating point literal (e.g. 42.0_lb
) however when I try to pass an integer literal (e.g. 42_lb
) I get the following error:
error: unable to find numeric literal operator 'operator"" _lb'
Shouldn't my definition of _lb
cause an implicit conversion between the parameter to long double
(as it would with regular functions)?