M
mathieu
Hi there,
I am reading:
http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.9
And I am thinking does the opposite also apply? For instance:
template<typename T>
struct minimum : std::binary_function<T, T, T>
{
const T& operator()(const T& x, const T& y) const { return x < y?
x : y; }
};
Clearly for integer type such as int, there is not need to construct
a reference, but instead it would be faster (I would think) to simply
do:
template<typename T>
struct minimum : std::binary_function<T, T, T>
{
T operator()(T x, T y) const { return x < y? x : y; }
};
Thanks,
I am reading:
http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.9
And I am thinking does the opposite also apply? For instance:
template<typename T>
struct minimum : std::binary_function<T, T, T>
{
const T& operator()(const T& x, const T& y) const { return x < y?
x : y; }
};
Clearly for integer type such as int, there is not need to construct
a reference, but instead it would be faster (I would think) to simply
do:
template<typename T>
struct minimum : std::binary_function<T, T, T>
{
T operator()(T x, T y) const { return x < y? x : y; }
};
Thanks,