   templates/function overloading
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;}Since when did C++ do this? I am talking about the compiling correct template function without having to specify the template arguments (not the FUNCTION macro). Is this in the standard? Is it only recent compilers that do this? Or have I just completely missed seeing this for the last 2 years?   
  You've missed it.   ;Quote:Original post by omgomghilolYou've missed it.Damn.Anything else that might be not easily noticed but useful and important?;  Well I beleive You don't have to have that "return 0;" at the end of your main-function anymore (if it ever was necessary) ;) But that might not be very useful and/or important :(   ;Quote:Original post by EndarAnything 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;}.....won't call the operator=() that you defined.;Quote:Original post by joanusdmentiaQuote:Original post by EndarAnything else that might be not easily noticed but useful and important?*** Source Snippet Removed ***.....won't call the operator=() that you defined.Really? Why? Will it just call the default assignment operator for the two types?   ;  Because if you have something like the following:void f(int i){}template <typename t> void f(T t){}int main(){    int i = 3;    f(3);}It will call the normal version of the function; to use the template you'd have to do f<int>(i);In the case of the = operator, the compiler provides one by default that will be used instead of your template version.   ;  The same rule applies to copy constructors - the following won't override the compiler-generated foo::foo(foo const&):class foo {  template <typename T>  foo(T const& t) { /* stuff */ }};;  It's called "template inference", and free functions do it - class functions generally cannot.It is used in the standard library (see std::make_pair()), so yes, you have been missing out on it for quite a while.   