I use one library which is very important and untouchable.
The problem is that library declare min, max function,
so when I include STL header in project, they conflict.
I want to disable min, max function in STL (like #define NOMNMAX) if I could.
If I can’t, what would be solution?
Important :
Sorry, It’s not Macro. Two functions are template functions.
like
template<T>
T min(const T& a, const T& b) { a < b ? a : b; }
Thanks, in advance.
The min and max functions are defined in the
stdnamespace, so this code should not compile:If it does, your Standard Library is non-compliant. Also, your important and untouchable library should be declaring it’s functions in a namespace. If it isn’t. complain loudly to the vendor.
Edit: As these functions are presumably in a header file, you can touch them. So a hack would be to remove the templates from the header and replace them with the following:
though why the writers of the library felt the need to define these templates is anyone’s guess.