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 ASIO_DETACHED_HPP
12 #define 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 "asio/detail/config.hpp"
19 #include <memory>
20 
21 #include "asio/detail/push_options.hpp"
22 
23 namespace asio {
24 
25 /// Class used to specify that an asynchronous operation is detached.
26 /**
27 
28  * The detached_t class is used to indicate that an asynchronous operation is
29  * detached. That is, there is no completion handler waiting for the
30  * operation's result. A detached_t object may be passed as a handler to an
31  * asynchronous operation, typically using the special value
32  * @c asio::detached. For example:
33 
34  * @code my_socket.async_send(my_buffer, asio::detached);
35  * @endcode
36  */
37 class detached_t
38 {
39 public:
40   /// Constructor.
detached_t()41   ASIO_CONSTEXPR detached_t()
42   {
43   }
44 };
45 
46 /// A special value, similar to std::nothrow.
47 /**
48  * See the documentation for asio::detached_t for a usage example.
49  */
50 #if defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
51 constexpr detached_t detached;
52 #elif defined(ASIO_MSVC)
53 __declspec(selectany) detached_t detached;
54 #endif
55 
56 } // namespace asio
57 
58 #include "asio/detail/pop_options.hpp"
59 
60 #include "asio/impl/detached.hpp"
61 
62 #endif // ASIO_DETACHED_HPP
63