R
Richard Hayden
Hi,
I'm just learning about C++ templates and can't understand why the
following code is not working as expected:
/*************************************\
#include <iostream>
template<class C>C func(C c) {
return c;
}
int main(int argc, char** argv) {
std::cout << afunc(23); // OUTPUTS '5' INSTEAD OF '23'
}
/*************************************\
I'd be very grateful if someone could explain to me why this code is not
working as expected and outputting '5' instead of '23'.
Thanks,
I'm just learning about C++ templates and can't understand why the
following code is not working as expected:
/*************************************\
#include <iostream>
template<class C>C func(C c) {
return c;
}
int main(int argc, char** argv) {
std::cout << afunc(23); // OUTPUTS '5' INSTEAD OF '23'
}
/*************************************\
I'd be very grateful if someone could explain to me why this code is not
working as expected and outputting '5' instead of '23'.
Thanks,