Hello everyone :)
I have the following small code:
template <typename T>
class V
{
public:
T x;
explicit V(T & _x)
:x(_x){}
};
int main()
{
V<float> b(1.0f); // fails
return 0;
}
And it happens to fail. The message returned by g++ 4.4.5 is:
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o"main.o" "../main.cpp"
../main.cpp: In function ‘int main()’:
../main.cpp:19: error: no matching function for call to ‘V<float>::V(float)’
../main.cpp:10: note: candidates are: V<T>::V(T&) [with T = float]
../main.cpp:6: note: V<float>::V(const V<float>&)
The thing is... whence the second constructor came? I really have no clue...