1//
2// append.hpp
3// ~~~~~~~~~~
4//
5// Copyright (c) 2003-2024 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_APPEND_HPP
12#define BOOST_ASIO_APPEND_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 <tuple>
20#include <boost/asio/detail/type_traits.hpp>
21
22#include <boost/asio/detail/push_options.hpp>
23
24namespace boost {
25namespace asio {
26
27/// Completion token type used to specify that the completion handler
28/// arguments should be passed additional values after the results of the
29/// operation.
30template <typename CompletionToken, typename... Values>
31class append_t
32{
33public:
34 /// Constructor.
35 template <typename T, typename... V>
36 constexpr explicit append_t(T&& completion_token, V&&... values)
37 : token_(static_cast<T&&>(completion_token)),
38 values_(static_cast<V&&>(values)...)
39 {
40 }
41
42//private:
43 CompletionToken token_;
44 std::tuple<Values...> values_;
45};
46
47/// Completion token type used to specify that the completion handler
48/// arguments should be passed additional values after the results of the
49/// operation.
50template <typename CompletionToken, typename... Values>
51BOOST_ASIO_NODISCARD inline constexpr
52append_t<decay_t<CompletionToken>, decay_t<Values>...>
53append(CompletionToken&& completion_token, Values&&... values)
54{
55 return append_t<decay_t<CompletionToken>, decay_t<Values>...>(
56 static_cast<CompletionToken&&>(completion_token),
57 static_cast<Values&&>(values)...);
58}
59
60} // namespace asio
61} // namespace boost
62
63#include <boost/asio/detail/pop_options.hpp>
64
65#include <boost/asio/impl/append.hpp>
66
67#endif // BOOST_ASIO_APPEND_HPP
68

source code of boost/libs/asio/include/boost/asio/append.hpp