Fix min/max on MSVC

fix #1578
This commit is contained in:
Vinnie Falco
2019-04-19 11:36:00 -07:00
parent 0a334d96d1
commit e53ccf251c
10 changed files with 47 additions and 18 deletions

View File

@ -2,6 +2,7 @@ Version 253:
* Fix async_detect_ssl handler type * Fix async_detect_ssl handler type
* member get_executor const-correctness * member get_executor const-correctness
* Fix min/max on MSVC
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@ -25,21 +25,6 @@ namespace boost {
namespace beast { namespace beast {
namespace detail { namespace detail {
// variadic min
template<class T>
T constexpr min(T t)
{
return t;
}
template<class T, class...Tn>
T constexpr min(T t0, T t1, Tn... tn)
{
return (t0 < t1) ?
(detail::min)(t0, tn...) :
(detail::min)(t1, tn...);
}
template<class U> template<class U>
std::size_t constexpr std::size_t constexpr
max_sizeof() max_sizeof()

View File

@ -152,7 +152,7 @@ class simple_rate_policy
friend class rate_policy_access; friend class rate_policy_access;
static std::size_t constexpr all = static std::size_t constexpr all =
std::numeric_limits<std::size_t>::max(); (std::numeric_limits<std::size_t>::max)();
std::size_t rd_remain_ = all; std::size_t rd_remain_ = all;
std::size_t wr_remain_ = all; std::size_t wr_remain_ = all;

View File

@ -11,6 +11,7 @@
#define BOOST_BEAST_WEBSOCKET_DETAIL_PRNG_HPP #define BOOST_BEAST_WEBSOCKET_DETAIL_PRNG_HPP
#include <boost/beast/core/detail/config.hpp> #include <boost/beast/core/detail/config.hpp>
#include <boost/config.hpp>
#include <cstdint> #include <cstdint>
#include <limits> #include <limits>
#include <random> #include <random>
@ -65,7 +66,7 @@ public:
static static
value_type constexpr value_type constexpr
min() noexcept min BOOST_PREVENT_MACRO_SUBSTITUTION () noexcept
{ {
return (std::numeric_limits< return (std::numeric_limits<
value_type>::min)(); value_type>::min)();
@ -73,7 +74,7 @@ public:
static static
value_type constexpr value_type constexpr
max() noexcept max BOOST_PREVENT_MACRO_SUBSTITUTION () noexcept
{ {
return (std::numeric_limits< return (std::numeric_limits<
value_type>::max)(); value_type>::max)();

View File

@ -7,5 +7,12 @@
// Official repository: https://github.com/boostorg/beast // 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 <Windows.h>
#endif
// Test that header file is self-contained. // Test that header file is self-contained.
#include <boost/beast/core.hpp> #include <boost/beast/core.hpp>

View File

@ -7,5 +7,12 @@
// Official repository: https://github.com/boostorg/beast // 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 <Windows.h>
#endif
// Test that header file is self-contained. // Test that header file is self-contained.
#include <boost/beast/http.hpp> #include <boost/beast/http.hpp>

View File

@ -7,5 +7,12 @@
// Official repository: https://github.com/boostorg/beast // 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 <Windows.h>
#endif
// Test that header file is self-contained. // Test that header file is self-contained.
#include <boost/beast/ssl.hpp> #include <boost/beast/ssl.hpp>

View File

@ -7,5 +7,12 @@
// Official repository: https://github.com/boostorg/beast // 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 <Windows.h>
#endif
// Test that header file is self-contained. // Test that header file is self-contained.
#include <boost/beast/version.hpp> #include <boost/beast/version.hpp>

View File

@ -7,5 +7,12 @@
// Official repository: https://github.com/boostorg/beast // 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 <Windows.h>
#endif
// Test that header file is self-contained. // Test that header file is self-contained.
#include <boost/beast/websocket.hpp> #include <boost/beast/websocket.hpp>

View File

@ -7,5 +7,12 @@
// Official repository: https://github.com/boostorg/beast // 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 <Windows.h>
#endif
// Test that header file is self-contained. // Test that header file is self-contained.
#include <boost/beast/zlib.hpp> #include <boost/beast/zlib.hpp>