1 //
2 // detached.hpp
3 // ~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
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)
9 //
10 
11 #ifndef BOOST_ASIO_DETACHED_HPP
12 #define BOOST_ASIO_DETACHED_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include <boost/asio/detail/config.hpp>
19 #include <memory>
20 
21 #include <boost/asio/detail/push_options.hpp>
22 
23 namespace boost {
24 namespace asio {
25 
26 /// Class used to specify that an asynchronous operation is detached.
27 /**
28 
29  * The detached_t class is used to indicate that an asynchronous operation is
30  * detached. That is, there is no completion handler waiting for the
31  * operation's result. A detached_t object may be passed as a handler to an
32  * asynchronous operation, typically using the special value
33  * @c boost::asio::detached. For example:
34 
35  * @code my_socket.async_send(my_buffer, boost::asio::detached);
36  * @endcode
37  */
38 class detached_t
39 {
40 public:
41   /// Constructor.
detached_t()42   BOOST_ASIO_CONSTEXPR detached_t()
43   {
44   }
45 };
46 
47 /// A special value, similar to std::nothrow.
48 /**
49  * See the documentation for boost::asio::detached_t for a usage example.
50  */
51 #if defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
52 constexpr detached_t detached;
53 #elif defined(BOOST_ASIO_MSVC)
54 __declspec(selectany) detached_t detached;
55 #endif
56 
57 } // namespace asio
58 } // namespace boost
59 
60 #include <boost/asio/detail/pop_options.hpp>
61 
62 #include <boost/asio/impl/detached.hpp>
63 
64 #endif // BOOST_ASIO_DETACHED_HPP
65