diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b6560dc..e674ac63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Version 253: * Fix async_detect_ssl handler type * member get_executor const-correctness +* Fix min/max on MSVC -------------------------------------------------------------------------------- diff --git a/include/boost/beast/core/detail/type_traits.hpp b/include/boost/beast/core/detail/type_traits.hpp index 31bcda17..1c10731e 100644 --- a/include/boost/beast/core/detail/type_traits.hpp +++ b/include/boost/beast/core/detail/type_traits.hpp @@ -25,21 +25,6 @@ namespace boost { namespace beast { namespace detail { -// variadic min -template -T constexpr min(T t) -{ - return t; -} - -template -T constexpr min(T t0, T t1, Tn... tn) -{ - return (t0 < t1) ? - (detail::min)(t0, tn...) : - (detail::min)(t1, tn...); -} - template std::size_t constexpr max_sizeof() diff --git a/include/boost/beast/core/rate_policy.hpp b/include/boost/beast/core/rate_policy.hpp index 1f8abb9b..6375b118 100644 --- a/include/boost/beast/core/rate_policy.hpp +++ b/include/boost/beast/core/rate_policy.hpp @@ -152,7 +152,7 @@ class simple_rate_policy friend class rate_policy_access; static std::size_t constexpr all = - std::numeric_limits::max(); + (std::numeric_limits::max)(); std::size_t rd_remain_ = all; std::size_t wr_remain_ = all; diff --git a/include/boost/beast/websocket/detail/prng.hpp b/include/boost/beast/websocket/detail/prng.hpp index 35409b58..e0ce7cd2 100644 --- a/include/boost/beast/websocket/detail/prng.hpp +++ b/include/boost/beast/websocket/detail/prng.hpp @@ -11,6 +11,7 @@ #define BOOST_BEAST_WEBSOCKET_DETAIL_PRNG_HPP #include +#include #include #include #include @@ -65,7 +66,7 @@ public: static value_type constexpr - min() noexcept + min BOOST_PREVENT_MACRO_SUBSTITUTION () noexcept { return (std::numeric_limits< value_type>::min)(); @@ -73,7 +74,7 @@ public: static value_type constexpr - max() noexcept + max BOOST_PREVENT_MACRO_SUBSTITUTION () noexcept { return (std::numeric_limits< value_type>::max)(); diff --git a/test/beast/core.cpp b/test/beast/core.cpp index ed4c2ccc..25b0b1c2 100644 --- a/test/beast/core.cpp +++ b/test/beast/core.cpp @@ -7,5 +7,12 @@ // Official repository: https://github.com/boostorg/beast // +// If including Windows.h generates errors, it +// means that min/max macros are being substituted. +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#include +#endif + // Test that header file is self-contained. #include diff --git a/test/beast/http.cpp b/test/beast/http.cpp index d725bc7f..bd630abc 100644 --- a/test/beast/http.cpp +++ b/test/beast/http.cpp @@ -7,5 +7,12 @@ // Official repository: https://github.com/boostorg/beast // +// If including Windows.h generates errors, it +// means that min/max macros are being substituted. +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#include +#endif + // Test that header file is self-contained. #include diff --git a/test/beast/ssl.cpp b/test/beast/ssl.cpp index 3bb9e409..f0eec159 100644 --- a/test/beast/ssl.cpp +++ b/test/beast/ssl.cpp @@ -7,5 +7,12 @@ // Official repository: https://github.com/boostorg/beast // +// If including Windows.h generates errors, it +// means that min/max macros are being substituted. +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#include +#endif + // Test that header file is self-contained. #include diff --git a/test/beast/version.cpp b/test/beast/version.cpp index 17994a22..502126e5 100644 --- a/test/beast/version.cpp +++ b/test/beast/version.cpp @@ -7,5 +7,12 @@ // Official repository: https://github.com/boostorg/beast // +// If including Windows.h generates errors, it +// means that min/max macros are being substituted. +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#include +#endif + // Test that header file is self-contained. #include diff --git a/test/beast/websocket.cpp b/test/beast/websocket.cpp index 24cf9423..4dd358d5 100644 --- a/test/beast/websocket.cpp +++ b/test/beast/websocket.cpp @@ -7,5 +7,12 @@ // Official repository: https://github.com/boostorg/beast // +// If including Windows.h generates errors, it +// means that min/max macros are being substituted. +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#include +#endif + // Test that header file is self-contained. #include diff --git a/test/beast/zlib.cpp b/test/beast/zlib.cpp index c34a2fd1..c0cf68a6 100644 --- a/test/beast/zlib.cpp +++ b/test/beast/zlib.cpp @@ -7,5 +7,12 @@ // Official repository: https://github.com/boostorg/beast // +// If including Windows.h generates errors, it +// means that min/max macros are being substituted. +#ifdef _MSC_VER +#define WIN32_LEAN_AND_MEAN +#include +#endif + // Test that header file is self-contained. #include