2 // detail/base_from_completion_cond.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP
12 #define BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
19 #include <boost/asio/completion_condition.hpp>
21 #include <boost/asio/detail/push_options.hpp>
27 template <typename CompletionCondition>
28 class base_from_completion_cond
31 explicit base_from_completion_cond(CompletionCondition& completion_condition)
32 : completion_condition_(
33 BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition))
37 std::size_t check_for_completion(
38 const boost::system::error_code& ec,
39 std::size_t total_transferred)
41 return detail::adapt_completion_condition_result(
42 completion_condition_(ec, total_transferred));
46 CompletionCondition completion_condition_;
50 class base_from_completion_cond<transfer_all_t>
53 explicit base_from_completion_cond(transfer_all_t)
57 static std::size_t check_for_completion(
58 const boost::system::error_code& ec,
59 std::size_t total_transferred)
61 return transfer_all_t()(ec, total_transferred);
69 #include <boost/asio/detail/pop_options.hpp>
71 #endif // BOOST_ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP