c++ const reference question
Posted: Fri May 15, 2009 9:53 am
Hi friends,
maybe it is a stupid question, but what is the difference between the two parameters of Foo1 and Foo2? Or, does it the same?
Both functions have (to my mind) a constant reference parameter, which can't be modified. But what does it mean to write the const before or after the 'T' ?
Best regards and many thanks
Orbitcowboy
maybe it is a stupid question, but what is the difference between the two parameters of Foo1 and Foo2? Or, does it the same?
Code: Select all
template <typename T> T Foo1(const T & val)
{
//...
return val;
}
template <typename T> T Foo2(T const & val)
{
//...
return val;
}
Best regards and many thanks
Orbitcowboy