]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/asio/impl/buffered_write_stream.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / impl / buffered_write_stream.hpp
index 719ee9d4f971591ca373a91ebf36705f14b114db..2b9e88e16f320886bd2d117e06c0d679acb3e69b 100644 (file)
@@ -2,7 +2,7 @@
 // impl/buffered_write_stream.hpp
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -15,8 +15,7 @@
 # pragma once
 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
-#include <boost/asio/associated_allocator.hpp>
-#include <boost/asio/associated_executor.hpp>
+#include <boost/asio/associator.hpp>
 #include <boost/asio/detail/handler_alloc_helpers.hpp>
 #include <boost/asio/detail/handler_cont_helpers.hpp>
 #include <boost/asio/detail/handler_invoke_helpers.hpp>
@@ -78,7 +77,7 @@ namespace detail
         const std::size_t bytes_written)
     {
       storage_.consume(bytes_written);
-      handler_(ec, bytes_written);
+      BOOST_ASIO_MOVE_OR_LVALUE(WriteHandler)(handler_)(ec, bytes_written);
     }
 
   //private:
@@ -183,30 +182,18 @@ namespace detail
 
 #if !defined(GENERATING_DOCUMENTATION)
 
-template <typename WriteHandler, typename Allocator>
-struct associated_allocator<
-    detail::buffered_flush_handler<WriteHandler>, Allocator>
+template <template <typename, typename> class Associator,
+    typename WriteHandler, typename DefaultCandidate>
+struct associator<Associator,
+    detail::buffered_flush_handler<WriteHandler>,
+    DefaultCandidate>
+  : Associator<WriteHandler, DefaultCandidate>
 {
-  typedef typename associated_allocator<WriteHandler, Allocator>::type type;
-
-  static type get(const detail::buffered_flush_handler<WriteHandler>& h,
-      const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT
-  {
-    return associated_allocator<WriteHandler, Allocator>::get(h.handler_, a);
-  }
-};
-
-template <typename WriteHandler, typename Executor>
-struct associated_executor<
-    detail::buffered_flush_handler<WriteHandler>, Executor>
-  : detail::associated_executor_forwarding_base<WriteHandler, Executor>
-{
-  typedef typename associated_executor<WriteHandler, Executor>::type type;
-
-  static type get(const detail::buffered_flush_handler<WriteHandler>& h,
-      const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT
+  static typename Associator<WriteHandler, DefaultCandidate>::type get(
+      const detail::buffered_flush_handler<WriteHandler>& h,
+      const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
   {
-    return associated_executor<WriteHandler, Executor>::get(h.handler_, ex);
+    return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c);
   }
 };
 
@@ -294,7 +281,7 @@ namespace detail
       if (ec)
       {
         const std::size_t length = 0;
-        handler_(ec, length);
+        BOOST_ASIO_MOVE_OR_LVALUE(WriteHandler)(handler_)(ec, length);
       }
       else
       {
@@ -307,7 +294,7 @@ namespace detail
         storage_.resize(orig_size + length);
         const std::size_t bytes_copied = boost::asio::buffer_copy(
             storage_.data() + orig_size, buffers_, length);
-        handler_(ec, bytes_copied);
+        BOOST_ASIO_MOVE_OR_LVALUE(WriteHandler)(handler_)(ec, bytes_copied);
       }
     }
 
@@ -435,38 +422,20 @@ namespace detail
 
 #if !defined(GENERATING_DOCUMENTATION)
 
-template <typename ConstBufferSequence,
-    typename WriteHandler, typename Allocator>
-struct associated_allocator<
+template <template <typename, typename> class Associator,
+    typename ConstBufferSequence, typename WriteHandler,
+    typename DefaultCandidate>
+struct associator<Associator,
     detail::buffered_write_some_handler<ConstBufferSequence, WriteHandler>,
-    Allocator>
+    DefaultCandidate>
+  : Associator<WriteHandler, DefaultCandidate>
 {
-  typedef typename associated_allocator<WriteHandler, Allocator>::type type;
-
-  static type get(
-      const detail::buffered_write_some_handler<
-        ConstBufferSequence, WriteHandler>& h,
-      const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT
-  {
-    return associated_allocator<WriteHandler, Allocator>::get(h.handler_, a);
-  }
-};
-
-template <typename ConstBufferSequence,
-    typename WriteHandler, typename Executor>
-struct associated_executor<
-    detail::buffered_write_some_handler<ConstBufferSequence, WriteHandler>,
-    Executor>
-  : detail::associated_executor_forwarding_base<WriteHandler, Executor>
-{
-  typedef typename associated_executor<WriteHandler, Executor>::type type;
-
-  static type get(
+  static typename Associator<WriteHandler, DefaultCandidate>::type get(
       const detail::buffered_write_some_handler<
         ConstBufferSequence, WriteHandler>& h,
-      const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT
+      const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
   {
-    return associated_executor<WriteHandler, Executor>::get(h.handler_, ex);
+    return Associator<WriteHandler, DefaultCandidate>::get(h.handler_, c);
   }
 };