Possible problems with NOMINMAX on Visual C++

前端 未结 4 1920
青春惊慌失措
青春惊慌失措 2020-11-29 05:18

What problems could I get when defining NOMINMAX before anything else in my program?

As far as I know, this will make not

4条回答
  •  北海茫月
    2020-11-29 05:31

    For precompiled header (like stdafx.h) I use this:

    #define NOMINMAX
    #include 
    #include 
    #ifndef min
    #define min(x,y) ((x) < (y) ? (x) : (y))
    #endif
    #ifndef max
    #define max(x,y) ((x) > (y) ? (x) : (y))
    #endif
    #include 
    #undef min
    #undef max
    

提交回复
热议问题