Remove deprecated handler_type and single-argument async_result.

This commit is contained in:
Christopher Kohlhoff 2019-02-15 08:37:00 +11:00
parent f9e4489b57
commit fc05ce407c
19 changed files with 4 additions and 1768 deletions

View File

@ -305,7 +305,6 @@ nobase_include_HEADERS = \
asio/handler_alloc_hook.hpp \
asio/handler_continuation_hook.hpp \
asio/handler_invoke_hook.hpp \
asio/handler_type.hpp \
asio/high_resolution_timer.hpp \
asio.hpp \
asio/impl/buffered_read_stream.hpp \

View File

@ -60,7 +60,6 @@
#include "asio/handler_alloc_hook.hpp"
#include "asio/handler_continuation_hook.hpp"
#include "asio/handler_invoke_hook.hpp"
#include "asio/handler_type.hpp"
#include "asio/high_resolution_timer.hpp"
#include "asio/io_context.hpp"
#include "asio/io_context_strand.hpp"

View File

@ -17,7 +17,6 @@
#include "asio/detail/config.hpp"
#include "asio/detail/type_traits.hpp"
#include "asio/handler_type.hpp"
#include "asio/detail/push_options.hpp"
@ -41,30 +40,15 @@ namespace asio {
* The primary template assumes that the CompletionToken is the completion
* handler.
*/
#if defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
template <typename CompletionToken, typename Signature>
#else // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
template <typename CompletionToken, typename Signature = void>
#endif // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
class async_result
{
public:
#if defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
/// The concrete completion handler type for the specific signature.
typedef CompletionToken completion_handler_type;
/// The return type of the initiating function.
typedef void return_type;
#else // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
// For backward compatibility, determine the concrete completion handler type
// by using the legacy handler_type trait.
typedef typename handler_type<CompletionToken, Signature>::type
completion_handler_type;
// For backward compatibility, determine the initiating function return type
// using the legacy single-parameter version of async_result.
typedef typename async_result<completion_handler_type>::type return_type;
#endif // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
/// Construct an async result from a given handler.
/**
@ -73,11 +57,6 @@ public:
* then returned from the initiating function.
*/
explicit async_result(completion_handler_type& h)
#if defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
// No data members to initialise.
#else // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
: legacy_result_(h)
#endif // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
{
(void)h;
}
@ -85,56 +64,13 @@ public:
/// Obtain the value to be returned from the initiating function.
return_type get()
{
#if defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
// Nothing to do.
#else // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
return legacy_result_.get();
#endif // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
}
private:
async_result(const async_result&) ASIO_DELETED;
async_result& operator=(const async_result&) ASIO_DELETED;
#if defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
// No data members.
#else // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
async_result<completion_handler_type> legacy_result_;
#endif // defined(ASIO_NO_DEPRECATED) || defined(GENERATING_DOCUMENTATION)
};
#if !defined(ASIO_NO_DEPRECATED)
/// (Deprecated: Use two-parameter version of async_result.) An interface for
/// customising the behaviour of an initiating function.
/**
* This template may be specialised for user-defined handler types.
*/
template <typename Handler>
class async_result<Handler>
{
public:
/// The return type of the initiating function.
typedef void type;
/// Construct an async result from a given handler.
/**
* When using a specalised async_result, the constructor has an opportunity
* to initialise some state associated with the handler, which is then
* returned from the initiating function.
*/
explicit async_result(Handler&)
{
}
/// Obtain the value to be returned from the initiating function.
type get()
{
}
};
#endif // !defined(ASIO_NO_DEPRECATED)
/// Helper template to deduce the handler type from a CompletionToken, capture
/// a local copy of the handler, and then create an async_result for the
/// handler.

View File

@ -547,37 +547,6 @@ private:
async_result<T, Signature> target_;
};
#if !defined(ASIO_NO_DEPRECATED)
template <typename T, typename Executor, typename Signature>
struct handler_type<executor_binder<T, Executor>, Signature>
{
typedef executor_binder<
typename handler_type<T, Signature>::type, Executor> type;
};
template <typename T, typename Executor>
class async_result<executor_binder<T, Executor> >
{
public:
typedef typename async_result<T>::type type;
explicit async_result(executor_binder<T, Executor>& b)
: target_(b.get())
{
}
type get()
{
return target_.get();
}
private:
async_result<T> target_;
};
#endif // !defined(ASIO_NO_DEPRECATED)
template <typename T, typename Executor, typename Allocator>
struct associated_allocator<executor_binder<T, Executor>, Allocator>
{

View File

@ -818,39 +818,6 @@ private:
return_type awaitable_;
};
#if !defined(ASIO_NO_DEPRECATED)
template <typename Executor, typename R, typename... Args>
struct handler_type<experimental::await_token<Executor>, R(Args...)>
{
typedef experimental::detail::await_handler<
Executor, typename decay<Args>::type...> type;
};
template <typename Executor, typename... Args>
class async_result<experimental::detail::await_handler<Executor, Args...>>
{
public:
typedef typename experimental::detail::await_handler<
Executor, Args...>::awaitable_type type;
async_result(experimental::detail::await_handler<Executor, Args...>& h)
: awaitable_(experimental::detail::make_dummy_awaitable<type>())
{
h.attach_awaitee(awaitable_);
}
type get()
{
return std::move(awaitable_);
}
private:
type awaitable_;
};
#endif // !defined(ASIO_NO_DEPRECATED)
} // namespace asio
namespace std { namespace experimental {

View File

@ -18,7 +18,6 @@
#include "asio/detail/config.hpp"
#include "asio/async_result.hpp"
#include "asio/detail/variadic_templates.hpp"
#include "asio/handler_type.hpp"
#include "asio/system_error.hpp"
#include "asio/detail/push_options.hpp"

View File

@ -24,7 +24,6 @@
#include "asio/detail/handler_invoke_helpers.hpp"
#include "asio/detail/type_traits.hpp"
#include "asio/detail/variadic_templates.hpp"
#include "asio/handler_type.hpp"
#include "asio/system_error.hpp"
#include "asio/detail/push_options.hpp"
@ -233,30 +232,6 @@ struct async_result<experimental::redirect_error_t<CompletionToken>, Signature>
}
};
#if !defined(ASIO_NO_DEPRECATED)
template <typename CompletionToken, typename Signature>
struct handler_type<experimental::redirect_error_t<CompletionToken>, Signature>
{
typedef experimental::detail::redirect_error_handler<
typename async_result<CompletionToken,
typename experimental::detail::redirect_error_signature<Signature>::type>
::completion_handler_type> type;
};
template <typename Handler>
struct async_result<experimental::detail::redirect_error_handler<Handler> >
: async_result<Handler>
{
explicit async_result(
experimental::detail::redirect_error_handler<Handler>& h)
: async_result<Handler>(h.handler_)
{
}
};
#endif // !defined(ASIO_NO_DEPRECATED)
template <typename Handler, typename Executor>
struct associated_executor<
experimental::detail::redirect_error_handler<Handler>, Executor>

View File

@ -1,50 +0,0 @@
//
// handler_type.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 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)
//
#ifndef ASIO_HANDLER_TYPE_HPP
#define ASIO_HANDLER_TYPE_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/config.hpp"
#include "asio/detail/type_traits.hpp"
#include "asio/detail/push_options.hpp"
namespace asio {
/// (Deprecated: Use two-parameter version of async_result.) Default handler
/// type traits provided for all completion token types.
/**
* The handler_type traits class is used for determining the concrete handler
* type to be used for an asynchronous operation. It allows the handler type to
* be determined at the point where the specific completion handler signature
* is known.
*
* This template may be specialised for user-defined completion token types.
*/
template <typename CompletionToken, typename Signature, typename = void>
struct handler_type
{
/// The handler type for the specific signature.
typedef typename conditional<
is_same<CompletionToken, typename decay<CompletionToken>::type>::value,
decay<CompletionToken>,
handler_type<typename decay<CompletionToken>::type, Signature>
>::type::type type;
};
} // namespace asio
#include "asio/detail/pop_options.hpp"
#endif // ASIO_HANDLER_TYPE_HPP

View File

@ -148,7 +148,8 @@ io_context::dispatch(ASIO_MOVE_ARG(LegacyCompletionHandler) handler)
{
// Allocate and construct an operation to wrap the handler.
typedef detail::completion_handler<
typename handler_type<LegacyCompletionHandler, void ()>::type> op;
typename async_completion<LegacyCompletionHandler,
void ()>::completion_handler_type> op;
typename op::ptr p = { detail::addressof(init.completion_handler),
op::ptr::allocate(init.completion_handler), 0 };
p.p = new (p.v) op(init.completion_handler);
@ -179,7 +180,8 @@ io_context::post(ASIO_MOVE_ARG(LegacyCompletionHandler) handler)
// Allocate and construct an operation to wrap the handler.
typedef detail::completion_handler<
typename handler_type<LegacyCompletionHandler, void ()>::type> op;
typename async_completion<LegacyCompletionHandler,
void ()>::completion_handler_type> op;
typename op::ptr p = { detail::addressof(init.completion_handler),
op::ptr::allocate(init.completion_handler), 0 };
p.p = new (p.v) op(init.completion_handler);

View File

@ -277,51 +277,6 @@ public:
}
};
#if !defined(ASIO_NO_DEPRECATED)
template <typename Handler, typename ReturnType>
struct handler_type<basic_yield_context<Handler>, ReturnType()>
{
typedef detail::coro_handler<Handler, void> type;
};
template <typename Handler, typename ReturnType, typename Arg1>
struct handler_type<basic_yield_context<Handler>, ReturnType(Arg1)>
{
typedef detail::coro_handler<Handler, typename decay<Arg1>::type> type;
};
template <typename Handler, typename ReturnType>
struct handler_type<basic_yield_context<Handler>,
ReturnType(asio::error_code)>
{
typedef detail::coro_handler<Handler, void> type;
};
template <typename Handler, typename ReturnType, typename Arg2>
struct handler_type<basic_yield_context<Handler>,
ReturnType(asio::error_code, Arg2)>
{
typedef detail::coro_handler<Handler, typename decay<Arg2>::type> type;
};
template <typename Handler, typename T>
class async_result<detail::coro_handler<Handler, T> >
: public detail::coro_async_result<Handler, T>
{
public:
typedef typename detail::coro_async_result<Handler, T>::return_type type;
explicit async_result(
typename detail::coro_async_result<Handler,
T>::completion_handler_type& h)
: detail::coro_async_result<Handler, T>(h)
{
}
};
#endif // !defined(ASIO_NO_DEPRECATED)
template <typename Handler, typename T, typename Allocator>
struct associated_allocator<detail::coro_handler<Handler, T>, Allocator>
{

View File

@ -878,56 +878,6 @@ public:
#endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
#if !defined(ASIO_NO_DEPRECATED)
template <typename Allocator, typename Signature>
struct handler_type<use_future_t<Allocator>, Signature>
{
typedef typename async_result<use_future_t<Allocator>,
Signature>::completion_handler_type type;
};
template <typename Signature, typename Allocator>
class async_result<detail::promise_handler<Signature, Allocator> >
: public detail::promise_async_result<Signature, Allocator>
{
public:
typedef typename detail::promise_async_result<
Signature, Allocator>::return_type type;
explicit async_result(
typename detail::promise_async_result<
Signature, Allocator>::completion_handler_type& h)
: detail::promise_async_result<Signature, Allocator>(h)
{
}
};
template <typename Function, typename Allocator, typename Signature>
struct handler_type<detail::packaged_token<Function, Allocator>, Signature>
{
typedef typename async_result<detail::packaged_token<Function, Allocator>,
Signature>::completion_handler_type type;
};
template <typename Function, typename Allocator, typename Result>
class async_result<detail::packaged_handler<Function, Allocator, Result> >
: public detail::packaged_async_result<Function, Allocator, Result>
{
public:
typedef typename detail::packaged_async_result<
Function, Allocator, Result>::return_type type;
explicit async_result(
typename detail::packaged_async_result<
Function, Allocator, Result>::completion_handler_type& h)
: detail::packaged_async_result<Function, Allocator, Result>(h)
{
}
};
#endif // !defined(ASIO_NO_DEPRECATED)
#endif // !defined(GENERATING_DOCUMENTATION)
} // namespace asio

View File

@ -15,7 +15,6 @@
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/handler_type.hpp"
#include "asio/async_result.hpp"
#include "asio/associated_allocator.hpp"
#include "asio/execution_context.hpp"

View File

@ -397,8 +397,6 @@ EXTRA_DIST = \
performance/handler_allocator.hpp \
unit/archetypes/async_ops.hpp \
unit/archetypes/async_result.hpp \
unit/archetypes/deprecated_async_result.hpp \
unit/archetypes/deprecated_async_ops.hpp \
unit/archetypes/gettable_socket_option.hpp \
unit/archetypes/io_control_command.hpp \
unit/archetypes/settable_socket_option.hpp

View File

@ -1,345 +0,0 @@
//
// deprecated_async_ops.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 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)
//
#ifndef ARCHETYPES_DEPRECATED_ASYNC_OPS_HPP
#define ARCHETYPES_DEPRECATED_ASYNC_OPS_HPP
#include <asio/async_result.hpp>
#if !defined(ASIO_NO_DEPRECATED)
#include <asio/handler_type.hpp>
#include <asio/error.hpp>
#include <asio/io_context.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)
namespace archetypes {
#if defined(ASIO_HAS_BOOST_BIND)
namespace bindns = boost;
#else // defined(ASIO_HAS_BOOST_BIND)
namespace bindns = std;
#endif // defined(ASIO_HAS_BOOST_BIND)
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void()>::type>::type
deprecated_async_op_0(asio::io_context& ctx,
ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void()>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler)));
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(asio::error_code)>::type>::type
deprecated_async_op_ec_0(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(asio::error_code)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code()));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(asio::error::operation_aborted)));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(std::exception_ptr)>::type>::type
deprecated_async_op_ex_0(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(std::exception_ptr)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::exception_ptr()));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::make_exception_ptr(std::runtime_error("blah"))));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(int)>::type>::type
deprecated_async_op_1(asio::io_context& ctx,
ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(int)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler), 42));
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(asio::error_code, int)>::type>::type
deprecated_async_op_ec_1(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(asio::error_code, int)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(), 42));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(asio::error::operation_aborted), 0));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(std::exception_ptr, int)>::type>::type
deprecated_async_op_ex_1(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(std::exception_ptr, int)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::exception_ptr(), 42));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::make_exception_ptr(std::runtime_error("blah")), 0));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(int, double)>::type>::type
deprecated_async_op_2(asio::io_context& ctx,
ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(int, double)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
42, 2.0));
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(asio::error_code, int, double)>::type>::type
deprecated_async_op_ec_2(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(asio::error_code, int, double)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(), 42, 2.0));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(asio::error::operation_aborted),
0, 0.0));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(std::exception_ptr, int, double)>::type>::type
deprecated_async_op_ex_2(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(std::exception_ptr, int, double)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::exception_ptr(), 42, 2.0));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::make_exception_ptr(std::runtime_error("blah")), 0, 0.0));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(int, double, char)>::type>::type
deprecated_async_op_3(asio::io_context& ctx,
ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(int, double, char)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
42, 2.0, 'a'));
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(asio::error_code, int, double, char)>::type>::type
deprecated_async_op_ec_3(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(asio::error_code, int, double, char)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(), 42, 2.0, 'a'));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
asio::error_code(asio::error::operation_aborted),
0, 0.0, 'z'));
}
return result.get();
}
template <typename CompletionToken>
typename asio::async_result<
typename asio::handler_type<CompletionToken,
void(std::exception_ptr, int, double, char)>::type>::type
deprecated_async_op_ex_3(asio::io_context& ctx,
bool ok, ASIO_MOVE_ARG(CompletionToken) token)
{
typedef typename asio::handler_type<CompletionToken,
void(std::exception_ptr, int, double, char)>::type handler_type;
handler_type handler(ASIO_MOVE_CAST(CompletionToken)(token));
asio::async_result<handler_type> result(handler);
if (ok)
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::exception_ptr(), 42, 2.0, 'a'));
}
else
{
ctx.post(bindns::bind(ASIO_MOVE_CAST(handler_type)(handler),
std::make_exception_ptr(std::runtime_error("blah")),
0, 0.0, 'z'));
}
return result.get();
}
} // namespace archetypes
#endif // !defined(ASIO_NO_DEPRECATED)
#endif // ARCHETYPES_DEPRECATED_ASYNC_OPS_HPP

View File

@ -1,82 +0,0 @@
//
// async_result.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2019 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)
//
#ifndef ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP
#define ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP
#include <asio/async_result.hpp>
#if !defined(ASIO_NO_DEPRECATED)
#include <asio/handler_type.hpp>
namespace archetypes {
struct deprecated_lazy_handler
{
};
struct deprecated_concrete_handler
{
deprecated_concrete_handler(deprecated_lazy_handler)
{
}
template <typename Arg1>
void operator()(Arg1)
{
}
template <typename Arg1, typename Arg2>
void operator()(Arg1, Arg2)
{
}
#if defined(ASIO_HAS_MOVE)
deprecated_concrete_handler(deprecated_concrete_handler&&) {}
private:
deprecated_concrete_handler(const deprecated_concrete_handler&);
#endif // defined(ASIO_HAS_MOVE)
};
} // namespace archetypes
namespace asio {
template <typename Signature>
struct handler_type<archetypes::deprecated_lazy_handler, Signature>
{
typedef archetypes::deprecated_concrete_handler type;
};
template <>
class async_result<archetypes::deprecated_concrete_handler>
{
public:
// The return type of the initiating function.
typedef double type;
// Construct an async_result from a given handler.
explicit async_result(archetypes::deprecated_concrete_handler&)
{
}
// Obtain the value to be returned from the initiating function.
type get()
{
return 42;
}
};
} // namespace asio
#endif // !defined(ASIO_NO_DEPRECATED)
#endif // ARCHETYPES_DEPRECATED_ASYNC_RESULT_HPP

View File

@ -21,7 +21,6 @@
#include "asio/placeholders.hpp"
#include "../unit_test.hpp"
#include "../archetypes/async_result.hpp"
#include "../archetypes/deprecated_async_result.hpp"
#include "../archetypes/gettable_socket_option.hpp"
#include "../archetypes/io_control_command.hpp"
#include "../archetypes/settable_socket_option.hpp"
@ -88,9 +87,6 @@ void test()
archetypes::gettable_socket_option<double> gettable_socket_option3;
archetypes::io_control_command io_control_command;
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
// basic_datagram_socket constructors.
@ -201,14 +197,6 @@ void test()
(void)i1;
int i2 = socket1.async_connect(ip::icmp::endpoint(ip::icmp::v6(), 0), lazy);
(void)i2;
#if !defined(ASIO_NO_DEPRECATED)
double d1 = socket1.async_connect(
ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
(void)d1;
double d2 = socket1.async_connect(
ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
(void)d2;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.set_option(settable_socket_option1);
socket1.set_option(settable_socket_option1, ec);
@ -276,21 +264,6 @@ void test()
(void)i7;
int i8 = socket1.async_send(null_buffers(), in_flags, lazy);
(void)i8;
#if !defined(ASIO_NO_DEPRECATED)
double d3 = socket1.async_send(buffer(mutable_char_buffer), dlazy);
(void)d3;
double d4 = socket1.async_send(buffer(const_char_buffer), dlazy);
(void)d4;
double d5 = socket1.async_send(null_buffers(), dlazy);
(void)d5;
double d6 = socket1.async_send(
buffer(mutable_char_buffer), in_flags, dlazy);
(void)d6;
double d7 = socket1.async_send(buffer(const_char_buffer), in_flags, dlazy);
(void)d7;
double d8 = socket1.async_send(null_buffers(), in_flags, dlazy);
(void)d8;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.send_to(buffer(mutable_char_buffer),
ip::icmp::endpoint(ip::icmp::v4(), 0));
@ -389,44 +362,6 @@ void test()
int i20 = socket1.async_send_to(null_buffers(),
ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, lazy);
(void)i20;
#if !defined(ASIO_NO_DEPRECATED)
double d9 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
(void)d9;
double d10 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
(void)d10;
double d11 = socket1.async_send_to(buffer(const_char_buffer),
ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
(void)d11;
double d12 = socket1.async_send_to(buffer(const_char_buffer),
ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
(void)d12;
double d13 = socket1.async_send_to(null_buffers(),
ip::icmp::endpoint(ip::icmp::v4(), 0), dlazy);
(void)d13;
double d14 = socket1.async_send_to(null_buffers(),
ip::icmp::endpoint(ip::icmp::v6(), 0), dlazy);
(void)d14;
double d15 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, dlazy);
(void)d15;
double d16 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, dlazy);
(void)d16;
double d17 = socket1.async_send_to(buffer(const_char_buffer),
ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, dlazy);
(void)d17;
double d18 = socket1.async_send_to(buffer(const_char_buffer),
ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, dlazy);
(void)d18;
double d19 = socket1.async_send_to(null_buffers(),
ip::icmp::endpoint(ip::icmp::v4(), 0), in_flags, dlazy);
(void)d19;
double d20 = socket1.async_send_to(null_buffers(),
ip::icmp::endpoint(ip::icmp::v6(), 0), in_flags, dlazy);
(void)d20;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.receive(buffer(mutable_char_buffer));
socket1.receive(null_buffers());
@ -449,17 +384,6 @@ void test()
(void)i23;
int i24 = socket1.async_receive(null_buffers(), in_flags, lazy);
(void)i24;
#if !defined(ASIO_NO_DEPRECATED)
double d21 = socket1.async_receive(buffer(mutable_char_buffer), dlazy);
(void)d21;
double d22 = socket1.async_receive(null_buffers(), dlazy);
(void)d22;
double d23 = socket1.async_receive(buffer(mutable_char_buffer),
in_flags, dlazy);
(void)d23;
double d24 = socket1.async_receive(null_buffers(), in_flags, dlazy);
(void)d24;
#endif // !defined(ASIO_NO_DEPRECATED)
ip::icmp::endpoint endpoint;
socket1.receive_from(buffer(mutable_char_buffer), endpoint);
@ -489,20 +413,6 @@ void test()
int i28 = socket1.async_receive_from(null_buffers(),
endpoint, in_flags, lazy);
(void)i28;
#if !defined(ASIO_NO_DEPRECATED)
double d25 = socket1.async_receive_from(buffer(mutable_char_buffer),
endpoint, dlazy);
(void)d25;
double d26 = socket1.async_receive_from(null_buffers(),
endpoint, dlazy);
(void)d26;
double d27 = socket1.async_receive_from(buffer(mutable_char_buffer),
endpoint, in_flags, dlazy);
(void)d27;
double d28 = socket1.async_receive_from(null_buffers(),
endpoint, in_flags, dlazy);
(void)d28;
#endif // !defined(ASIO_NO_DEPRECATED)
}
catch (std::exception&)
{
@ -542,9 +452,6 @@ void test()
io_context ioc;
const io_context::executor_type ioc_ex = ioc.get_executor();
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
#if !defined(ASIO_NO_DEPRECATED)
ip::icmp::resolver::query q(ip::icmp::v4(), "localhost", "0");
@ -624,55 +531,30 @@ void test()
resolver.async_resolve(q, resolve_handler());
int i1 = resolver.async_resolve(q, lazy);
(void)i1;
double d1 = resolver.async_resolve(q, dlazy);
(void)d1;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "", resolve_handler());
int i2 = resolver.async_resolve("", "", lazy);
(void)i2;
#if !defined(ASIO_NO_DEPRECATED)
double d2 = resolver.async_resolve("", "", dlazy);
(void)d2;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "",
ip::icmp::resolver::flags(), resolve_handler());
int i3 = resolver.async_resolve("", "",
ip::icmp::resolver::flags(), lazy);
(void)i3;
#if !defined(ASIO_NO_DEPRECATED)
double d3 = resolver.async_resolve("", "",
ip::icmp::resolver::flags(), dlazy);
(void)d3;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::icmp::v4(), "", "", resolve_handler());
int i4 = resolver.async_resolve(ip::icmp::v4(), "", "", lazy);
(void)i4;
#if !defined(ASIO_NO_DEPRECATED)
double d4 = resolver.async_resolve(ip::icmp::v4(), "", "", dlazy);
(void)d4;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::icmp::v4(),
"", "", ip::icmp::resolver::flags(), resolve_handler());
int i5 = resolver.async_resolve(ip::icmp::v4(),
"", "", ip::icmp::resolver::flags(), lazy);
(void)i5;
#if !defined(ASIO_NO_DEPRECATED)
double d5 = resolver.async_resolve(ip::icmp::v4(),
"", "", ip::icmp::resolver::flags(), dlazy);
(void)d5;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(e, resolve_handler());
int i6 = resolver.async_resolve(e, lazy);
(void)i6;
#if !defined(ASIO_NO_DEPRECATED)
double d6 = resolver.async_resolve(e, dlazy);
(void)d6;
#endif // !defined(ASIO_NO_DEPRECATED)
}
catch (std::exception&)
{

View File

@ -25,7 +25,6 @@
#include "asio/write.hpp"
#include "../unit_test.hpp"
#include "../archetypes/async_result.hpp"
#include "../archetypes/deprecated_async_result.hpp"
#include "../archetypes/gettable_socket_option.hpp"
#include "../archetypes/io_control_command.hpp"
#include "../archetypes/settable_socket_option.hpp"
@ -236,9 +235,6 @@ void test()
archetypes::gettable_socket_option<double> gettable_socket_option3;
archetypes::io_control_command io_control_command;
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
// basic_stream_socket constructors.
@ -349,14 +345,6 @@ void test()
(void)i1;
int i2 = socket1.async_connect(ip::tcp::endpoint(ip::tcp::v6(), 0), lazy);
(void)i2;
#if !defined(ASIO_NO_DEPRECATED)
double d1 = socket1.async_connect(
ip::tcp::endpoint(ip::tcp::v4(), 0), dlazy);
(void)d1;
double d2 = socket1.async_connect(
ip::tcp::endpoint(ip::tcp::v6(), 0), dlazy);
(void)d2;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.set_option(settable_socket_option1);
socket1.set_option(settable_socket_option1, ec);
@ -400,10 +388,6 @@ void test()
socket1.async_wait(socket_base::wait_read, wait_handler());
int i3 = socket1.async_wait(socket_base::wait_write, lazy);
(void)i3;
#if !defined(ASIO_NO_DEPRECATED)
double d3 = socket1.async_wait(socket_base::wait_write, dlazy);
(void)d3;
#endif // !defined(ASIO_NO_DEPRECATED)
// basic_stream_socket functions.
@ -453,29 +437,6 @@ void test()
(void)i12;
int i13 = socket1.async_send(null_buffers(), in_flags, lazy);
(void)i13;
#if !defined(ASIO_NO_DEPRECATED)
double d4 = socket1.async_send(buffer(mutable_char_buffer), dlazy);
(void)d4;
double d5 = socket1.async_send(buffer(const_char_buffer), dlazy);
(void)d5;
double d6 = socket1.async_send(mutable_buffers, dlazy);
(void)d6;
double d7 = socket1.async_send(const_buffers, dlazy);
(void)d7;
double d8 = socket1.async_send(null_buffers(), dlazy);
(void)d8;
double d9 = socket1.async_send(
buffer(mutable_char_buffer), in_flags, dlazy);
(void)d9;
double d10 = socket1.async_send(buffer(const_char_buffer), in_flags, dlazy);
(void)d10;
double d11 = socket1.async_send(mutable_buffers, in_flags, dlazy);
(void)d11;
double d12 = socket1.async_send(const_buffers, in_flags, dlazy);
(void)d12;
double d13 = socket1.async_send(null_buffers(), in_flags, dlazy);
(void)d13;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.receive(buffer(mutable_char_buffer));
socket1.receive(mutable_buffers);
@ -507,21 +468,6 @@ void test()
(void)i18;
int i19 = socket1.async_receive(null_buffers(), in_flags, lazy);
(void)i19;
#if !defined(ASIO_NO_DEPRECATED)
double d14 = socket1.async_receive(buffer(mutable_char_buffer), dlazy);
(void)d14;
double d15 = socket1.async_receive(mutable_buffers, dlazy);
(void)d15;
double d16 = socket1.async_receive(null_buffers(), dlazy);
(void)d16;
double d17 = socket1.async_receive(buffer(mutable_char_buffer), in_flags,
dlazy);
(void)d17;
double d18 = socket1.async_receive(mutable_buffers, in_flags, dlazy);
(void)d18;
double d19 = socket1.async_receive(null_buffers(), in_flags, dlazy);
(void)d19;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.write_some(buffer(mutable_char_buffer));
socket1.write_some(buffer(const_char_buffer));
@ -549,18 +495,6 @@ void test()
(void)i23;
int i24 = socket1.async_write_some(null_buffers(), lazy);
(void)i24;
#if !defined(ASIO_NO_DEPRECATED)
double d20 = socket1.async_write_some(buffer(mutable_char_buffer), dlazy);
(void)d20;
double d21 = socket1.async_write_some(buffer(const_char_buffer), dlazy);
(void)d21;
double d22 = socket1.async_write_some(mutable_buffers, dlazy);
(void)d22;
double d23 = socket1.async_write_some(const_buffers, dlazy);
(void)d23;
double d24 = socket1.async_write_some(null_buffers(), dlazy);
(void)d24;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.read_some(buffer(mutable_char_buffer));
socket1.read_some(mutable_buffers);
@ -578,14 +512,6 @@ void test()
(void)i26;
int i27 = socket1.async_read_some(null_buffers(), lazy);
(void)i27;
#if !defined(ASIO_NO_DEPRECATED)
double d25 = socket1.async_read_some(buffer(mutable_char_buffer), dlazy);
(void)d25;
double d26 = socket1.async_read_some(mutable_buffers, dlazy);
(void)d26;
double d27 = socket1.async_read_some(null_buffers(), dlazy);
(void)d27;
#endif // !defined(ASIO_NO_DEPRECATED)
}
catch (std::exception&)
{
@ -822,9 +748,6 @@ void test()
archetypes::gettable_socket_option<double> gettable_socket_option3;
archetypes::io_control_command io_control_command;
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
// basic_socket_acceptor constructors.
@ -940,10 +863,6 @@ void test()
acceptor1.async_wait(socket_base::wait_read, wait_handler());
int i1 = acceptor1.async_wait(socket_base::wait_write, lazy);
(void)i1;
#if !defined(ASIO_NO_DEPRECATED)
double d1 = acceptor1.async_wait(socket_base::wait_write, dlazy);
(void)d1;
#endif // !defined(ASIO_NO_DEPRECATED)
acceptor1.accept(peer_socket1);
acceptor1.accept(peer_socket1, ec);
@ -977,12 +896,6 @@ void test()
(void)i2;
int i3 = acceptor1.async_accept(peer_socket1, peer_endpoint, lazy);
(void)i3;
#if !defined(ASIO_NO_DEPRECATED)
double d2 = acceptor1.async_accept(peer_socket1, dlazy);
(void)d2;
double d3 = acceptor1.async_accept(peer_socket1, peer_endpoint, dlazy);
(void)d3;
#endif // !defined(ASIO_NO_DEPRECATED)
acceptor1.async_accept(peer_socket2, accept_handler());
acceptor1.async_accept(peer_socket2, peer_endpoint, accept_handler());
@ -990,12 +903,6 @@ void test()
(void)i4;
int i5 = acceptor1.async_accept(peer_socket2, peer_endpoint, lazy);
(void)i5;
#if !defined(ASIO_NO_DEPRECATED)
double d4 = acceptor1.async_accept(peer_socket2, dlazy);
(void)d4;
double d5 = acceptor1.async_accept(peer_socket2, peer_endpoint, dlazy);
(void)d5;
#endif // !defined(ASIO_NO_DEPRECATED)
#if defined(ASIO_HAS_MOVE)
acceptor1.async_accept(move_accept_handler());
@ -1135,9 +1042,6 @@ void test()
io_context ioc;
const io_context::executor_type ioc_ex = ioc.get_executor();
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
#if !defined(ASIO_NO_DEPRECATED)
ip::tcp::resolver::query q(ip::tcp::v4(), "localhost", "0");
@ -1218,8 +1122,6 @@ void test()
resolver.async_resolve(q, legacy_resolve_handler());
int i1 = resolver.async_resolve(q, lazy);
(void)i1;
double d1 = resolver.async_resolve(q, dlazy);
(void)d1;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "", resolve_handler());
@ -1228,10 +1130,6 @@ void test()
#endif // !defined(ASIO_NO_DEPRECATED)
int i2 = resolver.async_resolve("", "", lazy);
(void)i2;
#if !defined(ASIO_NO_DEPRECATED)
double d2 = resolver.async_resolve("", "", dlazy);
(void)d2;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "",
ip::tcp::resolver::flags(), resolve_handler());
@ -1242,11 +1140,6 @@ void test()
int i3 = resolver.async_resolve("", "",
ip::tcp::resolver::flags(), lazy);
(void)i3;
#if !defined(ASIO_NO_DEPRECATED)
double d3 = resolver.async_resolve("", "",
ip::tcp::resolver::flags(), dlazy);
(void)d3;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::tcp::v4(), "", "", resolve_handler());
#if !defined(ASIO_NO_DEPRECATED)
@ -1254,10 +1147,6 @@ void test()
#endif // !defined(ASIO_NO_DEPRECATED)
int i4 = resolver.async_resolve(ip::tcp::v4(), "", "", lazy);
(void)i4;
#if !defined(ASIO_NO_DEPRECATED)
double d4 = resolver.async_resolve(ip::tcp::v4(), "", "", dlazy);
(void)d4;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::tcp::v4(),
"", "", ip::tcp::resolver::flags(), resolve_handler());
@ -1268,11 +1157,6 @@ void test()
int i5 = resolver.async_resolve(ip::tcp::v4(),
"", "", ip::tcp::resolver::flags(), lazy);
(void)i5;
#if !defined(ASIO_NO_DEPRECATED)
double d5 = resolver.async_resolve(ip::tcp::v4(),
"", "", ip::tcp::resolver::flags(), dlazy);
(void)d5;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(e, resolve_handler());
#if !defined(ASIO_NO_DEPRECATED)
@ -1280,10 +1164,6 @@ void test()
#endif // !defined(ASIO_NO_DEPRECATED)
int i6 = resolver.async_resolve(e, lazy);
(void)i6;
#if !defined(ASIO_NO_DEPRECATED)
double d6 = resolver.async_resolve(e, dlazy);
(void)d6;
#endif // !defined(ASIO_NO_DEPRECATED)
}
catch (std::exception&)
{

View File

@ -20,7 +20,6 @@
#include "asio/io_context.hpp"
#include "../unit_test.hpp"
#include "../archetypes/async_result.hpp"
#include "../archetypes/deprecated_async_result.hpp"
#include "../archetypes/gettable_socket_option.hpp"
#include "../archetypes/io_control_command.hpp"
#include "../archetypes/settable_socket_option.hpp"
@ -104,9 +103,6 @@ void test()
archetypes::gettable_socket_option<double> gettable_socket_option3;
archetypes::io_control_command io_control_command;
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
// basic_datagram_socket constructors.
@ -217,14 +213,6 @@ void test()
(void)i1;
int i2 = socket1.async_connect(ip::udp::endpoint(ip::udp::v6(), 0), lazy);
(void)i2;
#if !defined(ASIO_NO_DEPRECATED)
double d1 = socket1.async_connect(
ip::udp::endpoint(ip::udp::v4(), 0), dlazy);
(void)d1;
double d2 = socket1.async_connect(
ip::udp::endpoint(ip::udp::v6(), 0), dlazy);
(void)d2;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.set_option(settable_socket_option1);
socket1.set_option(settable_socket_option1, ec);
@ -268,10 +256,6 @@ void test()
socket1.async_wait(socket_base::wait_read, wait_handler());
int i3 = socket1.async_wait(socket_base::wait_write, lazy);
(void)i3;
#if !defined(ASIO_NO_DEPRECATED)
double d3 = socket1.async_wait(socket_base::wait_write, dlazy);
(void)d3;
#endif // !defined(ASIO_NO_DEPRECATED)
// basic_datagram_socket functions.
@ -303,21 +287,6 @@ void test()
(void)i8;
int i9 = socket1.async_send(null_buffers(), in_flags, lazy);
(void)i9;
#if !defined(ASIO_NO_DEPRECATED)
double d4 = socket1.async_send(buffer(mutable_char_buffer), dlazy);
(void)d4;
double d5 = socket1.async_send(buffer(const_char_buffer), dlazy);
(void)d5;
double d6 = socket1.async_send(null_buffers(), dlazy);
(void)d6;
double d7 = socket1.async_send(
buffer(mutable_char_buffer), in_flags, dlazy);
(void)d7;
double d8 = socket1.async_send(buffer(const_char_buffer), in_flags, dlazy);
(void)d8;
double d9 = socket1.async_send(null_buffers(), in_flags, dlazy);
(void)d9;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.send_to(buffer(mutable_char_buffer),
ip::udp::endpoint(ip::udp::v4(), 0));
@ -416,44 +385,6 @@ void test()
int i21 = socket1.async_send_to(null_buffers(),
ip::udp::endpoint(ip::udp::v6(), 0), in_flags, lazy);
(void)i21;
#if !defined(ASIO_NO_DEPRECATED)
double d10 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::udp::endpoint(ip::udp::v4(), 0), dlazy);
(void)d10;
double d11 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::udp::endpoint(ip::udp::v6(), 0), dlazy);
(void)d11;
double d12 = socket1.async_send_to(buffer(const_char_buffer),
ip::udp::endpoint(ip::udp::v4(), 0), dlazy);
(void)d12;
double d13 = socket1.async_send_to(buffer(const_char_buffer),
ip::udp::endpoint(ip::udp::v6(), 0), dlazy);
(void)d13;
double d14 = socket1.async_send_to(null_buffers(),
ip::udp::endpoint(ip::udp::v4(), 0), dlazy);
(void)d14;
double d15 = socket1.async_send_to(null_buffers(),
ip::udp::endpoint(ip::udp::v6(), 0), dlazy);
(void)d15;
double d16 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::udp::endpoint(ip::udp::v4(), 0), in_flags, dlazy);
(void)d16;
double d17 = socket1.async_send_to(buffer(mutable_char_buffer),
ip::udp::endpoint(ip::udp::v6(), 0), in_flags, dlazy);
(void)d17;
double d18 = socket1.async_send_to(buffer(const_char_buffer),
ip::udp::endpoint(ip::udp::v4(), 0), in_flags, dlazy);
(void)d18;
double d19 = socket1.async_send_to(buffer(const_char_buffer),
ip::udp::endpoint(ip::udp::v6(), 0), in_flags, dlazy);
(void)d19;
double d20 = socket1.async_send_to(null_buffers(),
ip::udp::endpoint(ip::udp::v4(), 0), in_flags, dlazy);
(void)d20;
double d21 = socket1.async_send_to(null_buffers(),
ip::udp::endpoint(ip::udp::v6(), 0), in_flags, dlazy);
(void)d21;
#endif // !defined(ASIO_NO_DEPRECATED)
socket1.receive(buffer(mutable_char_buffer));
socket1.receive(null_buffers());
@ -476,17 +407,6 @@ void test()
(void)i24;
int i25 = socket1.async_receive(null_buffers(), in_flags, lazy);
(void)i25;
#if !defined(ASIO_NO_DEPRECATED)
double d22 = socket1.async_receive(buffer(mutable_char_buffer), dlazy);
(void)d22;
double d23 = socket1.async_receive(null_buffers(), dlazy);
(void)d23;
double d24 = socket1.async_receive(buffer(mutable_char_buffer),
in_flags, dlazy);
(void)d24;
double d25 = socket1.async_receive(null_buffers(), in_flags, dlazy);
(void)d25;
#endif // !defined(ASIO_NO_DEPRECATED)
ip::udp::endpoint endpoint;
socket1.receive_from(buffer(mutable_char_buffer), endpoint);
@ -516,20 +436,6 @@ void test()
int i29 = socket1.async_receive_from(null_buffers(),
endpoint, in_flags, lazy);
(void)i29;
#if !defined(ASIO_NO_DEPRECATED)
double d26 = socket1.async_receive_from(buffer(mutable_char_buffer),
endpoint, dlazy);
(void)d26;
double d27 = socket1.async_receive_from(null_buffers(),
endpoint, dlazy);
(void)d27;
double d28 = socket1.async_receive_from(buffer(mutable_char_buffer),
endpoint, in_flags, dlazy);
(void)d28;
double d29 = socket1.async_receive_from(null_buffers(),
endpoint, in_flags, dlazy);
(void)d29;
#endif // !defined(ASIO_NO_DEPRECATED)
}
catch (std::exception&)
{
@ -640,9 +546,6 @@ void test()
io_context ioc;
const io_context::executor_type ioc_ex = ioc.get_executor();
archetypes::lazy_handler lazy;
#if !defined(ASIO_NO_DEPRECATED)
archetypes::deprecated_lazy_handler dlazy;
#endif // !defined(ASIO_NO_DEPRECATED)
asio::error_code ec;
#if !defined(ASIO_NO_DEPRECATED)
ip::udp::resolver::query q(ip::udp::v4(), "localhost", "0");
@ -722,55 +625,31 @@ void test()
resolver.async_resolve(q, resolve_handler());
int i1 = resolver.async_resolve(q, lazy);
(void)i1;
double d1 = resolver.async_resolve(q, dlazy);
(void)d1;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "", resolve_handler());
int i2 = resolver.async_resolve("", "", lazy);
(void)i2;
#if !defined(ASIO_NO_DEPRECATED)
double d2 = resolver.async_resolve("", "", dlazy);
(void)d2;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve("", "",
ip::udp::resolver::flags(), resolve_handler());
int i3 = resolver.async_resolve("", "",
ip::udp::resolver::flags(), lazy);
(void)i3;
#if !defined(ASIO_NO_DEPRECATED)
double d3 = resolver.async_resolve("", "",
ip::udp::resolver::flags(), dlazy);
(void)d3;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::udp::v4(), "", "", resolve_handler());
int i4 = resolver.async_resolve(ip::udp::v4(), "", "", lazy);
(void)i4;
#if !defined(ASIO_NO_DEPRECATED)
double d4 = resolver.async_resolve(ip::udp::v4(), "", "", dlazy);
(void)d4;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(ip::udp::v4(),
"", "", ip::udp::resolver::flags(), resolve_handler());
int i5 = resolver.async_resolve(ip::udp::v4(),
"", "", ip::udp::resolver::flags(), lazy);
(void)i5;
#if !defined(ASIO_NO_DEPRECATED)
double d5 = resolver.async_resolve(ip::udp::v4(),
"", "", ip::udp::resolver::flags(), dlazy);
(void)d5;
#endif // !defined(ASIO_NO_DEPRECATED)
resolver.async_resolve(e, resolve_handler());
int i6 = resolver.async_resolve(e, lazy);
(void)i6;
#if !defined(ASIO_NO_DEPRECATED)
double d6 = resolver.async_resolve(e, dlazy);
(void)d6;
#endif // !defined(ASIO_NO_DEPRECATED)
}
catch (std::exception&)
{

View File

@ -22,7 +22,6 @@
#if defined(ASIO_HAS_STD_FUTURE)
#include "archetypes/async_ops.hpp"
#include "archetypes/deprecated_async_ops.hpp"
void use_future_0_test()
{
@ -647,673 +646,6 @@ void use_future_package_3_test()
}
}
void deprecated_use_future_0_test()
{
#if !defined(ASIO_NO_DEPRECATED)
using asio::use_future;
using namespace archetypes;
std::future<void> f;
asio::io_context ctx;
f = deprecated_async_op_0(ctx, use_future);
ctx.restart();
ctx.run();
try
{
f.get();
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_0(ctx, true, use_future);
ctx.restart();
ctx.run();
try
{
f.get();
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_0(ctx, false, use_future);
ctx.restart();
ctx.run();
try
{
f.get();
ASIO_CHECK(false);
}
catch (asio::system_error& e)
{
ASIO_CHECK(e.code() == asio::error::operation_aborted);
}
catch (...)
{
ASIO_CHECK(false);
}
f = async_op_ex_0(true, use_future);
ctx.restart();
ctx.run();
try
{
f.get();
}
catch (...)
{
ASIO_CHECK(false);
}
f = async_op_ex_0(false, use_future);
ctx.restart();
ctx.run();
try
{
f.get();
ASIO_CHECK(false);
}
catch (std::exception& e)
{
ASIO_CHECK(e.what() == std::string("blah"));
}
catch (...)
{
ASIO_CHECK(false);
}
#endif // !defined(ASIO_NO_DEPRECATED)
}
void deprecated_use_future_1_test()
{
#if !defined(ASIO_NO_DEPRECATED)
using asio::use_future;
using namespace archetypes;
std::future<int> f;
asio::io_context ctx;
f = deprecated_async_op_1(ctx, use_future);
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_1(ctx, true, use_future);
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_1(ctx, false, use_future);
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(false);
(void)i;
}
catch (asio::system_error& e)
{
ASIO_CHECK(e.code() == asio::error::operation_aborted);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_1(ctx, true, use_future);
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_1(ctx, false, use_future);
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(false);
(void)i;
}
catch (std::exception& e)
{
ASIO_CHECK(e.what() == std::string("blah"));
}
catch (...)
{
ASIO_CHECK(false);
}
#endif // !defined(ASIO_NO_DEPRECATED)
}
void deprecated_use_future_2_test()
{
#if !defined(ASIO_NO_DEPRECATED)
using asio::use_future;
using namespace archetypes;
std::future<std::tuple<int, double>> f;
asio::io_context ctx;
f = deprecated_async_op_2(ctx, use_future);
ctx.restart();
ctx.run();
try
{
int i;
double d;
std::tie(i, d) = f.get();
ASIO_CHECK(i == 42);
ASIO_CHECK(d == 2.0);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_2(ctx, true, use_future);
ctx.restart();
ctx.run();
try
{
int i;
double d;
std::tie(i, d) = f.get();
ASIO_CHECK(i == 42);
ASIO_CHECK(d == 2.0);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_2(ctx, false, use_future);
ctx.restart();
ctx.run();
try
{
std::tuple<int, double> t = f.get();
ASIO_CHECK(false);
(void)t;
}
catch (asio::system_error& e)
{
ASIO_CHECK(e.code() == asio::error::operation_aborted);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_2(ctx, true, use_future);
ctx.restart();
ctx.run();
try
{
int i;
double d;
std::tie(i, d) = f.get();
ASIO_CHECK(i == 42);
ASIO_CHECK(d == 2.0);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_2(ctx, false, use_future);
ctx.restart();
ctx.run();
try
{
std::tuple<int, double> t = f.get();
ASIO_CHECK(false);
(void)t;
}
catch (std::exception& e)
{
ASIO_CHECK(e.what() == std::string("blah"));
}
catch (...)
{
ASIO_CHECK(false);
}
#endif // !defined(ASIO_NO_DEPRECATED)
}
void deprecated_use_future_3_test()
{
#if !defined(ASIO_NO_DEPRECATED)
using asio::use_future;
using namespace archetypes;
std::future<std::tuple<int, double, char>> f;
asio::io_context ctx;
f = deprecated_async_op_3(ctx, use_future);
ctx.restart();
ctx.run();
try
{
int i;
double d;
char c;
std::tie(i, d, c) = f.get();
ASIO_CHECK(i == 42);
ASIO_CHECK(d == 2.0);
ASIO_CHECK(c == 'a');
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_3(ctx, true, use_future);
ctx.restart();
ctx.run();
try
{
int i;
double d;
char c;
std::tie(i, d, c) = f.get();
ASIO_CHECK(i == 42);
ASIO_CHECK(d == 2.0);
ASIO_CHECK(c == 'a');
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_3(ctx, false, use_future);
ctx.restart();
ctx.run();
try
{
std::tuple<int, double, char> t = f.get();
ASIO_CHECK(false);
(void)t;
}
catch (asio::system_error& e)
{
ASIO_CHECK(e.code() == asio::error::operation_aborted);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_3(ctx, true, use_future);
ctx.restart();
ctx.run();
try
{
int i;
double d;
char c;
std::tie(i, d, c) = f.get();
ASIO_CHECK(i == 42);
ASIO_CHECK(d == 2.0);
ASIO_CHECK(c == 'a');
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_3(ctx, false, use_future);
ctx.restart();
ctx.run();
try
{
std::tuple<int, double, char> t = f.get();
ASIO_CHECK(false);
(void)t;
}
catch (std::exception& e)
{
ASIO_CHECK(e.what() == std::string("blah"));
}
catch (...)
{
ASIO_CHECK(false);
}
#endif // !defined(ASIO_NO_DEPRECATED)
}
void deprecated_use_future_package_0_test()
{
#if !defined(ASIO_NO_DEPRECATED)
using asio::use_future;
using namespace archetypes;
std::future<int> f;
asio::io_context ctx;
f = deprecated_async_op_0(ctx, use_future(package_0));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_0(ctx, true, use_future(&package_ec_0));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_0(ctx, false, use_future(package_ec_0));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 0);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_0(ctx, true, use_future(package_ex_0));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_0(ctx, false, use_future(package_ex_0));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 0);
}
catch (...)
{
ASIO_CHECK(false);
}
#endif // !defined(ASIO_NO_DEPRECATED)
}
void deprecated_use_future_package_1_test()
{
#if !defined(ASIO_NO_DEPRECATED)
using asio::use_future;
using namespace archetypes;
std::future<int> f;
asio::io_context ctx;
f = deprecated_async_op_1(ctx, use_future(package_1));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_1(ctx, true, use_future(package_ec_1));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_1(ctx, false, use_future(package_ec_1));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 0);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_1(ctx, true, use_future(package_ex_1));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_1(ctx, false, use_future(package_ex_1));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 0);
}
catch (...)
{
ASIO_CHECK(false);
}
#endif // !defined(ASIO_NO_DEPRECATED)
}
void deprecated_use_future_package_2_test()
{
#if !defined(ASIO_NO_DEPRECATED)
using asio::use_future;
using namespace archetypes;
std::future<int> f;
asio::io_context ctx;
f = deprecated_async_op_2(ctx, use_future(package_2));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_2(ctx, true, use_future(package_ec_2));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_2(ctx, false, use_future(package_ec_2));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 0);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_2(ctx, true, use_future(package_ex_2));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_2(ctx, false, use_future(package_ex_2));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 0);
}
catch (...)
{
ASIO_CHECK(false);
}
#endif // !defined(ASIO_NO_DEPRECATED)
}
void deprecated_use_future_package_3_test()
{
#if !defined(ASIO_NO_DEPRECATED)
using asio::use_future;
using namespace archetypes;
std::future<int> f;
asio::io_context ctx;
f = deprecated_async_op_3(ctx, use_future(package_3));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_3(ctx, true, use_future(package_ec_3));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ec_3(ctx, false, use_future(package_ec_3));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 0);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_3(ctx, true, use_future(package_ex_3));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 42);
}
catch (...)
{
ASIO_CHECK(false);
}
f = deprecated_async_op_ex_3(ctx, false, use_future(package_ex_3));
ctx.restart();
ctx.run();
try
{
int i = f.get();
ASIO_CHECK(i == 0);
}
catch (...)
{
ASIO_CHECK(false);
}
#endif // !defined(ASIO_NO_DEPRECATED)
}
ASIO_TEST_SUITE
(
"use_future",
@ -1325,14 +657,6 @@ ASIO_TEST_SUITE
ASIO_TEST_CASE(use_future_package_1_test)
ASIO_TEST_CASE(use_future_package_2_test)
ASIO_TEST_CASE(use_future_package_3_test)
ASIO_TEST_CASE(deprecated_use_future_0_test)
ASIO_TEST_CASE(deprecated_use_future_1_test)
ASIO_TEST_CASE(deprecated_use_future_2_test)
ASIO_TEST_CASE(deprecated_use_future_3_test)
ASIO_TEST_CASE(deprecated_use_future_package_0_test)
ASIO_TEST_CASE(deprecated_use_future_package_1_test)
ASIO_TEST_CASE(deprecated_use_future_package_2_test)
ASIO_TEST_CASE(deprecated_use_future_package_3_test)
)
#else // defined(ASIO_HAS_STD_FUTURE)