Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:55

0001 //
0002 // impl/detached.hpp
0003 // ~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_IMPL_DETACHED_HPP
0012 #define BOOST_ASIO_IMPL_DETACHED_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/async_result.hpp>
0020 
0021 #include <boost/asio/detail/push_options.hpp>
0022 
0023 namespace boost {
0024 namespace asio {
0025 namespace detail {
0026 
0027   // Class to adapt a detached_t as a completion handler.
0028   class detached_handler
0029   {
0030   public:
0031     typedef void result_type;
0032 
0033     detached_handler(detached_t)
0034     {
0035     }
0036 
0037     template <typename... Args>
0038     void operator()(Args...)
0039     {
0040     }
0041   };
0042 
0043 } // namespace detail
0044 
0045 #if !defined(GENERATING_DOCUMENTATION)
0046 
0047 template <typename Signature>
0048 struct async_result<detached_t, Signature>
0049 {
0050   typedef boost::asio::detail::detached_handler completion_handler_type;
0051 
0052   typedef void return_type;
0053 
0054   explicit async_result(completion_handler_type&)
0055   {
0056   }
0057 
0058   void get()
0059   {
0060   }
0061 
0062   template <typename Initiation, typename RawCompletionToken, typename... Args>
0063   static return_type initiate(Initiation&& initiation,
0064       RawCompletionToken&&, Args&&... args)
0065   {
0066     static_cast<Initiation&&>(initiation)(
0067         detail::detached_handler(detached_t()),
0068         static_cast<Args&&>(args)...);
0069   }
0070 };
0071 
0072 #endif // !defined(GENERATING_DOCUMENTATION)
0073 
0074 } // namespace asio
0075 } // namespace boost
0076 
0077 #include <boost/asio/detail/pop_options.hpp>
0078 
0079 #endif // BOOST_ASIO_IMPL_DETACHED_HPP