| <<< Default constructor behavior of C++ types | Index | Function template example >>> |
Since we can build templates for classes, why not have templates for functions?
// return bigger int
int max_int( int a, int b )
{
return ( a > b ) ? a : b;
}
// return bigger ValueT
template< typename ValueT >
ValueT const& max_val( ValueT const& a, ValueT const& b )
{
return ( a > b ) ? a : b;
}
| <<< Default constructor behavior of C++ types | Index | Function template example >>> |