Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:33:45

0001 //
0002 // prepend.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_PREPEND_HPP
0012 #define BOOST_ASIO_PREPEND_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 <tuple>
0020 #include <boost/asio/detail/type_traits.hpp>
0021 
0022 #include <boost/asio/detail/push_options.hpp>
0023 
0024 namespace boost {
0025 namespace asio {
0026 
0027 /// Completion token type used to specify that the completion handler
0028 /// arguments should be passed additional values before the results of the
0029 /// operation.
0030 template <typename CompletionToken, typename... Values>
0031 class prepend_t
0032 {
0033 public:
0034   /// Constructor.
0035   template <typename T, typename... V>
0036   constexpr explicit prepend_t(T&& completion_token, V&&... values)
0037     : token_(static_cast<T&&>(completion_token)),
0038       values_(static_cast<V&&>(values)...)
0039   {
0040   }
0041 
0042 //private:
0043   CompletionToken token_;
0044   std::tuple<Values...> values_;
0045 };
0046 
0047 /// Completion token type used to specify that the completion handler
0048 /// arguments should be passed additional values before the results of the
0049 /// operation.
0050 template <typename CompletionToken, typename... Values>
0051 BOOST_ASIO_NODISCARD inline constexpr
0052 prepend_t<decay_t<CompletionToken>, decay_t<Values>...>
0053 prepend(CompletionToken&& completion_token,
0054     Values&&... values)
0055 {
0056   return prepend_t<decay_t<CompletionToken>, decay_t<Values>...>(
0057       static_cast<CompletionToken&&>(completion_token),
0058       static_cast<Values&&>(values)...);
0059 }
0060 
0061 } // namespace asio
0062 } // namespace boost
0063 
0064 #include <boost/asio/detail/pop_options.hpp>
0065 
0066 #include <boost/asio/impl/prepend.hpp>
0067 
0068 #endif // BOOST_ASIO_PREPEND_HPP