diff options
Diffstat (limited to '3rdparty/asio/include/asio/use_future.hpp')
-rw-r--r-- | 3rdparty/asio/include/asio/use_future.hpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/3rdparty/asio/include/asio/use_future.hpp b/3rdparty/asio/include/asio/use_future.hpp index 2a0e24ff94d..dfef15c89ef 100644 --- a/3rdparty/asio/include/asio/use_future.hpp +++ b/3rdparty/asio/include/asio/use_future.hpp @@ -2,7 +2,7 @@ // use_future.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -16,8 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" +#include "asio/detail/future.hpp" -#if defined(ASIO_HAS_STD_FUTURE) \ +#if defined(ASIO_HAS_STD_FUTURE_CLASS) \ || defined(GENERATING_DOCUMENTATION) #include <memory> @@ -118,7 +119,23 @@ public: operator()(ASIO_MOVE_ARG(Function) f) const; private: - Allocator allocator_; + // Helper type to ensure that use_future can be constexpr default-constructed + // even when std::allocator<void> can't be. + struct std_allocator_void + { + ASIO_CONSTEXPR std_allocator_void() + { + } + + operator std::allocator<void>() const + { + return std::allocator<void>(); + } + }; + + typename conditional< + is_same<std::allocator<void>, Allocator>::value, + std_allocator_void, Allocator>::type allocator_; }; /// A special value, similar to std::nothrow. @@ -137,7 +154,7 @@ __declspec(selectany) use_future_t<> use_future; #include "asio/impl/use_future.hpp" -#endif // defined(ASIO_HAS_STD_FUTURE) +#endif // defined(ASIO_HAS_STD_FUTURE_CLASS) // || defined(GENERATING_DOCUMENTATION) #endif // ASIO_USE_FUTURE_HPP |