summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/asio/src/tests/unit/write_at.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/asio/src/tests/unit/write_at.cpp')
-rw-r--r--3rdparty/asio/src/tests/unit/write_at.cpp289
1 files changed, 117 insertions, 172 deletions
diff --git a/3rdparty/asio/src/tests/unit/write_at.cpp b/3rdparty/asio/src/tests/unit/write_at.cpp
index a8e55e87d90..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-2016 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.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, 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));
}
@@ -421,11 +413,16 @@ bool old_style_transfer_all(const asio::error_code& ec,
return !!ec;
}
-size_t short_transfer(const asio::error_code& ec,
- size_t /*bytes_transferred*/)
+struct short_transfer
{
- return !!ec ? 0 : 3;
-}
+ short_transfer() {}
+ short_transfer(short_transfer&&) {}
+ size_t operator()(const asio::error_code& ec,
+ size_t /*bytes_transferred*/)
+ {
+ return !!ec ? 0 : 3;
+ }
+};
void test_4_arg_const_buffer_write_at()
{
@@ -755,36 +752,36 @@ void test_4_arg_const_buffer_write_at()
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
s.reset();
- bytes_transferred = asio::write_at(s, 0, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 0, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
s.reset();
- bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
s.reset();
s.next_write_length(1);
- bytes_transferred = asio::write_at(s, 0, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 0, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
s.reset();
s.next_write_length(1);
- bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
s.reset();
s.next_write_length(10);
- bytes_transferred = asio::write_at(s, 0, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 0, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
s.reset();
s.next_write_length(10);
- bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
}
@@ -1117,36 +1114,36 @@ void test_4_arg_mutable_buffer_write_at()
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
s.reset();
- bytes_transferred = asio::write_at(s, 0, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 0, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
s.reset();
- bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
s.reset();
s.next_write_length(1);
- bytes_transferred = asio::write_at(s, 0, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 0, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
s.reset();
s.next_write_length(1);
- bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
s.reset();
s.next_write_length(10);
- bytes_transferred = asio::write_at(s, 0, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 0, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
s.reset();
s.next_write_length(10);
- bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
}
@@ -1480,36 +1477,36 @@ void test_4_arg_vector_buffers_write_at()
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
s.reset();
- bytes_transferred = asio::write_at(s, 0, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 0, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
s.reset();
- bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
s.reset();
s.next_write_length(1);
- bytes_transferred = asio::write_at(s, 0, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 0, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
s.reset();
s.next_write_length(1);
- bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
s.reset();
s.next_write_length(10);
- bytes_transferred = asio::write_at(s, 0, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 0, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
s.reset();
s.next_write_length(10);
- bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer);
+ bytes_transferred = asio::write_at(s, 1234, buffers, short_transfer());
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
}
@@ -1936,14 +1933,14 @@ void test_5_arg_const_buffer_write_at()
s.reset();
bytes_transferred = asio::write_at(s, 0, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
ASIO_CHECK(!error);
s.reset();
bytes_transferred = asio::write_at(s, 1234, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
ASIO_CHECK(!error);
@@ -1952,7 +1949,7 @@ void test_5_arg_const_buffer_write_at()
s.next_write_length(1);
error = asio::error_code();
bytes_transferred = asio::write_at(s, 0, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
ASIO_CHECK(!error);
@@ -1961,7 +1958,7 @@ void test_5_arg_const_buffer_write_at()
s.next_write_length(1);
error = asio::error_code();
bytes_transferred = asio::write_at(s, 1234, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
ASIO_CHECK(!error);
@@ -1970,7 +1967,7 @@ void test_5_arg_const_buffer_write_at()
s.next_write_length(10);
error = asio::error_code();
bytes_transferred = asio::write_at(s, 0, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
ASIO_CHECK(!error);
@@ -1979,7 +1976,7 @@ void test_5_arg_const_buffer_write_at()
s.next_write_length(10);
error = asio::error_code();
bytes_transferred = asio::write_at(s, 1234, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
ASIO_CHECK(!error);
@@ -2407,14 +2404,14 @@ void test_5_arg_mutable_buffer_write_at()
s.reset();
bytes_transferred = asio::write_at(s, 0, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
ASIO_CHECK(!error);
s.reset();
bytes_transferred = asio::write_at(s, 1234, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
ASIO_CHECK(!error);
@@ -2423,7 +2420,7 @@ void test_5_arg_mutable_buffer_write_at()
s.next_write_length(1);
error = asio::error_code();
bytes_transferred = asio::write_at(s, 0, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
ASIO_CHECK(!error);
@@ -2432,7 +2429,7 @@ void test_5_arg_mutable_buffer_write_at()
s.next_write_length(1);
error = asio::error_code();
bytes_transferred = asio::write_at(s, 1234, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
ASIO_CHECK(!error);
@@ -2441,7 +2438,7 @@ void test_5_arg_mutable_buffer_write_at()
s.next_write_length(10);
error = asio::error_code();
bytes_transferred = asio::write_at(s, 0, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(mutable_write_data)));
ASIO_CHECK(!error);
@@ -2450,7 +2447,7 @@ void test_5_arg_mutable_buffer_write_at()
s.next_write_length(10);
error = asio::error_code();
bytes_transferred = asio::write_at(s, 1234, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
ASIO_CHECK(!error);
@@ -2879,14 +2876,14 @@ void test_5_arg_vector_buffers_write_at()
s.reset();
bytes_transferred = asio::write_at(s, 0, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
ASIO_CHECK(!error);
s.reset();
bytes_transferred = asio::write_at(s, 1234, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
ASIO_CHECK(!error);
@@ -2895,7 +2892,7 @@ void test_5_arg_vector_buffers_write_at()
s.next_write_length(1);
error = asio::error_code();
bytes_transferred = asio::write_at(s, 0, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
ASIO_CHECK(!error);
@@ -2904,7 +2901,7 @@ void test_5_arg_vector_buffers_write_at()
s.next_write_length(1);
error = asio::error_code();
bytes_transferred = asio::write_at(s, 1234, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
ASIO_CHECK(!error);
@@ -2913,7 +2910,7 @@ void test_5_arg_vector_buffers_write_at()
s.next_write_length(10);
error = asio::error_code();
bytes_transferred = asio::write_at(s, 0, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(0, buffers, sizeof(write_data)));
ASIO_CHECK(!error);
@@ -2922,7 +2919,7 @@ void test_5_arg_vector_buffers_write_at()
s.next_write_length(10);
error = asio::error_code();
bytes_transferred = asio::write_at(s, 1234, buffers,
- short_transfer, error);
+ short_transfer(), error);
ASIO_CHECK(bytes_transferred == sizeof(write_data));
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
ASIO_CHECK(!error);
@@ -2938,13 +2935,9 @@ 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;
- using std::placeholders::_1;
- using std::placeholders::_2;
-#endif // defined(ASIO_HAS_BOOST_BIND)
+ using bindns::placeholders::_1;
+ using bindns::placeholders::_2;
asio::io_context ioc;
test_random_access_device s(ioc);
@@ -3037,13 +3030,9 @@ 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;
- using std::placeholders::_1;
- using std::placeholders::_2;
-#endif // defined(ASIO_HAS_BOOST_BIND)
+ using bindns::placeholders::_1;
+ using bindns::placeholders::_2;
asio::io_context ioc;
test_random_access_device s(ioc);
@@ -3136,13 +3125,9 @@ 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;
- using std::placeholders::_1;
- using std::placeholders::_2;
-#endif // defined(ASIO_HAS_BOOST_BIND)
+ using bindns::placeholders::_1;
+ using bindns::placeholders::_2;
#if defined(ASIO_HAS_BOOST_ARRAY)
asio::io_context ioc;
@@ -3238,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;
- using std::placeholders::_1;
- using std::placeholders::_2;
-#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 = { {
@@ -3335,18 +3315,13 @@ 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;
- using std::placeholders::_1;
- using std::placeholders::_2;
-#endif // defined(ASIO_HAS_BOOST_BIND)
+ using bindns::placeholders::_1;
+ using bindns::placeholders::_2;
asio::io_context ioc;
test_random_access_device s(ioc);
@@ -3440,13 +3415,9 @@ 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;
- using std::placeholders::_1;
- using std::placeholders::_2;
-#endif // defined(ASIO_HAS_BOOST_BIND)
+ using bindns::placeholders::_1;
+ using bindns::placeholders::_2;
asio::io_context ioc;
test_random_access_device s(ioc);
@@ -3556,13 +3527,9 @@ 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;
- using std::placeholders::_1;
- using std::placeholders::_2;
-#endif // defined(ASIO_HAS_BOOST_BIND)
+ using bindns::placeholders::_1;
+ using bindns::placeholders::_2;
asio::io_context ioc;
test_random_access_device s(ioc);
@@ -4125,7 +4092,7 @@ void test_5_arg_const_buffer_async_write_at()
s.reset();
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -4135,7 +4102,7 @@ void test_5_arg_const_buffer_async_write_at()
s.reset();
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -4146,7 +4113,7 @@ void test_5_arg_const_buffer_async_write_at()
s.reset();
s.next_write_length(1);
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -4157,7 +4124,7 @@ void test_5_arg_const_buffer_async_write_at()
s.reset();
s.next_write_length(1);
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -4168,7 +4135,7 @@ void test_5_arg_const_buffer_async_write_at()
s.reset();
s.next_write_length(10);
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -4179,7 +4146,7 @@ void test_5_arg_const_buffer_async_write_at()
s.reset();
s.next_write_length(10);
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -4188,7 +4155,7 @@ void test_5_arg_const_buffer_async_write_at()
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
s.reset();
- int i = asio::async_write_at(s, 0, buffers, short_transfer,
+ int i = asio::async_write_at(s, 0, buffers, short_transfer(),
archetypes::lazy_handler());
ASIO_CHECK(i == 42);
ioc.restart();
@@ -4198,13 +4165,9 @@ 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;
- using std::placeholders::_1;
- using std::placeholders::_2;
-#endif // defined(ASIO_HAS_BOOST_BIND)
+ using bindns::placeholders::_1;
+ using bindns::placeholders::_2;
asio::io_context ioc;
test_random_access_device s(ioc);
@@ -4767,7 +4730,7 @@ void test_5_arg_mutable_buffer_async_write_at()
s.reset();
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(mutable_write_data), &called));
ioc.restart();
@@ -4777,7 +4740,7 @@ void test_5_arg_mutable_buffer_async_write_at()
s.reset();
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(mutable_write_data), &called));
ioc.restart();
@@ -4788,7 +4751,7 @@ void test_5_arg_mutable_buffer_async_write_at()
s.reset();
s.next_write_length(1);
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(mutable_write_data), &called));
ioc.restart();
@@ -4799,7 +4762,7 @@ void test_5_arg_mutable_buffer_async_write_at()
s.reset();
s.next_write_length(1);
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(mutable_write_data), &called));
ioc.restart();
@@ -4810,7 +4773,7 @@ void test_5_arg_mutable_buffer_async_write_at()
s.reset();
s.next_write_length(10);
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(mutable_write_data), &called));
ioc.restart();
@@ -4821,7 +4784,7 @@ void test_5_arg_mutable_buffer_async_write_at()
s.reset();
s.next_write_length(10);
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(mutable_write_data), &called));
ioc.restart();
@@ -4830,7 +4793,7 @@ void test_5_arg_mutable_buffer_async_write_at()
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(mutable_write_data)));
s.reset();
- int i = asio::async_write_at(s, 0, buffers, short_transfer,
+ int i = asio::async_write_at(s, 0, buffers, short_transfer(),
archetypes::lazy_handler());
ASIO_CHECK(i == 42);
ioc.restart();
@@ -4840,13 +4803,9 @@ 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;
- using std::placeholders::_1;
- using std::placeholders::_2;
-#endif // defined(ASIO_HAS_BOOST_BIND)
+ using bindns::placeholders::_1;
+ using bindns::placeholders::_2;
#if defined(ASIO_HAS_BOOST_ARRAY)
asio::io_context ioc;
@@ -5411,7 +5370,7 @@ void test_5_arg_boost_array_buffers_async_write_at()
s.reset();
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -5421,7 +5380,7 @@ void test_5_arg_boost_array_buffers_async_write_at()
s.reset();
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -5432,7 +5391,7 @@ void test_5_arg_boost_array_buffers_async_write_at()
s.reset();
s.next_write_length(1);
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -5443,7 +5402,7 @@ void test_5_arg_boost_array_buffers_async_write_at()
s.reset();
s.next_write_length(1);
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -5454,7 +5413,7 @@ void test_5_arg_boost_array_buffers_async_write_at()
s.reset();
s.next_write_length(10);
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -5465,7 +5424,7 @@ void test_5_arg_boost_array_buffers_async_write_at()
s.reset();
s.next_write_length(10);
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -5474,7 +5433,7 @@ void test_5_arg_boost_array_buffers_async_write_at()
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
s.reset();
- int i = asio::async_write_at(s, 0, buffers, short_transfer,
+ int i = asio::async_write_at(s, 0, buffers, short_transfer(),
archetypes::lazy_handler());
ASIO_CHECK(i == 42);
ioc.restart();
@@ -5485,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;
- using std::placeholders::_1;
- using std::placeholders::_2;
-#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 = { {
@@ -6056,7 +6010,7 @@ void test_5_arg_std_array_buffers_async_write_at()
s.reset();
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -6066,7 +6020,7 @@ void test_5_arg_std_array_buffers_async_write_at()
s.reset();
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -6077,7 +6031,7 @@ void test_5_arg_std_array_buffers_async_write_at()
s.reset();
s.next_write_length(1);
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -6088,7 +6042,7 @@ void test_5_arg_std_array_buffers_async_write_at()
s.reset();
s.next_write_length(1);
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -6099,7 +6053,7 @@ void test_5_arg_std_array_buffers_async_write_at()
s.reset();
s.next_write_length(10);
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -6110,7 +6064,7 @@ void test_5_arg_std_array_buffers_async_write_at()
s.reset();
s.next_write_length(10);
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -6119,24 +6073,19 @@ void test_5_arg_std_array_buffers_async_write_at()
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
s.reset();
- int i = asio::async_write_at(s, 0, buffers, short_transfer,
+ int i = asio::async_write_at(s, 0, buffers, short_transfer(),
archetypes::lazy_handler());
ASIO_CHECK(i == 42);
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;
- using std::placeholders::_1;
- using std::placeholders::_2;
-#endif // defined(ASIO_HAS_BOOST_BIND)
+ using bindns::placeholders::_1;
+ using bindns::placeholders::_2;
asio::io_context ioc;
test_random_access_device s(ioc);
@@ -6700,7 +6649,7 @@ void test_5_arg_vector_buffers_async_write_at()
s.reset();
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -6710,7 +6659,7 @@ void test_5_arg_vector_buffers_async_write_at()
s.reset();
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -6721,7 +6670,7 @@ void test_5_arg_vector_buffers_async_write_at()
s.reset();
s.next_write_length(1);
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -6732,7 +6681,7 @@ void test_5_arg_vector_buffers_async_write_at()
s.reset();
s.next_write_length(1);
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -6743,7 +6692,7 @@ void test_5_arg_vector_buffers_async_write_at()
s.reset();
s.next_write_length(10);
called = false;
- asio::async_write_at(s, 0, buffers, short_transfer,
+ asio::async_write_at(s, 0, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -6754,7 +6703,7 @@ void test_5_arg_vector_buffers_async_write_at()
s.reset();
s.next_write_length(10);
called = false;
- asio::async_write_at(s, 1234, buffers, short_transfer,
+ asio::async_write_at(s, 1234, buffers, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -6763,7 +6712,7 @@ void test_5_arg_vector_buffers_async_write_at()
ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(write_data)));
s.reset();
- int i = asio::async_write_at(s, 0, buffers, short_transfer,
+ int i = asio::async_write_at(s, 0, buffers, short_transfer(),
archetypes::lazy_handler());
ASIO_CHECK(i == 42);
ioc.restart();
@@ -6773,13 +6722,9 @@ 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;
- using std::placeholders::_1;
- using std::placeholders::_2;
-#endif // defined(ASIO_HAS_BOOST_BIND)
+ using bindns::placeholders::_1;
+ using bindns::placeholders::_2;
asio::io_context ioc;
test_random_access_device s(ioc);
@@ -7441,7 +7386,7 @@ void test_5_arg_streambuf_async_write_at()
sb.consume(sb.size());
sb.sputn(write_data, sizeof(write_data));
called = false;
- asio::async_write_at(s, 0, sb, short_transfer,
+ asio::async_write_at(s, 0, sb, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -7453,7 +7398,7 @@ void test_5_arg_streambuf_async_write_at()
sb.consume(sb.size());
sb.sputn(write_data, sizeof(write_data));
called = false;
- asio::async_write_at(s, 1234, sb, short_transfer,
+ asio::async_write_at(s, 1234, sb, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -7466,7 +7411,7 @@ void test_5_arg_streambuf_async_write_at()
sb.sputn(write_data, sizeof(write_data));
s.next_write_length(1);
called = false;
- asio::async_write_at(s, 0, sb, short_transfer,
+ asio::async_write_at(s, 0, sb, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -7479,7 +7424,7 @@ void test_5_arg_streambuf_async_write_at()
sb.sputn(write_data, sizeof(write_data));
s.next_write_length(1);
called = false;
- asio::async_write_at(s, 1234, sb, short_transfer,
+ asio::async_write_at(s, 1234, sb, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -7492,7 +7437,7 @@ void test_5_arg_streambuf_async_write_at()
sb.sputn(write_data, sizeof(write_data));
s.next_write_length(10);
called = false;
- asio::async_write_at(s, 0, sb, short_transfer,
+ asio::async_write_at(s, 0, sb, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -7505,7 +7450,7 @@ void test_5_arg_streambuf_async_write_at()
sb.sputn(write_data, sizeof(write_data));
s.next_write_length(10);
called = false;
- asio::async_write_at(s, 1234, sb, short_transfer,
+ asio::async_write_at(s, 1234, sb, short_transfer(),
bindns::bind(async_write_handler,
_1, _2, sizeof(write_data), &called));
ioc.restart();
@@ -7516,7 +7461,7 @@ void test_5_arg_streambuf_async_write_at()
s.reset();
sb.consume(sb.size());
sb.sputn(write_data, sizeof(write_data));
- int i = asio::async_write_at(s, 0, sb, short_transfer,
+ int i = asio::async_write_at(s, 0, sb, short_transfer(),
archetypes::lazy_handler());
ASIO_CHECK(i == 42);
ioc.restart();