-1

I used the following code:

auto t = numeric_limits<decltype(m)>::max() - 1;

Later, I needed to #include <Windows.h> which has #define max(a, b) directive, so I can not use ::max() method. Is there a way to suppress macro expansion when calling ::max() without using #undef max?

too honest for this site
  • 12,050
  • 4
  • 30
  • 52
Piotr Jedyk
  • 361
  • 1
  • 10

1 Answers1

6

Define NOMINMAX in compiler options or before you include windows.h:

#define NOMINMAX
#include <windows.h>
Juraj Blaho
  • 13,301
  • 7
  • 50
  • 96