Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions include/utpp/utpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,23 @@
#define UTPP_MUST_UNDEF_LEAN_AND_MEAN
#endif

#ifndef NOMINMAX
#define NOMINMAX
#define UTPP_MUST_UNDEF_NOMINMAX
#endif

#include <windows.h>

#ifdef UTPP_MUST_UNDEF_LEAN_AND_MEAN
#undef UTPP_MUST_UNDEF_LEAN_AND_MEAN
#undef WIN32_LEAN_AND_MEAN
#endif

#ifdef UTPP_MUST_UNDEF_NOMINMAX
#undef UTPP_MUST_UNDEF_NOMINMAX
#undef NOMINMAX
#endif

#endif

#ifdef _MSC_VER
Expand Down
10 changes: 10 additions & 0 deletions sample/sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,4 +639,14 @@ TEST_MAIN (int argc, char** argv)
// Check that utpp.h didn't #include <windows.h> in a
// way that prevents using WinSock2.h.
#include <WinSock2.h>

// Check that #including <windows.h> has not polluted global
// namespace with windows.h's own min() and max() macros.
#include <algorithm>
static void f() {
int a = 1, b = 2;
int c = std::min(a, b);
(void)c;
}

#endif