struct scalar_log_minimum { public: typedef T value_type; typedef T r...">

The "max" macro requires 2 arguments, but only 1 given

template <class T>
struct scalar_log_minimum {
public:
    typedef T value_type;
    typedef T result_type;
    static
        result_type initial_value(){
            return std::log(std::numeric_limits<result_type>::max());
    }
    static
        void update(result_type& t, const value_type& x){
            if ( (x>0) && (std::log(x)<t) ) t = std::log(x);
    }
};

I got the following error while trying to compile above:

functional_ext.hpp: 55: 59: the macro "max" requires 2 arguments, but only 1 given

max is not a macro, is it? Then what is this mistake? BTW, I am using visual studio 2005

And what is 55:59 --- 55 is line number 59?

+4
source share
4 answers

#defines, , windows.h ( max min, , Rectangle, ). windows.h , , . ++, .

, boost ( , thread asio) windows.h , .

, , - #undef .

+4

-, #define max . , , , , . , #undef :

#include <evil_header_which_defines_max.h>
#undef max
+7

, windows.h, , . Microsoft "" windows.h . .

windows.h , , , #undef.

, min max :

#define NOMINMAX
#include <windows.h>

, - windows.h. .

windows.h, (, NOOPENFILE, NOKANJI, NOKERNEL ), .

+3

, max, , . ( "" ) , , :

return std::log((std::numeric_limits<result_type>::max)());
+1

All Articles