Can someone explain me the difference between the following C++ macro
and the function MAX:
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
template <class T>
const T& MAX(const T& a, const T& b)
{
return (a > b ? a : b);
}
Some of the differences I beleive are that the macro is expanded
inline by the preprocessor, unlike the fucntion MAX? Any other
differences? Can the two basically be used interchangably, or would
one be used over the other for certain applications?
Thanks in advance.
Aakash