diff options
Diffstat (limited to '3rdparty/asio/src/tests/unit/write_at.cpp')
-rw-r--r-- | 3rdparty/asio/src/tests/unit/write_at.cpp | 76 |
1 files changed, 6 insertions, 70 deletions
diff --git a/3rdparty/asio/src/tests/unit/write_at.cpp b/3rdparty/asio/src/tests/unit/write_at.cpp index c3760b0bf46..adc684d0e4f 100644 --- a/3rdparty/asio/src/tests/unit/write_at.cpp +++ b/3rdparty/asio/src/tests/unit/write_at.cpp @@ -2,7 +2,7 @@ // write_at.cpp // ~~~~~~~~~~~~ // -// Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2024 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,27 +16,19 @@ // Test that header file is self-contained. #include "asio/write_at.hpp" +#include <array> #include <cstring> +#include <functional> #include "archetypes/async_result.hpp" #include "asio/io_context.hpp" #include "asio/post.hpp" #include "asio/streambuf.hpp" #include "unit_test.hpp" -#if defined(ASIO_HAS_BOOST_BIND) -# include <boost/bind/bind.hpp> -#else // defined(ASIO_HAS_BOOST_BIND) -# include <functional> -#endif // defined(ASIO_HAS_BOOST_BIND) - #if defined(ASIO_HAS_BOOST_ARRAY) #include <boost/array.hpp> #endif // defined(ASIO_HAS_BOOST_ARRAY) -#if defined(ASIO_HAS_STD_ARRAY) -# include <array> -#endif // defined(ASIO_HAS_STD_ARRAY) - using namespace std; // For memcmp, memcpy and memset. class test_random_access_device @@ -52,7 +44,7 @@ public: memset(data_, 0, max_length); } - executor_type get_executor() ASIO_NOEXCEPT + executor_type get_executor() noexcept { return io_context_.get_executor(); } @@ -118,12 +110,12 @@ public: template <typename Const_Buffers, typename Handler> void async_write_some_at(asio::uint64_t offset, - const Const_Buffers& buffers, ASIO_MOVE_ARG(Handler) handler) + const Const_Buffers& buffers, Handler&& handler) { size_t bytes_transferred = write_some_at(offset, buffers); asio::post(get_executor(), asio::detail::bind_handler( - ASIO_MOVE_CAST(Handler)(handler), + static_cast<Handler&&>(handler), asio::error_code(), bytes_transferred)); } @@ -424,11 +416,7 @@ bool old_style_transfer_all(const asio::error_code& ec, struct short_transfer { short_transfer() {} -#if defined(ASIO_HAS_MOVE) short_transfer(short_transfer&&) {} -#else // defined(ASIO_HAS_MOVE) - short_transfer(const short_transfer&) {} -#endif // defined(ASIO_HAS_MOVE) size_t operator()(const asio::error_code& ec, size_t /*bytes_transferred*/) { @@ -2947,11 +2935,7 @@ void async_write_handler(const asio::error_code& e, void test_4_arg_const_buffer_async_write_at() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -3046,11 +3030,7 @@ void test_4_arg_const_buffer_async_write_at() void test_4_arg_mutable_buffer_async_write_at() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -3145,11 +3125,7 @@ void test_4_arg_mutable_buffer_async_write_at() void test_4_arg_boost_array_buffers_async_write_at() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -3247,15 +3223,10 @@ void test_4_arg_boost_array_buffers_async_write_at() void test_4_arg_std_array_buffers_async_write_at() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; -#if defined(ASIO_HAS_STD_ARRAY) asio::io_context ioc; test_random_access_device s(ioc); std::array<asio::const_buffer, 2> buffers = { { @@ -3344,16 +3315,11 @@ void test_4_arg_std_array_buffers_async_write_at() ioc.restart(); ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); -#endif // defined(ASIO_HAS_STD_ARRAY) } void test_4_arg_vector_buffers_async_write_at() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -3449,11 +3415,7 @@ void test_4_arg_vector_buffers_async_write_at() void test_4_arg_streambuf_async_write_at() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -3565,11 +3527,7 @@ void test_4_arg_streambuf_async_write_at() void test_5_arg_const_buffer_async_write_at() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -4207,11 +4165,7 @@ void test_5_arg_const_buffer_async_write_at() void test_5_arg_mutable_buffer_async_write_at() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -4849,11 +4803,7 @@ void test_5_arg_mutable_buffer_async_write_at() void test_5_arg_boost_array_buffers_async_write_at() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -5494,15 +5444,10 @@ void test_5_arg_boost_array_buffers_async_write_at() void test_5_arg_std_array_buffers_async_write_at() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; -#if defined(ASIO_HAS_STD_ARRAY) asio::io_context ioc; test_random_access_device s(ioc); std::array<asio::const_buffer, 2> buffers = { { @@ -6134,16 +6079,11 @@ void test_5_arg_std_array_buffers_async_write_at() ioc.restart(); ioc.run(); ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data))); -#endif // defined(ASIO_HAS_STD_ARRAY) } void test_5_arg_vector_buffers_async_write_at() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -6782,11 +6722,7 @@ void test_5_arg_vector_buffers_async_write_at() void test_5_arg_streambuf_async_write_at() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; |