Syntax error with std::numeric_limits::max

前端 未结 2 1401
一生所求
一生所求 2020-12-13 00:06

I have class struct definition as follows:

#include 

struct heapStatsFilters
{
    heapStatsFilters(size_t minValue_ = 0, size_t maxValue_ = s         


        
2条回答
  •  生来不讨喜
    2020-12-13 00:43

    As other people say the problem is that in (included by ) is defined macroses min and max, but if you'll see it's declaration:

    // 
    #ifndef NOMINMAX
    
    #ifndef max
    #define max(a,b)            (((a) > (b)) ? (a) : (b))
    #endif
    
    #ifndef min
    #define min(a,b)            (((a) < (b)) ? (a) : (b))
    #endif
    
    #endif  /* NOMINMAX */
    

    you'll see that if there is defined a macro NOMINMAX then WinDefs.h will not produce these macroses.

    That's why it would be better to add a define NOMINMAX to project.

提交回复
热议问题