Reputation: 1
This is my code:
template<typename _Tp, typename _Compare>
inline const _Tp&
inline min(const _Tp& __a, const _Tp& __b, _Compare& __comp)
{
if (__comp(__b, __a))
return __b ;
return __a;
}
this is the error message I am getting:
/usr/include/c++/4.4/bits/stl_algobase.h:232:57: error: macro "min" passed 3 arguments, but takes just 2
I understand I am passing 3 arguments a,b and comp but I am only returning a and b, however when I try to return comp it gives me the same message.
Upvotes: 0
Views: 2696
Reputation: 46598
You have #define min(a, b)
somewhere, so pre-processor try to expand it and failed
Try (min)(a, b, compare)
. The parentheses around min
prevent macro expansion.
Upvotes: 2