Original Post
template <class T0, class T1>
void function(T0 i, T1 c)
{
std::cout << __FUNCTION__ << ": (" << i << ", " << c << ")" << std::endl;
}
int main()
{
function( "hello there", 345 );
return 0;
}
template <class T0, class T1>
void function(T0 i, T1 c)
{
std::cout << __FUNCTION__ << ": (" << i << ", " << c << ")" << std::endl;
}
int main()
{
function( "hello there", 345 );
return 0;
}
Quote:
Original post by omgomghilol
You've missed it.
Quote:
Original post by Endar
Anything else that might be not easily noticed but useful and important?
class Test{public: template<typename T> Test& operator=(const T& val) { std::cout << "operator=() called" << std::endl; }};int main(){ Test a; Test b; a = b;}Quote:
Original post by joanusdmentia Quote:
Original post by Endar
Anything else that might be not easily noticed but useful and important?
*** Source Snippet Removed ***
.....won't call the operator=() that you defined.
void f(int i){}template <typename t> void f(T t){}int main(){ int i = 3; f(3);}class foo { template <typename T> foo(T const& t) { /* stuff */ }};
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more