boost::system::error_code(), 0, 1);
}
- struct initiate_async_write_buffer_sequence
+ template <typename AsyncWriteStream>
+ class initiate_async_write_buffer_sequence
{
- template <typename WriteHandler, typename AsyncWriteStream,
- typename ConstBufferSequence, typename CompletionCondition>
+ public:
+ typedef typename AsyncWriteStream::executor_type executor_type;
+
+ explicit initiate_async_write_buffer_sequence(AsyncWriteStream& stream)
+ : stream_(stream)
+ {
+ }
+
+ executor_type get_executor() const BOOST_ASIO_NOEXCEPT
+ {
+ return stream_.get_executor();
+ }
+
+ template <typename WriteHandler, typename ConstBufferSequence,
+ typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
- AsyncWriteStream* s, const ConstBufferSequence& buffers,
+ const ConstBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
{
// If you get an error on the following line it means that your handler
non_const_lvalue<WriteHandler> handler2(handler);
non_const_lvalue<CompletionCondition> completion_cond2(completion_cond);
- start_write_buffer_sequence_op(*s, buffers,
+ start_write_buffer_sequence_op(stream_, buffers,
boost::asio::buffer_sequence_begin(buffers),
completion_cond2.value, handler2.value);
}
+
+ private:
+ AsyncWriteStream& stream_;
};
} // namespace detail
#endif // !defined(GENERATING_DOCUMENTATION)
-template <typename AsyncWriteStream, typename ConstBufferSequence,
- typename CompletionCondition, typename WriteHandler>
-inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+template <typename AsyncWriteStream,
+ typename ConstBufferSequence, typename CompletionCondition,
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
+ std::size_t)) WriteHandler>
+inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
CompletionCondition completion_condition,
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
- detail::initiate_async_write_buffer_sequence(), handler, &s, buffers,
+ detail::initiate_async_write_buffer_sequence<AsyncWriteStream>(s),
+ handler, buffers,
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}
template <typename AsyncWriteStream, typename ConstBufferSequence,
- typename WriteHandler>
-inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
+ std::size_t)) WriteHandler>
+inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
- detail::initiate_async_write_buffer_sequence(),
- handler, &s, buffers, transfer_all());
+ detail::initiate_async_write_buffer_sequence<AsyncWriteStream>(s),
+ handler, buffers, transfer_all());
}
#if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1)
function, this_handler->handler_);
}
- struct initiate_async_write_dynbuf_v1
+ template <typename AsyncWriteStream>
+ class initiate_async_write_dynbuf_v1
{
- template <typename WriteHandler, typename AsyncWriteStream,
- typename DynamicBuffer_v1, typename CompletionCondition>
+ public:
+ typedef typename AsyncWriteStream::executor_type executor_type;
+
+ explicit initiate_async_write_dynbuf_v1(AsyncWriteStream& stream)
+ : stream_(stream)
+ {
+ }
+
+ executor_type get_executor() const BOOST_ASIO_NOEXCEPT
+ {
+ return stream_.get_executor();
+ }
+
+ template <typename WriteHandler, typename DynamicBuffer_v1,
+ typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
- AsyncWriteStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
+ BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
{
// If you get an error on the following line it means that your handler
write_dynbuf_v1_op<AsyncWriteStream,
typename decay<DynamicBuffer_v1>::type,
CompletionCondition, typename decay<WriteHandler>::type>(
- *s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
+ stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
completion_cond2.value, handler2.value)(
boost::system::error_code(), 0, 1);
}
+
+ private:
+ AsyncWriteStream& stream_;
};
} // namespace detail
#endif // !defined(GENERATING_DOCUMENTATION)
-template <typename AsyncWriteStream,
- typename DynamicBuffer_v1, typename WriteHandler>
-inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+template <typename AsyncWriteStream, typename DynamicBuffer_v1,
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
+ std::size_t)) WriteHandler>
+inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
transfer_all(), BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
-template <typename AsyncWriteStream, typename DynamicBuffer_v1,
- typename CompletionCondition, typename WriteHandler>
-inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+template <typename AsyncWriteStream,
+ typename DynamicBuffer_v1, typename CompletionCondition,
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
+ std::size_t)) WriteHandler>
+inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s,
BOOST_ASIO_MOVE_ARG(DynamicBuffer_v1) buffers,
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
- detail::initiate_async_write_dynbuf_v1(), handler, &s,
- BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
+ detail::initiate_async_write_dynbuf_v1<AsyncWriteStream>(s),
+ handler, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v1)(buffers),
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}
#if !defined(BOOST_ASIO_NO_EXTENSIONS)
#if !defined(BOOST_ASIO_NO_IOSTREAM)
-template <typename AsyncWriteStream, typename Allocator, typename WriteHandler>
-inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+template <typename AsyncWriteStream, typename Allocator,
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
+ std::size_t)) WriteHandler>
+inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s,
boost::asio::basic_streambuf<Allocator>& b,
BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
-template <typename AsyncWriteStream, typename Allocator,
- typename CompletionCondition, typename WriteHandler>
-inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+template <typename AsyncWriteStream,
+ typename Allocator, typename CompletionCondition,
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
+ std::size_t)) WriteHandler>
+inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s,
boost::asio::basic_streambuf<Allocator>& b,
function, this_handler->handler_);
}
- struct initiate_async_write_dynbuf_v2
+ template <typename AsyncWriteStream>
+ class initiate_async_write_dynbuf_v2
{
- template <typename WriteHandler, typename AsyncWriteStream,
- typename DynamicBuffer_v2, typename CompletionCondition>
+ public:
+ typedef typename AsyncWriteStream::executor_type executor_type;
+
+ explicit initiate_async_write_dynbuf_v2(AsyncWriteStream& stream)
+ : stream_(stream)
+ {
+ }
+
+ executor_type get_executor() const BOOST_ASIO_NOEXCEPT
+ {
+ return stream_.get_executor();
+ }
+
+ template <typename WriteHandler, typename DynamicBuffer_v2,
+ typename CompletionCondition>
void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
- AsyncWriteStream* s, BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
+ BOOST_ASIO_MOVE_ARG(DynamicBuffer_v2) buffers,
BOOST_ASIO_MOVE_ARG(CompletionCondition) completion_cond) const
{
// If you get an error on the following line it means that your handler
write_dynbuf_v2_op<AsyncWriteStream,
typename decay<DynamicBuffer_v2>::type,
CompletionCondition, typename decay<WriteHandler>::type>(
- *s, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
+ stream_, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
completion_cond2.value, handler2.value)(
boost::system::error_code(), 0, 1);
}
+
+ private:
+ AsyncWriteStream& stream_;
};
} // namespace detail
#endif // !defined(GENERATING_DOCUMENTATION)
-template <typename AsyncWriteStream,
- typename DynamicBuffer_v2, typename WriteHandler>
-inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+template <typename AsyncWriteStream, typename DynamicBuffer_v2,
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
+ std::size_t)) WriteHandler>
+inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
transfer_all(), BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
-template <typename AsyncWriteStream, typename DynamicBuffer_v2,
- typename CompletionCondition, typename WriteHandler>
-inline BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler,
+template <typename AsyncWriteStream,
+ typename DynamicBuffer_v2, typename CompletionCondition,
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
+ std::size_t)) WriteHandler>
+inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WriteHandler,
void (boost::system::error_code, std::size_t))
async_write(AsyncWriteStream& s, DynamicBuffer_v2 buffers,
CompletionCondition completion_condition,
{
return async_initiate<WriteHandler,
void (boost::system::error_code, std::size_t)>(
- detail::initiate_async_write_dynbuf_v2(), handler, &s,
- BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
+ detail::initiate_async_write_dynbuf_v2<AsyncWriteStream>(s),
+ handler, BOOST_ASIO_MOVE_CAST(DynamicBuffer_v2)(buffers),
BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition));
}