Update to boost 1.82.0 and add url

This commit is contained in:
Rokkubro 2023-05-22 18:45:02 +10:00
parent 80a171a179
commit fb7a9e1f28
1044 changed files with 71398 additions and 5293 deletions

View File

@ -144,7 +144,7 @@ import option ;
import tools/boost\_install/boost-install ;
path-constant BOOST_ROOT : . ;
constant BOOST_VERSION : 1.80.0 ;
constant BOOST_VERSION : 1.82.0 ;
constant BOOST_JAMROOT_MODULE : $(__name__) ;
# Allow subprojects to simply `import config : requires ;` to get access to the requires rule

27
boost/align/align_up.hpp Normal file
View File

@ -0,0 +1,27 @@
/*
Copyright 2015 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_ALIGN_ALIGN_UP_HPP
#define BOOST_ALIGN_ALIGN_UP_HPP
#include <boost/align/detail/align_up.hpp>
#include <boost/align/detail/not_pointer.hpp>
namespace boost {
namespace alignment {
template<class T>
BOOST_CONSTEXPR inline typename detail::not_pointer<T, T>::type
align_up(T value, std::size_t alignment) BOOST_NOEXCEPT
{
return T((value + (T(alignment) - 1)) & ~T(alignment - 1));
}
} /* alignment */
} /* boost */
#endif

View File

@ -38,7 +38,7 @@ Distributed under the Boost Software License, Version 1.0.
#include <boost/align/detail/aligned_alloc_posix.hpp>
#elif defined(sun) || defined(__sun)
#include <boost/align/detail/aligned_alloc_sunos.hpp>
#elif (_POSIX_C_SOURCE >= 200112L) || (_XOPEN_SOURCE >= 600)
#elif defined(_POSIX_VERSION)
#include <boost/align/detail/aligned_alloc_posix.hpp>
#else
#include <boost/align/detail/aligned_alloc.hpp>

View File

@ -0,0 +1,28 @@
/*
Copyright 2015 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_ALIGN_DETAIL_ALIGN_UP_HPP
#define BOOST_ALIGN_DETAIL_ALIGN_UP_HPP
#include <boost/align/detail/is_alignment.hpp>
#include <boost/assert.hpp>
namespace boost {
namespace alignment {
inline void*
align_up(void* ptr, std::size_t alignment) BOOST_NOEXCEPT
{
BOOST_ASSERT(detail::is_alignment(alignment));
return reinterpret_cast<void*>(~(alignment - 1) &
(reinterpret_cast<std::size_t>(ptr) + alignment - 1));
}
} /* alignment */
} /* boost */
#endif

View File

@ -0,0 +1,27 @@
/*
Copyright 2019 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_ALIGN_DETAIL_NOT_POINTER_HPP
#define BOOST_ALIGN_DETAIL_NOT_POINTER_HPP
namespace boost {
namespace alignment {
namespace detail {
template<class T, class U>
struct not_pointer {
typedef U type;
};
template<class T, class U>
struct not_pointer<T*, U> { };
} /* detail */
} /* alignment */
} /* boost */
#endif

View File

@ -44,8 +44,8 @@
#include <iterator>
#include <stdexcept>
#include <boost/assert.hpp>
#include <boost/core/swap.hpp>
#include <boost/static_assert.hpp>
#include <boost/swap.hpp>
#include <boost/throw_exception.hpp>
#include <algorithm>

View File

@ -2,7 +2,7 @@
// asio.hpp
// ~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -17,11 +17,15 @@
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <boost/asio/any_completion_executor.hpp>
#include <boost/asio/any_completion_handler.hpp>
#include <boost/asio/any_io_executor.hpp>
#include <boost/asio/append.hpp>
#include <boost/asio/as_tuple.hpp>
#include <boost/asio/associated_allocator.hpp>
#include <boost/asio/associated_executor.hpp>
#include <boost/asio/associated_cancellation_slot.hpp>
#include <boost/asio/associated_executor.hpp>
#include <boost/asio/associated_immediate_executor.hpp>
#include <boost/asio/associator.hpp>
#include <boost/asio/async_result.hpp>
#include <boost/asio/awaitable.hpp>
@ -47,6 +51,7 @@
#include <boost/asio/bind_allocator.hpp>
#include <boost/asio/bind_cancellation_slot.hpp>
#include <boost/asio/bind_executor.hpp>
#include <boost/asio/bind_immediate_executor.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/asio/buffer_registration.hpp>
#include <boost/asio/buffered_read_stream_fwd.hpp>
@ -64,6 +69,7 @@
#include <boost/asio/compose.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/connect_pipe.hpp>
#include <boost/asio/consign.hpp>
#include <boost/asio/coroutine.hpp>
#include <boost/asio/deadline_timer.hpp>
#include <boost/asio/defer.hpp>
@ -148,6 +154,7 @@
#include <boost/asio/local/basic_endpoint.hpp>
#include <boost/asio/local/connect_pair.hpp>
#include <boost/asio/local/datagram_protocol.hpp>
#include <boost/asio/local/seq_packet_protocol.hpp>
#include <boost/asio/local/stream_protocol.hpp>
#include <boost/asio/multiple_exceptions.hpp>
#include <boost/asio/packaged_task.hpp>
@ -174,6 +181,7 @@
#include <boost/asio/serial_port.hpp>
#include <boost/asio/serial_port_base.hpp>
#include <boost/asio/signal_set.hpp>
#include <boost/asio/signal_set_base.hpp>
#include <boost/asio/socket_base.hpp>
#include <boost/asio/static_thread_pool.hpp>
#include <boost/asio/steady_timer.hpp>

View File

@ -0,0 +1,344 @@
//
// any_completion_executor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2023 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)
//
#ifndef BOOST_ASIO_ANY_COMPLETION_EXECUTOR_HPP
#define BOOST_ASIO_ANY_COMPLETION_EXECUTOR_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <boost/asio/detail/config.hpp>
#if defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
# include <boost/asio/executor.hpp>
#else // defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
# include <boost/asio/execution.hpp>
#endif // defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
#if defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
typedef executor any_completion_executor;
#else // defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
/// Polymorphic executor type for use with I/O objects.
/**
* The @c any_completion_executor type is a polymorphic executor that supports
* the set of properties required for the execution of completion handlers. It
* is defined as the execution::any_executor class template parameterised as
* follows:
* @code execution::any_executor<
* execution::prefer_only<execution::outstanding_work_t::tracked_t>,
* execution::prefer_only<execution::outstanding_work_t::untracked_t>
* execution::prefer_only<execution::relationship_t::fork_t>,
* execution::prefer_only<execution::relationship_t::continuation_t>
* > @endcode
*/
class any_completion_executor :
#if defined(GENERATING_DOCUMENTATION)
public execution::any_executor<...>
#else // defined(GENERATING_DOCUMENTATION)
public execution::any_executor<
execution::prefer_only<execution::outstanding_work_t::tracked_t>,
execution::prefer_only<execution::outstanding_work_t::untracked_t>,
execution::prefer_only<execution::relationship_t::fork_t>,
execution::prefer_only<execution::relationship_t::continuation_t>
>
#endif // defined(GENERATING_DOCUMENTATION)
{
public:
#if !defined(GENERATING_DOCUMENTATION)
typedef execution::any_executor<
execution::prefer_only<execution::outstanding_work_t::tracked_t>,
execution::prefer_only<execution::outstanding_work_t::untracked_t>,
execution::prefer_only<execution::relationship_t::fork_t>,
execution::prefer_only<execution::relationship_t::continuation_t>
> base_type;
typedef void supportable_properties_type(
execution::prefer_only<execution::outstanding_work_t::tracked_t>,
execution::prefer_only<execution::outstanding_work_t::untracked_t>,
execution::prefer_only<execution::relationship_t::fork_t>,
execution::prefer_only<execution::relationship_t::continuation_t>
);
#endif // !defined(GENERATING_DOCUMENTATION)
/// Default constructor.
BOOST_ASIO_DECL any_completion_executor() BOOST_ASIO_NOEXCEPT;
/// Construct in an empty state. Equivalent effects to default constructor.
BOOST_ASIO_DECL any_completion_executor(nullptr_t) BOOST_ASIO_NOEXCEPT;
/// Copy constructor.
BOOST_ASIO_DECL any_completion_executor(
const any_completion_executor& e) BOOST_ASIO_NOEXCEPT;
#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Move constructor.
BOOST_ASIO_DECL any_completion_executor(
any_completion_executor&& e) BOOST_ASIO_NOEXCEPT;
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Construct to point to the same target as another any_executor.
#if defined(GENERATING_DOCUMENTATION)
template <class... OtherSupportableProperties>
any_completion_executor(
execution::any_executor<OtherSupportableProperties...> e);
#else // defined(GENERATING_DOCUMENTATION)
template <typename OtherAnyExecutor>
any_completion_executor(OtherAnyExecutor e,
typename constraint<
conditional<
!is_same<OtherAnyExecutor, any_completion_executor>::value
&& is_base_of<execution::detail::any_executor_base,
OtherAnyExecutor>::value,
typename execution::detail::supportable_properties<
0, supportable_properties_type>::template
is_valid_target<OtherAnyExecutor>,
false_type
>::type::value
>::type = 0)
: base_type(BOOST_ASIO_MOVE_CAST(OtherAnyExecutor)(e))
{
}
#endif // defined(GENERATING_DOCUMENTATION)
/// Construct to point to the same target as another any_executor.
#if defined(GENERATING_DOCUMENTATION)
template <class... OtherSupportableProperties>
any_completion_executor(std::nothrow_t,
execution::any_executor<OtherSupportableProperties...> e);
#else // defined(GENERATING_DOCUMENTATION)
template <typename OtherAnyExecutor>
any_completion_executor(std::nothrow_t, OtherAnyExecutor e,
typename constraint<
conditional<
!is_same<OtherAnyExecutor, any_completion_executor>::value
&& is_base_of<execution::detail::any_executor_base,
OtherAnyExecutor>::value,
typename execution::detail::supportable_properties<
0, supportable_properties_type>::template
is_valid_target<OtherAnyExecutor>,
false_type
>::type::value
>::type = 0) BOOST_ASIO_NOEXCEPT
: base_type(std::nothrow, BOOST_ASIO_MOVE_CAST(OtherAnyExecutor)(e))
{
}
#endif // defined(GENERATING_DOCUMENTATION)
/// Construct to point to the same target as another any_executor.
BOOST_ASIO_DECL any_completion_executor(std::nothrow_t,
const any_completion_executor& e) BOOST_ASIO_NOEXCEPT;
#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Construct to point to the same target as another any_executor.
BOOST_ASIO_DECL any_completion_executor(std::nothrow_t,
any_completion_executor&& e) BOOST_ASIO_NOEXCEPT;
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Construct a polymorphic wrapper for the specified executor.
#if defined(GENERATING_DOCUMENTATION)
template <BOOST_ASIO_EXECUTION_EXECUTOR Executor>
any_completion_executor(Executor e);
#else // defined(GENERATING_DOCUMENTATION)
template <BOOST_ASIO_EXECUTION_EXECUTOR Executor>
any_completion_executor(Executor e,
typename constraint<
conditional<
!is_same<Executor, any_completion_executor>::value
&& !is_base_of<execution::detail::any_executor_base,
Executor>::value,
execution::detail::is_valid_target_executor<
Executor, supportable_properties_type>,
false_type
>::type::value
>::type = 0)
: base_type(BOOST_ASIO_MOVE_CAST(Executor)(e))
{
}
#endif // defined(GENERATING_DOCUMENTATION)
/// Construct a polymorphic wrapper for the specified executor.
#if defined(GENERATING_DOCUMENTATION)
template <BOOST_ASIO_EXECUTION_EXECUTOR Executor>
any_completion_executor(std::nothrow_t, Executor e);
#else // defined(GENERATING_DOCUMENTATION)
template <BOOST_ASIO_EXECUTION_EXECUTOR Executor>
any_completion_executor(std::nothrow_t, Executor e,
typename constraint<
conditional<
!is_same<Executor, any_completion_executor>::value
&& !is_base_of<execution::detail::any_executor_base,
Executor>::value,
execution::detail::is_valid_target_executor<
Executor, supportable_properties_type>,
false_type
>::type::value
>::type = 0) BOOST_ASIO_NOEXCEPT
: base_type(std::nothrow, BOOST_ASIO_MOVE_CAST(Executor)(e))
{
}
#endif // defined(GENERATING_DOCUMENTATION)
/// Assignment operator.
BOOST_ASIO_DECL any_completion_executor& operator=(
const any_completion_executor& e) BOOST_ASIO_NOEXCEPT;
#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Move assignment operator.
BOOST_ASIO_DECL any_completion_executor& operator=(
any_completion_executor&& e) BOOST_ASIO_NOEXCEPT;
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Assignment operator that sets the polymorphic wrapper to the empty state.
BOOST_ASIO_DECL any_completion_executor& operator=(nullptr_t);
/// Destructor.
BOOST_ASIO_DECL ~any_completion_executor();
/// Swap targets with another polymorphic wrapper.
BOOST_ASIO_DECL void swap(any_completion_executor& other) BOOST_ASIO_NOEXCEPT;
/// Obtain a polymorphic wrapper with the specified property.
/**
* Do not call this function directly. It is intended for use with the
* boost::asio::require and boost::asio::prefer customisation points.
*
* For example:
* @code any_completion_executor ex = ...;
* auto ex2 = boost::asio::require(ex, execution::relationship.fork); @endcode
*/
template <typename Property>
any_completion_executor require(const Property& p,
typename constraint<
traits::require_member<const base_type&, const Property&>::is_valid
>::type = 0) const
{
return static_cast<const base_type&>(*this).require(p);
}
/// Obtain a polymorphic wrapper with the specified property.
/**
* Do not call this function directly. It is intended for use with the
* boost::asio::prefer customisation point.
*
* For example:
* @code any_completion_executor ex = ...;
* auto ex2 = boost::asio::prefer(ex, execution::relationship.fork); @endcode
*/
template <typename Property>
any_completion_executor prefer(const Property& p,
typename constraint<
traits::prefer_member<const base_type&, const Property&>::is_valid
>::type = 0) const
{
return static_cast<const base_type&>(*this).prefer(p);
}
};
#if !defined(GENERATING_DOCUMENTATION)
template <>
BOOST_ASIO_DECL any_completion_executor any_completion_executor::prefer(
const execution::outstanding_work_t::tracked_t&, int) const;
template <>
BOOST_ASIO_DECL any_completion_executor any_completion_executor::prefer(
const execution::outstanding_work_t::untracked_t&, int) const;
template <>
BOOST_ASIO_DECL any_completion_executor any_completion_executor::prefer(
const execution::relationship_t::fork_t&, int) const;
template <>
BOOST_ASIO_DECL any_completion_executor any_completion_executor::prefer(
const execution::relationship_t::continuation_t&, int) const;
namespace traits {
#if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)
template <>
struct equality_comparable<any_completion_executor>
{
static const bool is_valid = true;
static const bool is_noexcept = true;
};
#endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)
#if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT)
template <typename F>
struct execute_member<any_completion_executor, F>
{
static const bool is_valid = true;
static const bool is_noexcept = false;
typedef void result_type;
};
#endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT)
#if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
template <typename Prop>
struct query_member<any_completion_executor, Prop> :
query_member<any_completion_executor::base_type, Prop>
{
};
#endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
#if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT)
template <typename Prop>
struct require_member<any_completion_executor, Prop> :
require_member<any_completion_executor::base_type, Prop>
{
typedef any_completion_executor result_type;
};
#endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT)
#if !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT)
template <typename Prop>
struct prefer_member<any_completion_executor, Prop> :
prefer_member<any_completion_executor::base_type, Prop>
{
typedef any_completion_executor result_type;
};
#endif // !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT)
} // namespace traits
#endif // !defined(GENERATING_DOCUMENTATION)
#endif // defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
} // namespace asio
} // namespace boost
#include <boost/asio/detail/pop_options.hpp>
#if defined(BOOST_ASIO_HEADER_ONLY) \
&& !defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
# include <boost/asio/impl/any_completion_executor.ipp>
#endif // defined(BOOST_ASIO_HEADER_ONLY)
// && !defined(BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
#endif // BOOST_ASIO_ANY_COMPLETION_EXECUTOR_HPP

View File

@ -0,0 +1,764 @@
//
// any_completion_handler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2023 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)
//
#ifndef BOOST_ASIO_ANY_COMPLETION_HANDLER_HPP
#define BOOST_ASIO_ANY_COMPLETION_HANDLER_HPP
#include <boost/asio/detail/config.hpp>
#if (defined(BOOST_ASIO_HAS_STD_TUPLE) \
&& defined(BOOST_ASIO_HAS_MOVE) \
&& defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)) \
|| defined(GENERATING_DOCUMENTATION)
#include <cstring>
#include <functional>
#include <memory>
#include <utility>
#include <boost/asio/any_completion_executor.hpp>
#include <boost/asio/associated_allocator.hpp>
#include <boost/asio/associated_cancellation_slot.hpp>
#include <boost/asio/associated_executor.hpp>
#include <boost/asio/cancellation_state.hpp>
#include <boost/asio/recycling_allocator.hpp>
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
namespace detail {
class any_completion_handler_impl_base
{
public:
template <typename S>
explicit any_completion_handler_impl_base(S&& slot)
: cancel_state_(BOOST_ASIO_MOVE_CAST(S)(slot), enable_total_cancellation())
{
}
cancellation_slot get_cancellation_slot() const BOOST_ASIO_NOEXCEPT
{
return cancel_state_.slot();
}
private:
cancellation_state cancel_state_;
};
template <typename Handler>
class any_completion_handler_impl :
public any_completion_handler_impl_base
{
public:
template <typename S, typename H>
any_completion_handler_impl(S&& slot, H&& h)
: any_completion_handler_impl_base(BOOST_ASIO_MOVE_CAST(S)(slot)),
handler_(BOOST_ASIO_MOVE_CAST(H)(h))
{
}
struct uninit_deleter
{
typename std::allocator_traits<
associated_allocator_t<Handler,
boost::asio::recycling_allocator<void>>>::template
rebind_alloc<any_completion_handler_impl> alloc;
void operator()(any_completion_handler_impl* ptr)
{
std::allocator_traits<decltype(alloc)>::deallocate(alloc, ptr, 1);
}
};
struct deleter
{
typename std::allocator_traits<
associated_allocator_t<Handler,
boost::asio::recycling_allocator<void>>>::template
rebind_alloc<any_completion_handler_impl> alloc;
void operator()(any_completion_handler_impl* ptr)
{
std::allocator_traits<decltype(alloc)>::destroy(alloc, ptr);
std::allocator_traits<decltype(alloc)>::deallocate(alloc, ptr, 1);
}
};
template <typename S, typename H>
static any_completion_handler_impl* create(S&& slot, H&& h)
{
uninit_deleter d{
(get_associated_allocator)(h,
boost::asio::recycling_allocator<void>())};
std::unique_ptr<any_completion_handler_impl, uninit_deleter> uninit_ptr(
std::allocator_traits<decltype(d.alloc)>::allocate(d.alloc, 1), d);
any_completion_handler_impl* ptr =
new (uninit_ptr.get()) any_completion_handler_impl(
BOOST_ASIO_MOVE_CAST(S)(slot), BOOST_ASIO_MOVE_CAST(H)(h));
uninit_ptr.release();
return ptr;
}
void destroy()
{
deleter d{
(get_associated_allocator)(handler_,
boost::asio::recycling_allocator<void>())};
d(this);
}
any_completion_executor executor(
const any_completion_executor& candidate) const BOOST_ASIO_NOEXCEPT
{
return any_completion_executor(std::nothrow,
(get_associated_executor)(handler_, candidate));
}
void* allocate(std::size_t size, std::size_t align) const
{
typename std::allocator_traits<
associated_allocator_t<Handler,
boost::asio::recycling_allocator<void>>>::template
rebind_alloc<unsigned char> alloc(
(get_associated_allocator)(handler_,
boost::asio::recycling_allocator<void>()));
std::size_t space = size + align - 1;
unsigned char* base =
std::allocator_traits<decltype(alloc)>::allocate(
alloc, space + sizeof(std::ptrdiff_t));
void* p = base;
if (detail::align(align, size, p, space))
{
std::ptrdiff_t off = static_cast<unsigned char*>(p) - base;
std::memcpy(static_cast<unsigned char*>(p) + size, &off, sizeof(off));
return p;
}
std::bad_alloc ex;
boost::asio::detail::throw_exception(ex);
return nullptr;
}
void deallocate(void* p, std::size_t size, std::size_t align) const
{
if (p)
{
typename std::allocator_traits<
associated_allocator_t<Handler,
boost::asio::recycling_allocator<void>>>::template
rebind_alloc<unsigned char> alloc(
(get_associated_allocator)(handler_,
boost::asio::recycling_allocator<void>()));
std::ptrdiff_t off;
std::memcpy(&off, static_cast<unsigned char*>(p) + size, sizeof(off));
unsigned char* base = static_cast<unsigned char*>(p) - off;
std::allocator_traits<decltype(alloc)>::deallocate(
alloc, base, size + align -1 + sizeof(std::ptrdiff_t));
}
}
template <typename... Args>
void call(Args&&... args)
{
deleter d{
(get_associated_allocator)(handler_,
boost::asio::recycling_allocator<void>())};
std::unique_ptr<any_completion_handler_impl, deleter> ptr(this, d);
Handler handler(BOOST_ASIO_MOVE_CAST(Handler)(handler_));
ptr.reset();
BOOST_ASIO_MOVE_CAST(Handler)(handler)(
BOOST_ASIO_MOVE_CAST(Args)(args)...);
}
private:
Handler handler_;
};
template <typename Signature>
class any_completion_handler_call_fn;
template <typename R, typename... Args>
class any_completion_handler_call_fn<R(Args...)>
{
public:
using type = void(*)(any_completion_handler_impl_base*, Args...);
constexpr any_completion_handler_call_fn(type fn)
: call_fn_(fn)
{
}
void call(any_completion_handler_impl_base* impl, Args... args) const
{
call_fn_(impl, BOOST_ASIO_MOVE_CAST(Args)(args)...);
}
template <typename Handler>
static void impl(any_completion_handler_impl_base* impl, Args... args)
{
static_cast<any_completion_handler_impl<Handler>*>(impl)->call(
BOOST_ASIO_MOVE_CAST(Args)(args)...);
}
private:
type call_fn_;
};
template <typename... Signatures>
class any_completion_handler_call_fns;
template <typename Signature>
class any_completion_handler_call_fns<Signature> :
public any_completion_handler_call_fn<Signature>
{
public:
using any_completion_handler_call_fn<
Signature>::any_completion_handler_call_fn;
using any_completion_handler_call_fn<Signature>::call;
};
template <typename Signature, typename... Signatures>
class any_completion_handler_call_fns<Signature, Signatures...> :
public any_completion_handler_call_fn<Signature>,
public any_completion_handler_call_fns<Signatures...>
{
public:
template <typename CallFn, typename... CallFns>
constexpr any_completion_handler_call_fns(CallFn fn, CallFns... fns)
: any_completion_handler_call_fn<Signature>(fn),
any_completion_handler_call_fns<Signatures...>(fns...)
{
}
using any_completion_handler_call_fn<Signature>::call;
using any_completion_handler_call_fns<Signatures...>::call;
};
class any_completion_handler_destroy_fn
{
public:
using type = void(*)(any_completion_handler_impl_base*);
constexpr any_completion_handler_destroy_fn(type fn)
: destroy_fn_(fn)
{
}
void destroy(any_completion_handler_impl_base* impl) const
{
destroy_fn_(impl);
}
template <typename Handler>
static void impl(any_completion_handler_impl_base* impl)
{
static_cast<any_completion_handler_impl<Handler>*>(impl)->destroy();
}
private:
type destroy_fn_;
};
class any_completion_handler_executor_fn
{
public:
using type = any_completion_executor(*)(
any_completion_handler_impl_base*, const any_completion_executor&);
constexpr any_completion_handler_executor_fn(type fn)
: executor_fn_(fn)
{
}
any_completion_executor executor(any_completion_handler_impl_base* impl,
const any_completion_executor& candidate) const
{
return executor_fn_(impl, candidate);
}
template <typename Handler>
static any_completion_executor impl(any_completion_handler_impl_base* impl,
const any_completion_executor& candidate)
{
return static_cast<any_completion_handler_impl<Handler>*>(impl)->executor(
candidate);
}
private:
type executor_fn_;
};
class any_completion_handler_allocate_fn
{
public:
using type = void*(*)(any_completion_handler_impl_base*,
std::size_t, std::size_t);
constexpr any_completion_handler_allocate_fn(type fn)
: allocate_fn_(fn)
{
}
void* allocate(any_completion_handler_impl_base* impl,
std::size_t size, std::size_t align) const
{
return allocate_fn_(impl, size, align);
}
template <typename Handler>
static void* impl(any_completion_handler_impl_base* impl,
std::size_t size, std::size_t align)
{
return static_cast<any_completion_handler_impl<Handler>*>(impl)->allocate(
size, align);
}
private:
type allocate_fn_;
};
class any_completion_handler_deallocate_fn
{
public:
using type = void(*)(any_completion_handler_impl_base*,
void*, std::size_t, std::size_t);
constexpr any_completion_handler_deallocate_fn(type fn)
: deallocate_fn_(fn)
{
}
void deallocate(any_completion_handler_impl_base* impl,
void* p, std::size_t size, std::size_t align) const
{
deallocate_fn_(impl, p, size, align);
}
template <typename Handler>
static void impl(any_completion_handler_impl_base* impl,
void* p, std::size_t size, std::size_t align)
{
static_cast<any_completion_handler_impl<Handler>*>(impl)->deallocate(
p, size, align);
}
private:
type deallocate_fn_;
};
template <typename... Signatures>
class any_completion_handler_fn_table
: private any_completion_handler_destroy_fn,
private any_completion_handler_executor_fn,
private any_completion_handler_allocate_fn,
private any_completion_handler_deallocate_fn,
private any_completion_handler_call_fns<Signatures...>
{
public:
template <typename... CallFns>
constexpr any_completion_handler_fn_table(
any_completion_handler_destroy_fn::type destroy_fn,
any_completion_handler_executor_fn::type executor_fn,
any_completion_handler_allocate_fn::type allocate_fn,
any_completion_handler_deallocate_fn::type deallocate_fn,
CallFns... call_fns)
: any_completion_handler_destroy_fn(destroy_fn),
any_completion_handler_executor_fn(executor_fn),
any_completion_handler_allocate_fn(allocate_fn),
any_completion_handler_deallocate_fn(deallocate_fn),
any_completion_handler_call_fns<Signatures...>(call_fns...)
{
}
using any_completion_handler_destroy_fn::destroy;
using any_completion_handler_executor_fn::executor;
using any_completion_handler_allocate_fn::allocate;
using any_completion_handler_deallocate_fn::deallocate;
using any_completion_handler_call_fns<Signatures...>::call;
};
template <typename Handler, typename... Signatures>
struct any_completion_handler_fn_table_instance
{
static constexpr any_completion_handler_fn_table<Signatures...>
value = any_completion_handler_fn_table<Signatures...>(
&any_completion_handler_destroy_fn::impl<Handler>,
&any_completion_handler_executor_fn::impl<Handler>,
&any_completion_handler_allocate_fn::impl<Handler>,
&any_completion_handler_deallocate_fn::impl<Handler>,
&any_completion_handler_call_fn<Signatures>::template impl<Handler>...);
};
template <typename Handler, typename... Signatures>
constexpr any_completion_handler_fn_table<Signatures...>
any_completion_handler_fn_table_instance<Handler, Signatures...>::value;
} // namespace detail
template <typename... Signatures>
class any_completion_handler;
/// An allocator type that forwards memory allocation operations through an
/// instance of @c any_completion_handler.
template <typename T, typename... Signatures>
class any_completion_handler_allocator
{
private:
template <typename...>
friend class any_completion_handler;
template <typename, typename...>
friend class any_completion_handler_allocator;
const detail::any_completion_handler_fn_table<Signatures...>* fn_table_;
detail::any_completion_handler_impl_base* impl_;
constexpr any_completion_handler_allocator(int,
const any_completion_handler<Signatures...>& h) BOOST_ASIO_NOEXCEPT
: fn_table_(h.fn_table_),
impl_(h.impl_)
{
}
public:
/// The type of objects that may be allocated by the allocator.
typedef T value_type;
/// Rebinds an allocator to another value type.
template <typename U>
struct rebind
{
/// Specifies the type of the rebound allocator.
typedef any_completion_handler_allocator<U, Signatures...> other;
};
/// Construct from another @c any_completion_handler_allocator.
template <typename U>
constexpr any_completion_handler_allocator(
const any_completion_handler_allocator<U, Signatures...>& a)
BOOST_ASIO_NOEXCEPT
: fn_table_(a.fn_table_),
impl_(a.impl_)
{
}
/// Equality operator.
constexpr bool operator==(
const any_completion_handler_allocator& other) const BOOST_ASIO_NOEXCEPT
{
return fn_table_ == other.fn_table_ && impl_ == other.impl_;
}
/// Inequality operator.
constexpr bool operator!=(
const any_completion_handler_allocator& other) const BOOST_ASIO_NOEXCEPT
{
return fn_table_ != other.fn_table_ || impl_ != other.impl_;
}
/// Allocate space for @c n objects of the allocator's value type.
T* allocate(std::size_t n) const
{
return static_cast<T*>(
fn_table_->allocate(
impl_, sizeof(T) * n, alignof(T)));
}
/// Deallocate space for @c n objects of the allocator's value type.
void deallocate(T* p, std::size_t n) const
{
fn_table_->deallocate(impl_, p, sizeof(T) * n, alignof(T));
}
};
/// A protoco-allocator type that may be rebound to obtain an allocator that
/// forwards memory allocation operations through an instance of
/// @c any_completion_handler.
template <typename... Signatures>
class any_completion_handler_allocator<void, Signatures...>
{
private:
template <typename...>
friend class any_completion_handler;
template <typename, typename...>
friend class any_completion_handler_allocator;
const detail::any_completion_handler_fn_table<Signatures...>* fn_table_;
detail::any_completion_handler_impl_base* impl_;
constexpr any_completion_handler_allocator(int,
const any_completion_handler<Signatures...>& h) BOOST_ASIO_NOEXCEPT
: fn_table_(h.fn_table_),
impl_(h.impl_)
{
}
public:
/// @c void as no objects can be allocated through a proto-allocator.
typedef void value_type;
/// Rebinds an allocator to another value type.
template <typename U>
struct rebind
{
/// Specifies the type of the rebound allocator.
typedef any_completion_handler_allocator<U, Signatures...> other;
};
/// Construct from another @c any_completion_handler_allocator.
template <typename U>
constexpr any_completion_handler_allocator(
const any_completion_handler_allocator<U, Signatures...>& a)
BOOST_ASIO_NOEXCEPT
: fn_table_(a.fn_table_),
impl_(a.impl_)
{
}
/// Equality operator.
constexpr bool operator==(
const any_completion_handler_allocator& other) const BOOST_ASIO_NOEXCEPT
{
return fn_table_ == other.fn_table_ && impl_ == other.impl_;
}
/// Inequality operator.
constexpr bool operator!=(
const any_completion_handler_allocator& other) const BOOST_ASIO_NOEXCEPT
{
return fn_table_ != other.fn_table_ || impl_ != other.impl_;
}
};
/// Polymorphic wrapper for completion handlers.
/**
* The @c any_completion_handler class template is a polymorphic wrapper for
* completion handlers that propagates the associated executor, associated
* allocator, and associated cancellation slot through a type-erasing interface.
*
* When using @c any_completion_handler, specify one or more completion
* signatures as template parameters. These will dictate the arguments that may
* be passed to the handler through the polymorphic interface.
*
* Typical uses for @c any_completion_handler include:
*
* @li Separate compilation of asynchronous operation implementations.
*
* @li Enabling interoperability between asynchronous operations and virtual
* functions.
*/
template <typename... Signatures>
class any_completion_handler
{
#if !defined(GENERATING_DOCUMENTATION)
private:
template <typename, typename...>
friend class any_completion_handler_allocator;
template <typename, typename>
friend struct associated_executor;
const detail::any_completion_handler_fn_table<Signatures...>* fn_table_;
detail::any_completion_handler_impl_base* impl_;
#endif // !defined(GENERATING_DOCUMENTATION)
public:
/// The associated allocator type.
using allocator_type = any_completion_handler_allocator<void, Signatures...>;
/// The associated cancellation slot type.
using cancellation_slot_type = cancellation_slot;
/// Construct an @c any_completion_handler in an empty state, without a target
/// object.
constexpr any_completion_handler()
: fn_table_(nullptr),
impl_(nullptr)
{
}
/// Construct an @c any_completion_handler in an empty state, without a target
/// object.
constexpr any_completion_handler(nullptr_t)
: fn_table_(nullptr),
impl_(nullptr)
{
}
/// Construct an @c any_completion_handler to contain the specified target.
template <typename H, typename Handler = typename decay<H>::type>
any_completion_handler(H&& h,
typename constraint<
!is_same<typename decay<H>::type, any_completion_handler>::value
>::type = 0)
: fn_table_(
&detail::any_completion_handler_fn_table_instance<
Handler, Signatures...>::value),
impl_(detail::any_completion_handler_impl<Handler>::create(
(get_associated_cancellation_slot)(h), BOOST_ASIO_MOVE_CAST(H)(h)))
{
}
/// Move-construct an @c any_completion_handler from another.
/**
* After the operation, the moved-from object @c other has no target.
*/
any_completion_handler(any_completion_handler&& other) BOOST_ASIO_NOEXCEPT
: fn_table_(other.fn_table_),
impl_(other.impl_)
{
other.fn_table_ = nullptr;
other.impl_ = nullptr;
}
/// Move-assign an @c any_completion_handler from another.
/**
* After the operation, the moved-from object @c other has no target.
*/
any_completion_handler& operator=(
any_completion_handler&& other) BOOST_ASIO_NOEXCEPT
{
any_completion_handler(
BOOST_ASIO_MOVE_CAST(any_completion_handler)(other)).swap(*this);
return *this;
}
/// Assignment operator that sets the polymorphic wrapper to the empty state.
any_completion_handler& operator=(nullptr_t) BOOST_ASIO_NOEXCEPT
{
any_completion_handler().swap(*this);
return *this;
}
/// Destructor.
~any_completion_handler()
{
if (impl_)
fn_table_->destroy(impl_);
}
/// Test if the polymorphic wrapper is empty.
constexpr explicit operator bool() const BOOST_ASIO_NOEXCEPT
{
return impl_ != nullptr;
}
/// Test if the polymorphic wrapper is non-empty.
constexpr bool operator!() const BOOST_ASIO_NOEXCEPT
{
return impl_ == nullptr;
}
/// Swap the content of an @c any_completion_handler with another.
void swap(any_completion_handler& other) BOOST_ASIO_NOEXCEPT
{
std::swap(fn_table_, other.fn_table_);
std::swap(impl_, other.impl_);
}
/// Get the associated allocator.
allocator_type get_allocator() const BOOST_ASIO_NOEXCEPT
{
return allocator_type(0, *this);
}
/// Get the associated cancellation slot.
cancellation_slot_type get_cancellation_slot() const BOOST_ASIO_NOEXCEPT
{
return impl_->get_cancellation_slot();
}
/// Function call operator.
/**
* Invokes target completion handler with the supplied arguments.
*
* This function may only be called once, as the target handler is moved from.
* The polymorphic wrapper is left in an empty state.
*
* Throws @c std::bad_function_call if the polymorphic wrapper is empty.
*/
template <typename... Args>
auto operator()(Args&&... args)
-> decltype(fn_table_->call(impl_, BOOST_ASIO_MOVE_CAST(Args)(args)...))
{
if (detail::any_completion_handler_impl_base* impl = impl_)
{
impl_ = nullptr;
return fn_table_->call(impl, BOOST_ASIO_MOVE_CAST(Args)(args)...);
}
std::bad_function_call ex;
boost::asio::detail::throw_exception(ex);
}
/// Equality operator.
friend constexpr bool operator==(
const any_completion_handler& a, nullptr_t) BOOST_ASIO_NOEXCEPT
{
return a.impl_ == nullptr;
}
/// Equality operator.
friend constexpr bool operator==(
nullptr_t, const any_completion_handler& b) BOOST_ASIO_NOEXCEPT
{
return nullptr == b.impl_;
}
/// Inequality operator.
friend constexpr bool operator!=(
const any_completion_handler& a, nullptr_t) BOOST_ASIO_NOEXCEPT
{
return a.impl_ != nullptr;
}
/// Inequality operator.
friend constexpr bool operator!=(
nullptr_t, const any_completion_handler& b) BOOST_ASIO_NOEXCEPT
{
return nullptr != b.impl_;
}
};
template <typename... Signatures, typename Candidate>
struct associated_executor<any_completion_handler<Signatures...>, Candidate>
{
using type = any_completion_executor;
static type get(const any_completion_handler<Signatures...>& handler,
const Candidate& candidate = Candidate()) BOOST_ASIO_NOEXCEPT
{
return handler.fn_table_->executor(handler.impl_,
any_completion_executor(std::nothrow, candidate));
}
};
} // namespace asio
} // namespace boost
#include <boost/asio/detail/pop_options.hpp>
#endif // (defined(BOOST_ASIO_HAS_STD_TUPLE)
// && defined(BOOST_ASIO_HAS_MOVE)
// && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES))
// || defined(GENERATING_DOCUMENTATION)
#endif // BOOST_ASIO_ANY_COMPLETION_HANDLER_HPP

View File

@ -2,7 +2,7 @@
// any_io_executor.hpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -124,6 +124,40 @@ public:
}
#endif // defined(GENERATING_DOCUMENTATION)
/// Construct to point to the same target as another any_executor.
#if defined(GENERATING_DOCUMENTATION)
template <class... OtherSupportableProperties>
any_io_executor(std::nothrow_t,
execution::any_executor<OtherSupportableProperties...> e);
#else // defined(GENERATING_DOCUMENTATION)
template <typename OtherAnyExecutor>
any_io_executor(std::nothrow_t, OtherAnyExecutor e,
typename constraint<
conditional<
!is_same<OtherAnyExecutor, any_io_executor>::value
&& is_base_of<execution::detail::any_executor_base,
OtherAnyExecutor>::value,
typename execution::detail::supportable_properties<
0, supportable_properties_type>::template
is_valid_target<OtherAnyExecutor>,
false_type
>::type::value
>::type = 0) BOOST_ASIO_NOEXCEPT
: base_type(std::nothrow, BOOST_ASIO_MOVE_CAST(OtherAnyExecutor)(e))
{
}
#endif // defined(GENERATING_DOCUMENTATION)
/// Construct to point to the same target as another any_executor.
BOOST_ASIO_DECL any_io_executor(std::nothrow_t,
const any_io_executor& e) BOOST_ASIO_NOEXCEPT;
#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Construct to point to the same target as another any_executor.
BOOST_ASIO_DECL any_io_executor(std::nothrow_t,
any_io_executor&& e) BOOST_ASIO_NOEXCEPT;
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Construct a polymorphic wrapper for the specified executor.
#if defined(GENERATING_DOCUMENTATION)
template <BOOST_ASIO_EXECUTION_EXECUTOR Executor>
@ -146,6 +180,28 @@ public:
}
#endif // defined(GENERATING_DOCUMENTATION)
/// Construct a polymorphic wrapper for the specified executor.
#if defined(GENERATING_DOCUMENTATION)
template <BOOST_ASIO_EXECUTION_EXECUTOR Executor>
any_io_executor(std::nothrow_t, Executor e);
#else // defined(GENERATING_DOCUMENTATION)
template <BOOST_ASIO_EXECUTION_EXECUTOR Executor>
any_io_executor(std::nothrow_t, Executor e,
typename constraint<
conditional<
!is_same<Executor, any_io_executor>::value
&& !is_base_of<execution::detail::any_executor_base,
Executor>::value,
execution::detail::is_valid_target_executor<
Executor, supportable_properties_type>,
false_type
>::type::value
>::type = 0) BOOST_ASIO_NOEXCEPT
: base_type(std::nothrow, BOOST_ASIO_MOVE_CAST(Executor)(e))
{
}
#endif // defined(GENERATING_DOCUMENTATION)
/// Assignment operator.
BOOST_ASIO_DECL any_io_executor& operator=(
const any_io_executor& e) BOOST_ASIO_NOEXCEPT;

View File

@ -2,7 +2,7 @@
// append.hpp
// ~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// as_tuple.hpp
// ~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// associated_allocator.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -43,37 +43,53 @@ struct has_allocator_type<T,
{
};
template <typename T, typename E, typename = void, typename = void>
template <typename T, typename A, typename = void, typename = void>
struct associated_allocator_impl
{
typedef E type;
typedef void asio_associated_allocator_is_unspecialised;
static type get(const T&, const E& e) BOOST_ASIO_NOEXCEPT
typedef A type;
static type get(const T&) BOOST_ASIO_NOEXCEPT
{
return e;
return type();
}
static const type& get(const T&, const A& a) BOOST_ASIO_NOEXCEPT
{
return a;
}
};
template <typename T, typename E>
struct associated_allocator_impl<T, E,
template <typename T, typename A>
struct associated_allocator_impl<T, A,
typename void_type<typename T::allocator_type>::type>
{
typedef typename T::allocator_type type;
static type get(const T& t, const E&) BOOST_ASIO_NOEXCEPT
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
const T& t) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_allocator()))
{
return t.get_allocator();
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
const T& t, const A&) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_allocator()))
{
return t.get_allocator();
}
};
template <typename T, typename E>
struct associated_allocator_impl<T, E,
template <typename T, typename A>
struct associated_allocator_impl<T, A,
typename enable_if<
!has_allocator_type<T>::value
>::type,
typename void_type<
typename associator<associated_allocator, T, E>::type
>::type> : associator<associated_allocator, T, E>
typename associator<associated_allocator, T, A>::type
>::type> : associator<associated_allocator, T, A>
{
};
@ -93,29 +109,32 @@ struct associated_allocator_impl<T, E,
* Allocator requirements.
*
* @li Provide a noexcept static member function named @c get, callable as @c
* get(t) and with return type @c type.
* get(t) and with return type @c type or a (possibly const) reference to @c
* type.
*
* @li Provide a noexcept static member function named @c get, callable as @c
* get(t,a) and with return type @c type.
* get(t,a) and with return type @c type or a (possibly const) reference to @c
* type.
*/
template <typename T, typename Allocator = std::allocator<void> >
struct associated_allocator
#if !defined(GENERATING_DOCUMENTATION)
: detail::associated_allocator_impl<T, Allocator>
#endif // !defined(GENERATING_DOCUMENTATION)
{
#if defined(GENERATING_DOCUMENTATION)
/// If @c T has a nested type @c allocator_type, <tt>T::allocator_type</tt>.
/// Otherwise @c Allocator.
#if defined(GENERATING_DOCUMENTATION)
typedef see_below type;
#else // defined(GENERATING_DOCUMENTATION)
typedef typename detail::associated_allocator_impl<T, Allocator>::type type;
#endif // defined(GENERATING_DOCUMENTATION)
/// If @c T has a nested type @c allocator_type, returns
/// <tt>t.get_allocator()</tt>. Otherwise returns @c type().
static decltype(auto) get(const T& t) BOOST_ASIO_NOEXCEPT;
/// If @c T has a nested type @c allocator_type, returns
/// <tt>t.get_allocator()</tt>. Otherwise returns @c a.
static type get(const T& t,
const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT
{
return detail::associated_allocator_impl<T, Allocator>::get(t, a);
}
static decltype(auto) get(const T& t, const Allocator& a) BOOST_ASIO_NOEXCEPT;
#endif // defined(GENERATING_DOCUMENTATION)
};
/// Helper function to obtain an object's associated allocator.
@ -134,8 +153,11 @@ get_associated_allocator(const T& t) BOOST_ASIO_NOEXCEPT
* @returns <tt>associated_allocator<T, Allocator>::get(t, a)</tt>
*/
template <typename T, typename Allocator>
BOOST_ASIO_NODISCARD inline typename associated_allocator<T, Allocator>::type
BOOST_ASIO_NODISCARD inline BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename associated_allocator<T, Allocator>::type)
get_associated_allocator(const T& t, const Allocator& a) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
associated_allocator<T, Allocator>::get(t, a)))
{
return associated_allocator<T, Allocator>::get(t, a);
}
@ -148,12 +170,37 @@ using associated_allocator_t
#endif // defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES)
namespace detail {
template <typename T, typename A, typename = void>
struct associated_allocator_forwarding_base
{
};
template <typename T, typename A>
struct associated_allocator_forwarding_base<T, A,
typename enable_if<
is_same<
typename associated_allocator<T,
A>::asio_associated_allocator_is_unspecialised,
void
>::value
>::type>
{
typedef void asio_associated_allocator_is_unspecialised;
};
} // namespace detail
#if defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER) \
|| defined(GENERATING_DOCUMENTATION)
/// Specialisation of associated_allocator for @c std::reference_wrapper.
template <typename T, typename Allocator>
struct associated_allocator<reference_wrapper<T>, Allocator>
#if !defined(GENERATING_DOCUMENTATION)
: detail::associated_allocator_forwarding_base<T, Allocator>
#endif // !defined(GENERATING_DOCUMENTATION)
{
/// Forwards @c type to the associator specialisation for the unwrapped type
/// @c T.
@ -161,8 +208,17 @@ struct associated_allocator<reference_wrapper<T>, Allocator>
/// Forwards the request to get the allocator to the associator specialisation
/// for the unwrapped type @c T.
static type get(reference_wrapper<T> t,
const Allocator& a = Allocator()) BOOST_ASIO_NOEXCEPT
static type get(reference_wrapper<T> t) BOOST_ASIO_NOEXCEPT
{
return associated_allocator<T, Allocator>::get(t.get());
}
/// Forwards the request to get the allocator to the associator specialisation
/// for the unwrapped type @c T.
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
reference_wrapper<T> t, const Allocator& a) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
associated_allocator<T, Allocator>::get(t.get(), a)))
{
return associated_allocator<T, Allocator>::get(t.get(), a);
}

View File

@ -2,7 +2,7 @@
// associated_cancellation_slot.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -18,6 +18,7 @@
#include <boost/asio/detail/config.hpp>
#include <boost/asio/associator.hpp>
#include <boost/asio/cancellation_signal.hpp>
#include <boost/asio/detail/functional.hpp>
#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/detail/push_options.hpp>
@ -49,7 +50,12 @@ struct associated_cancellation_slot_impl
typedef S type;
static type get(const T&, const S& s = S()) BOOST_ASIO_NOEXCEPT
static type get(const T&) BOOST_ASIO_NOEXCEPT
{
return type();
}
static const type& get(const T&, const S& s) BOOST_ASIO_NOEXCEPT
{
return s;
}
@ -61,7 +67,16 @@ struct associated_cancellation_slot_impl<T, S,
{
typedef typename T::cancellation_slot_type type;
static type get(const T& t, const S& = S()) BOOST_ASIO_NOEXCEPT
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
const T& t) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_cancellation_slot()))
{
return t.get_cancellation_slot();
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
const T& t, const S&) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_cancellation_slot()))
{
return t.get_cancellation_slot();
}
@ -94,10 +109,12 @@ struct associated_cancellation_slot_impl<T, S,
* CancellationSlot requirements.
*
* @li Provide a noexcept static member function named @c get, callable as @c
* get(t) and with return type @c type.
* get(t) and with return type @c type or a (possibly const) reference to @c
* type.
*
* @li Provide a noexcept static member function named @c get, callable as @c
* get(t,s) and with return type @c type.
* get(t,s) and with return type @c type or a (possibly const) reference to @c
* type.
*/
template <typename T, typename CancellationSlot = cancellation_slot>
struct associated_cancellation_slot
@ -111,10 +128,14 @@ struct associated_cancellation_slot
/// @c CancellationSlot.
typedef see_below type;
/// If @c T has a nested type @c cancellation_slot_type, returns
/// <tt>t.get_cancellation_slot()</tt>. Otherwise returns @c type().
static decltype(auto) get(const T& t) BOOST_ASIO_NOEXCEPT;
/// If @c T has a nested type @c cancellation_slot_type, returns
/// <tt>t.get_cancellation_slot()</tt>. Otherwise returns @c s.
static type get(const T& t,
const CancellationSlot& s = CancellationSlot()) BOOST_ASIO_NOEXCEPT;
static decltype(auto) get(const T& t,
const CancellationSlot& s) BOOST_ASIO_NOEXCEPT;
#endif // defined(GENERATING_DOCUMENTATION)
};
@ -135,10 +156,12 @@ get_associated_cancellation_slot(const T& t) BOOST_ASIO_NOEXCEPT
* CancellationSlot>::get(t, st)</tt>
*/
template <typename T, typename CancellationSlot>
BOOST_ASIO_NODISCARD inline
typename associated_cancellation_slot<T, CancellationSlot>::type
BOOST_ASIO_NODISCARD inline BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename associated_cancellation_slot<T, CancellationSlot>::type)
get_associated_cancellation_slot(const T& t,
const CancellationSlot& st) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
associated_cancellation_slot<T, CancellationSlot>::get(t, st)))
{
return associated_cancellation_slot<T, CancellationSlot>::get(t, st);
}
@ -172,6 +195,43 @@ struct associated_cancellation_slot_forwarding_base<T, S,
};
} // namespace detail
#if defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER) \
|| defined(GENERATING_DOCUMENTATION)
/// Specialisation of associated_cancellation_slot for @c
/// std::reference_wrapper.
template <typename T, typename CancellationSlot>
struct associated_cancellation_slot<reference_wrapper<T>, CancellationSlot>
#if !defined(GENERATING_DOCUMENTATION)
: detail::associated_cancellation_slot_forwarding_base<T, CancellationSlot>
#endif // !defined(GENERATING_DOCUMENTATION)
{
/// Forwards @c type to the associator specialisation for the unwrapped type
/// @c T.
typedef typename associated_cancellation_slot<T, CancellationSlot>::type type;
/// Forwards the request to get the cancellation slot to the associator
/// specialisation for the unwrapped type @c T.
static type get(reference_wrapper<T> t) BOOST_ASIO_NOEXCEPT
{
return associated_cancellation_slot<T, CancellationSlot>::get(t.get());
}
/// Forwards the request to get the cancellation slot to the associator
/// specialisation for the unwrapped type @c T.
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(reference_wrapper<T> t,
const CancellationSlot& s) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
associated_cancellation_slot<T, CancellationSlot>::get(t.get(), s)))
{
return associated_cancellation_slot<T, CancellationSlot>::get(t.get(), s);
}
};
#endif // defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER)
// || defined(GENERATING_DOCUMENTATION)
} // namespace asio
} // namespace boost

View File

@ -2,7 +2,7 @@
// associated_executor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -52,7 +52,12 @@ struct associated_executor_impl
typedef E type;
static type get(const T&, const E& e = E()) BOOST_ASIO_NOEXCEPT
static type get(const T&) BOOST_ASIO_NOEXCEPT
{
return type();
}
static const type& get(const T&, const E& e) BOOST_ASIO_NOEXCEPT
{
return e;
}
@ -64,7 +69,16 @@ struct associated_executor_impl<T, E,
{
typedef typename T::executor_type type;
static type get(const T& t, const E& = E()) BOOST_ASIO_NOEXCEPT
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
const T& t) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_executor()))
{
return t.get_executor();
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
const T& t, const E&) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_executor()))
{
return t.get_executor();
}
@ -97,10 +111,12 @@ struct associated_executor_impl<T, E,
* Executor requirements.
*
* @li Provide a noexcept static member function named @c get, callable as @c
* get(t) and with return type @c type.
* get(t) and with return type @c type or a (possibly const) reference to @c
* type.
*
* @li Provide a noexcept static member function named @c get, callable as @c
* get(t,e) and with return type @c type.
* get(t,e) and with return type @c type or a (possibly const) reference to @c
* type.
*/
template <typename T, typename Executor = system_executor>
struct associated_executor
@ -113,10 +129,13 @@ struct associated_executor
/// Otherwise @c Executor.
typedef see_below type;
/// If @c T has a nested type @c executor_type, returns
/// <tt>t.get_executor()</tt>. Otherwise returns @c type().
static decltype(auto) get(const T& t) BOOST_ASIO_NOEXCEPT;
/// If @c T has a nested type @c executor_type, returns
/// <tt>t.get_executor()</tt>. Otherwise returns @c ex.
static type get(const T& t,
const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT;
static decltype(auto) get(const T& t, const Executor& ex) BOOST_ASIO_NOEXCEPT;
#endif // defined(GENERATING_DOCUMENTATION)
};
@ -136,11 +155,14 @@ get_associated_executor(const T& t) BOOST_ASIO_NOEXCEPT
* @returns <tt>associated_executor<T, Executor>::get(t, ex)</tt>
*/
template <typename T, typename Executor>
BOOST_ASIO_NODISCARD inline typename associated_executor<T, Executor>::type
BOOST_ASIO_NODISCARD inline BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename associated_executor<T, Executor>::type)
get_associated_executor(const T& t, const Executor& ex,
typename constraint<
is_executor<Executor>::value || execution::is_executor<Executor>::value
>::type = 0) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
associated_executor<T, Executor>::get(t, ex)))
{
return associated_executor<T, Executor>::get(t, ex);
}
@ -152,7 +174,7 @@ get_associated_executor(const T& t, const Executor& ex,
*/
template <typename T, typename ExecutionContext>
BOOST_ASIO_NODISCARD inline typename associated_executor<T,
typename ExecutionContext::executor_type>::type
typename ExecutionContext::executor_type>::type
get_associated_executor(const T& t, ExecutionContext& ctx,
typename constraint<is_convertible<ExecutionContext&,
execution_context&>::value>::type = 0) BOOST_ASIO_NOEXCEPT
@ -206,8 +228,17 @@ struct associated_executor<reference_wrapper<T>, Executor>
/// Forwards the request to get the executor to the associator specialisation
/// for the unwrapped type @c T.
static type get(reference_wrapper<T> t,
const Executor& ex = Executor()) BOOST_ASIO_NOEXCEPT
static type get(reference_wrapper<T> t) BOOST_ASIO_NOEXCEPT
{
return associated_executor<T, Executor>::get(t.get());
}
/// Forwards the request to get the executor to the associator specialisation
/// for the unwrapped type @c T.
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
reference_wrapper<T> t, const Executor& ex) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
associated_executor<T, Executor>::get(t.get(), ex)))
{
return associated_executor<T, Executor>::get(t.get(), ex);
}

View File

@ -0,0 +1,299 @@
//
// associated_immediate_executor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2023 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)
//
#ifndef BOOST_ASIO_ASSOCIATED_IMMEDIATE_EXECUTOR_HPP
#define BOOST_ASIO_ASSOCIATED_IMMEDIATE_EXECUTOR_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <boost/asio/detail/config.hpp>
#include <boost/asio/associator.hpp>
#include <boost/asio/detail/functional.hpp>
#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/execution/blocking.hpp>
#include <boost/asio/execution/executor.hpp>
#include <boost/asio/execution_context.hpp>
#include <boost/asio/is_executor.hpp>
#include <boost/asio/require.hpp>
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
template <typename T, typename Executor>
struct associated_immediate_executor;
namespace detail {
template <typename T, typename = void>
struct has_immediate_executor_type : false_type
{
};
template <typename T>
struct has_immediate_executor_type<T,
typename void_type<typename T::immediate_executor_type>::type>
: true_type
{
};
template <typename E, typename = void, typename = void>
struct default_immediate_executor
{
typedef typename require_result<E, execution::blocking_t::never_t>::type type;
static type get(const E& e) BOOST_ASIO_NOEXCEPT
{
return boost::asio::require(e, execution::blocking.never);
}
};
template <typename E>
struct default_immediate_executor<E,
typename enable_if<
!execution::is_executor<E>::value
>::type,
typename enable_if<
is_executor<E>::value
>::type>
{
class type : public E
{
public:
template <typename Executor1>
explicit type(const Executor1& e,
typename constraint<
conditional<
!is_same<Executor1, type>::value,
is_convertible<Executor1, E>,
false_type
>::type::value
>::type = 0) BOOST_ASIO_NOEXCEPT
: E(e)
{
}
type(const type& other) BOOST_ASIO_NOEXCEPT
: E(static_cast<const E&>(other))
{
}
#if defined(BOOST_ASIO_HAS_MOVE)
type(type&& other) BOOST_ASIO_NOEXCEPT
: E(BOOST_ASIO_MOVE_CAST(E)(other))
{
}
#endif // defined(BOOST_ASIO_HAS_MOVE)
template <typename Function, typename Allocator>
void dispatch(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const
{
this->post(BOOST_ASIO_MOVE_CAST(Function)(f), a);
}
friend bool operator==(const type& a, const type& b) BOOST_ASIO_NOEXCEPT
{
return static_cast<const E&>(a) == static_cast<const E&>(b);
}
friend bool operator!=(const type& a, const type& b) BOOST_ASIO_NOEXCEPT
{
return static_cast<const E&>(a) != static_cast<const E&>(b);
}
};
static type get(const E& e) BOOST_ASIO_NOEXCEPT
{
return type(e);
}
};
template <typename T, typename E, typename = void, typename = void>
struct associated_immediate_executor_impl
{
typedef void asio_associated_immediate_executor_is_unspecialised;
typedef typename default_immediate_executor<E>::type type;
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
const T&, const E& e) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((default_immediate_executor<E>::get(e)))
{
return default_immediate_executor<E>::get(e);
}
};
template <typename T, typename E>
struct associated_immediate_executor_impl<T, E,
typename void_type<typename T::immediate_executor_type>::type>
{
typedef typename T::immediate_executor_type type;
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
const T& t, const E&) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_immediate_executor()))
{
return t.get_immediate_executor();
}
};
template <typename T, typename E>
struct associated_immediate_executor_impl<T, E,
typename enable_if<
!has_immediate_executor_type<T>::value
>::type,
typename void_type<
typename associator<associated_immediate_executor, T, E>::type
>::type> : associator<associated_immediate_executor, T, E>
{
};
} // namespace detail
/// Traits type used to obtain the immediate executor associated with an object.
/**
* A program may specialise this traits type if the @c T template parameter in
* the specialisation is a user-defined type. The template parameter @c
* Executor shall be a type meeting the Executor requirements.
*
* Specialisations shall meet the following requirements, where @c t is a const
* reference to an object of type @c T, and @c e is an object of type @c
* Executor.
*
* @li Provide a nested typedef @c type that identifies a type meeting the
* Executor requirements.
*
* @li Provide a noexcept static member function named @c get, callable as @c
* get(t) and with return type @c type or a (possibly const) reference to @c
* type.
*
* @li Provide a noexcept static member function named @c get, callable as @c
* get(t,e) and with return type @c type or a (possibly const) reference to @c
* type.
*/
template <typename T, typename Executor>
struct associated_immediate_executor
#if !defined(GENERATING_DOCUMENTATION)
: detail::associated_immediate_executor_impl<T, Executor>
#endif // !defined(GENERATING_DOCUMENTATION)
{
#if defined(GENERATING_DOCUMENTATION)
/// If @c T has a nested type @c immediate_executor_type,
// <tt>T::immediate_executor_type</tt>. Otherwise @c Executor.
typedef see_below type;
/// If @c T has a nested type @c immediate_executor_type, returns
/// <tt>t.get_immediate_executor()</tt>. Otherwise returns
/// <tt>boost::asio::require(ex, boost::asio::execution::blocking.never)</tt>.
static decltype(auto) get(const T& t, const Executor& ex) BOOST_ASIO_NOEXCEPT;
#endif // defined(GENERATING_DOCUMENTATION)
};
/// Helper function to obtain an object's associated executor.
/**
* @returns <tt>associated_immediate_executor<T, Executor>::get(t, ex)</tt>
*/
template <typename T, typename Executor>
BOOST_ASIO_NODISCARD inline BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename associated_immediate_executor<T, Executor>::type)
get_associated_immediate_executor(const T& t, const Executor& ex,
typename constraint<
is_executor<Executor>::value || execution::is_executor<Executor>::value
>::type = 0) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
associated_immediate_executor<T, Executor>::get(t, ex)))
{
return associated_immediate_executor<T, Executor>::get(t, ex);
}
/// Helper function to obtain an object's associated executor.
/**
* @returns <tt>associated_immediate_executor<T, typename
* ExecutionContext::executor_type>::get(t, ctx.get_executor())</tt>
*/
template <typename T, typename ExecutionContext>
BOOST_ASIO_NODISCARD inline typename associated_immediate_executor<T,
typename ExecutionContext::executor_type>::type
get_associated_immediate_executor(const T& t, ExecutionContext& ctx,
typename constraint<is_convertible<ExecutionContext&,
execution_context&>::value>::type = 0) BOOST_ASIO_NOEXCEPT
{
return associated_immediate_executor<T,
typename ExecutionContext::executor_type>::get(t, ctx.get_executor());
}
#if defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES)
template <typename T, typename Executor>
using associated_immediate_executor_t =
typename associated_immediate_executor<T, Executor>::type;
#endif // defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES)
namespace detail {
template <typename T, typename E, typename = void>
struct associated_immediate_executor_forwarding_base
{
};
template <typename T, typename E>
struct associated_immediate_executor_forwarding_base<T, E,
typename enable_if<
is_same<
typename associated_immediate_executor<T,
E>::asio_associated_immediate_executor_is_unspecialised,
void
>::value
>::type>
{
typedef void asio_associated_immediate_executor_is_unspecialised;
};
} // namespace detail
#if defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER) \
|| defined(GENERATING_DOCUMENTATION)
/// Specialisation of associated_immediate_executor for
/// @c std::reference_wrapper.
template <typename T, typename Executor>
struct associated_immediate_executor<reference_wrapper<T>, Executor>
#if !defined(GENERATING_DOCUMENTATION)
: detail::associated_immediate_executor_forwarding_base<T, Executor>
#endif // !defined(GENERATING_DOCUMENTATION)
{
/// Forwards @c type to the associator specialisation for the unwrapped type
/// @c T.
typedef typename associated_immediate_executor<T, Executor>::type type;
/// Forwards the request to get the executor to the associator specialisation
/// for the unwrapped type @c T.
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
reference_wrapper<T> t, const Executor& ex) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
associated_immediate_executor<T, Executor>::get(t.get(), ex)))
{
return associated_immediate_executor<T, Executor>::get(t.get(), ex);
}
};
#endif // defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER)
// || defined(GENERATING_DOCUMENTATION)
} // namespace asio
} // namespace boost
#include <boost/asio/detail/pop_options.hpp>
#endif // BOOST_ASIO_ASSOCIATED_IMMEDIATE_EXECUTOR_HPP

View File

@ -2,7 +2,7 @@
// associator.hpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// async_result.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -1321,7 +1321,7 @@ class async_result<detail::async_operation_probe, Sig0, Sig1, Sig2>
#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
#endif // !defined(GENERATING_DOCUMENTATION)
#if defined(GENERATION_DOCUMENTATION)
#if defined(GENERATING_DOCUMENTATION)
/// The is_async_operation trait detects whether a type @c T and arguments
/// @c Args... may be used to initiate an asynchronous operation.
@ -1350,7 +1350,10 @@ struct is_async_operation :
template <typename T, typename = void, typename = void, typename = void,
typename = void, typename = void, typename = void, typename = void,
typename = void, typename = void>
struct is_async_operation :
struct is_async_operation;
template <typename T>
struct is_async_operation<T> :
detail::is_async_operation_call<
T(detail::async_operation_probe)>
{
@ -1399,6 +1402,42 @@ namespace detail {
struct completion_signature_probe {};
#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename... T>
struct completion_signature_probe_result
{
template <template <typename...> class Op>
struct apply
{
typedef Op<T...> type;
};
};
template <typename T>
struct completion_signature_probe_result<T>
{
typedef T type;
template <template <typename...> class Op>
struct apply
{
typedef Op<T> type;
};
};
template <>
struct completion_signature_probe_result<void>
{
template <template <typename...> class Op>
struct apply
{
typedef Op<> type;
};
};
#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename T>
struct completion_signature_probe_result
{
@ -1410,6 +1449,8 @@ struct completion_signature_probe_result<void>
{
};
#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
} // namespace detail
#if !defined(GENERATING_DOCUMENTATION)
@ -1419,7 +1460,7 @@ template <typename... Signatures>
class async_result<detail::completion_signature_probe, Signatures...>
{
public:
typedef detail::completion_signature_probe_result<void> return_type;
typedef detail::completion_signature_probe_result<Signatures...> return_type;
template <typename Initiation, typename... InitArgs>
static return_type initiate(BOOST_ASIO_MOVE_ARG(Initiation),
@ -1537,7 +1578,10 @@ using completion_signature_of_t =
template <typename T, typename = void, typename = void, typename = void,
typename = void, typename = void, typename = void, typename = void,
typename = void, typename = void>
struct completion_signature_of :
struct completion_signature_of;
template <typename T>
struct completion_signature_of<T> :
result_of<T(detail::completion_signature_probe)>::type
{
};

View File

@ -2,7 +2,7 @@
// awaitable.hpp
// ~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// basic_datagram_socket.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -1263,7 +1263,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -1297,7 +1297,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -1331,7 +1331,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -1365,7 +1365,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_deadline_timer.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -318,7 +318,7 @@ public:
}
/// Get the executor associated with the object.
executor_type get_executor() BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() BOOST_ASIO_NOEXCEPT
{
return impl_.get_executor();
}
@ -680,7 +680,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_file.hpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -344,7 +344,7 @@ public:
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Get the executor associated with the object.
executor_type get_executor() BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() BOOST_ASIO_NOEXCEPT
{
return impl_.get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_io_object.hpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// basic_random_access_file.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -635,7 +635,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -668,7 +668,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_raw_socket.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -1254,7 +1254,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -1288,7 +1288,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -1322,7 +1322,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -1356,7 +1356,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_readable_pipe.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -264,7 +264,7 @@ public:
}
/// Get the executor associated with the object.
executor_type get_executor() BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() BOOST_ASIO_NOEXCEPT
{
return impl_.get_executor();
}
@ -594,7 +594,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_seq_packet_socket.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -769,7 +769,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -803,7 +803,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_serial_port.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@ -354,7 +354,7 @@ public:
}
/// Get the executor associated with the object.
executor_type get_executor() BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() BOOST_ASIO_NOEXCEPT
{
return impl_.get_executor();
}
@ -928,7 +928,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -961,7 +961,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_signal_set.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -27,6 +27,7 @@
#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/execution_context.hpp>
#include <boost/asio/signal_set_base.hpp>
#include <boost/asio/detail/push_options.hpp>
@ -94,7 +95,7 @@ namespace asio {
* least one thread.
*/
template <typename Executor = any_io_executor>
class basic_signal_set
class basic_signal_set : public signal_set_base
{
private:
class initiate_async_wait;
@ -334,7 +335,7 @@ public:
}
/// Get the executor associated with the object.
executor_type get_executor() BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() BOOST_ASIO_NOEXCEPT
{
return impl_.get_executor();
}
@ -371,6 +372,58 @@ public:
BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
}
/// Add a signal to a signal_set with the specified flags.
/**
* This function adds the specified signal to the set. It has no effect if the
* signal is already in the set.
*
* Flags other than flags::dont_care require OS support for the @c sigaction
* call, and this function will fail with @c error::operation_not_supported if
* this is unavailable.
*
* The specified flags will conflict with a prior, active registration of the
* same signal, if either specified a flags value other than flags::dont_care.
* In this case, the @c add will fail with @c error::invalid_argument.
*
* @param signal_number The signal to be added to the set.
*
* @param f Flags to modify the behaviour of the specified signal.
*
* @throws boost::system::system_error Thrown on failure.
*/
void add(int signal_number, flags_t f)
{
boost::system::error_code ec;
impl_.get_service().add(impl_.get_implementation(), signal_number, f, ec);
boost::asio::detail::throw_error(ec, "add");
}
/// Add a signal to a signal_set with the specified flags.
/**
* This function adds the specified signal to the set. It has no effect if the
* signal is already in the set.
*
* Flags other than flags::dont_care require OS support for the @c sigaction
* call, and this function will fail with @c error::operation_not_supported if
* this is unavailable.
*
* The specified flags will conflict with a prior, active registration of the
* same signal, if either specified a flags value other than flags::dont_care.
* In this case, the @c add will fail with @c error::invalid_argument.
*
* @param signal_number The signal to be added to the set.
*
* @param f Flags to modify the behaviour of the specified signal.
*
* @param ec Set to indicate what error occurred, if any.
*/
BOOST_ASIO_SYNC_OP_VOID add(int signal_number, flags_t f,
boost::system::error_code& ec)
{
impl_.get_service().add(impl_.get_implementation(), signal_number, f, ec);
BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);
}
/// Remove a signal from a signal_set.
/**
* This function removes the specified signal from the set. It has no effect
@ -567,7 +620,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_socket.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -374,7 +374,7 @@ public:
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Get the executor associated with the object.
executor_type get_executor() BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() BOOST_ASIO_NOEXCEPT
{
return impl_.get_executor();
}
@ -1875,7 +1875,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -1918,7 +1918,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_socket_acceptor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -455,7 +455,7 @@ public:
}
/// Get the executor associated with the object.
executor_type get_executor() BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() BOOST_ASIO_NOEXCEPT
{
return impl_.get_executor();
}
@ -1925,8 +1925,10 @@ public:
template <typename Executor1,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
Executor1>::other)) MoveAcceptToken
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
typename constraint<is_executor<Executor1>::value
|| execution::is_executor<Executor1>::value,
Executor1>::type>::other)) MoveAcceptToken
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(MoveAcceptToken,
void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
@ -2487,8 +2489,10 @@ public:
template <typename Executor1,
BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
Executor1>::other)) MoveAcceptToken
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
typename constraint<is_executor<Executor1>::value
|| execution::is_executor<Executor1>::value,
Executor1>::type>::other)) MoveAcceptToken
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(MoveAcceptToken,
void (boost::system::error_code,
typename Protocol::socket::template rebind_executor<
@ -2640,7 +2644,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -2672,7 +2676,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -2706,7 +2710,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_socket_iostream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// basic_socket_streambuf.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// basic_stream_file.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -688,7 +688,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -721,7 +721,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_stream_socket.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -1124,7 +1124,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}
@ -1158,7 +1158,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_streambuf.hpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// basic_streambuf_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// basic_waitable_timer.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -382,7 +382,7 @@ public:
}
/// Get the executor associated with the object.
executor_type get_executor() BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() BOOST_ASIO_NOEXCEPT
{
return impl_.get_executor();
}
@ -799,7 +799,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// basic_writable_pipe.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -264,7 +264,7 @@ public:
}
/// Get the executor associated with the object.
executor_type get_executor() BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() BOOST_ASIO_NOEXCEPT
{
return impl_.get_executor();
}
@ -590,7 +590,7 @@ private:
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT
{
return self_->get_executor();
}

View File

@ -2,7 +2,7 @@
// bind_allocator.hpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -690,11 +690,20 @@ template <template <typename, typename> class Associator,
struct associator<Associator,
allocator_binder<T, Allocator>,
DefaultCandidate>
: Associator<T, DefaultCandidate>
{
typedef typename Associator<T, DefaultCandidate>::type type;
static typename Associator<T, DefaultCandidate>::type
get(const allocator_binder<T, Allocator>& b) BOOST_ASIO_NOEXCEPT
{
return Associator<T, DefaultCandidate>::get(b.get());
}
static type get(const allocator_binder<T, Allocator>& b,
const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<T, DefaultCandidate>::type)
get(const allocator_binder<T, Allocator>& b,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<T, DefaultCandidate>::get(b.get(), c)))
{
return Associator<T, DefaultCandidate>::get(b.get(), c);
}
@ -707,8 +716,10 @@ struct associated_allocator<
{
typedef Allocator type;
static type get(const allocator_binder<T, Allocator>& b,
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
const allocator_binder<T, Allocator>& b,
const Allocator1& = Allocator1()) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((b.get_allocator()))
{
return b.get_allocator();
}

View File

@ -2,7 +2,7 @@
// bind_cancellation_slot.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -692,11 +692,21 @@ template <template <typename, typename> class Associator,
struct associator<Associator,
cancellation_slot_binder<T, CancellationSlot>,
DefaultCandidate>
: Associator<T, DefaultCandidate>
{
typedef typename Associator<T, DefaultCandidate>::type type;
static typename Associator<T, DefaultCandidate>::type
get(const cancellation_slot_binder<T, CancellationSlot>& b)
BOOST_ASIO_NOEXCEPT
{
return Associator<T, DefaultCandidate>::get(b.get());
}
static type get(const cancellation_slot_binder<T, CancellationSlot>& b,
const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<T, DefaultCandidate>::type)
get(const cancellation_slot_binder<T, CancellationSlot>& b,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<T, DefaultCandidate>::get(b.get(), c)))
{
return Associator<T, DefaultCandidate>::get(b.get(), c);
}
@ -709,8 +719,10 @@ struct associated_cancellation_slot<
{
typedef CancellationSlot type;
static type get(const cancellation_slot_binder<T, CancellationSlot>& b,
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
const cancellation_slot_binder<T, CancellationSlot>& b,
const CancellationSlot1& = CancellationSlot1()) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((b.get_cancellation_slot()))
{
return b.get_cancellation_slot();
}

View File

@ -2,7 +2,7 @@
// bind_executor.hpp
// ~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -740,11 +740,20 @@ private:
template <template <typename, typename> class Associator,
typename T, typename Executor, typename DefaultCandidate>
struct associator<Associator, executor_binder<T, Executor>, DefaultCandidate>
: Associator<T, DefaultCandidate>
{
typedef typename Associator<T, DefaultCandidate>::type type;
static typename Associator<T, DefaultCandidate>::type
get(const executor_binder<T, Executor>& b) BOOST_ASIO_NOEXCEPT
{
return Associator<T, DefaultCandidate>::get(b.get());
}
static type get(const executor_binder<T, Executor>& b,
const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<T, DefaultCandidate>::type)
get(const executor_binder<T, Executor>& b,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<T, DefaultCandidate>::get(b.get(), c)))
{
return Associator<T, DefaultCandidate>::get(b.get(), c);
}
@ -755,8 +764,10 @@ struct associated_executor<executor_binder<T, Executor>, Executor1>
{
typedef Executor type;
static type get(const executor_binder<T, Executor>& b,
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
const executor_binder<T, Executor>& b,
const Executor1& = Executor1()) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((b.get_executor()))
{
return b.get_executor();
}

View File

@ -0,0 +1,738 @@
//
// bind_immediate_executor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2023 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)
//
#ifndef BOOST_ASIO_BIND_IMMEDIATE_EXECUTOR_HPP
#define BOOST_ASIO_BIND_IMMEDIATE_EXECUTOR_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <boost/asio/detail/config.hpp>
#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/detail/variadic_templates.hpp>
#include <boost/asio/associated_immediate_executor.hpp>
#include <boost/asio/associator.hpp>
#include <boost/asio/async_result.hpp>
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
namespace detail {
// Helper to automatically define nested typedef result_type.
template <typename T, typename = void>
struct immediate_executor_binder_result_type
{
protected:
typedef void result_type_or_void;
};
template <typename T>
struct immediate_executor_binder_result_type<T,
typename void_type<typename T::result_type>::type>
{
typedef typename T::result_type result_type;
protected:
typedef result_type result_type_or_void;
};
template <typename R>
struct immediate_executor_binder_result_type<R(*)()>
{
typedef R result_type;
protected:
typedef result_type result_type_or_void;
};
template <typename R>
struct immediate_executor_binder_result_type<R(&)()>
{
typedef R result_type;
protected:
typedef result_type result_type_or_void;
};
template <typename R, typename A1>
struct immediate_executor_binder_result_type<R(*)(A1)>
{
typedef R result_type;
protected:
typedef result_type result_type_or_void;
};
template <typename R, typename A1>
struct immediate_executor_binder_result_type<R(&)(A1)>
{
typedef R result_type;
protected:
typedef result_type result_type_or_void;
};
template <typename R, typename A1, typename A2>
struct immediate_executor_binder_result_type<R(*)(A1, A2)>
{
typedef R result_type;
protected:
typedef result_type result_type_or_void;
};
template <typename R, typename A1, typename A2>
struct immediate_executor_binder_result_type<R(&)(A1, A2)>
{
typedef R result_type;
protected:
typedef result_type result_type_or_void;
};
// Helper to automatically define nested typedef argument_type.
template <typename T, typename = void>
struct immediate_executor_binder_argument_type {};
template <typename T>
struct immediate_executor_binder_argument_type<T,
typename void_type<typename T::argument_type>::type>
{
typedef typename T::argument_type argument_type;
};
template <typename R, typename A1>
struct immediate_executor_binder_argument_type<R(*)(A1)>
{
typedef A1 argument_type;
};
template <typename R, typename A1>
struct immediate_executor_binder_argument_type<R(&)(A1)>
{
typedef A1 argument_type;
};
// Helper to automatically define nested typedefs first_argument_type and
// second_argument_type.
template <typename T, typename = void>
struct immediate_executor_binder_argument_types {};
template <typename T>
struct immediate_executor_binder_argument_types<T,
typename void_type<typename T::first_argument_type>::type>
{
typedef typename T::first_argument_type first_argument_type;
typedef typename T::second_argument_type second_argument_type;
};
template <typename R, typename A1, typename A2>
struct immediate_executor_binder_argument_type<R(*)(A1, A2)>
{
typedef A1 first_argument_type;
typedef A2 second_argument_type;
};
template <typename R, typename A1, typename A2>
struct immediate_executor_binder_argument_type<R(&)(A1, A2)>
{
typedef A1 first_argument_type;
typedef A2 second_argument_type;
};
// Helper to enable SFINAE on zero-argument operator() below.
template <typename T, typename = void>
struct immediate_executor_binder_result_of0
{
typedef void type;
};
template <typename T>
struct immediate_executor_binder_result_of0<T,
typename void_type<typename result_of<T()>::type>::type>
{
typedef typename result_of<T()>::type type;
};
} // namespace detail
/// A call wrapper type to bind a immediate executor of type @c Executor
/// to an object of type @c T.
template <typename T, typename Executor>
class immediate_executor_binder
#if !defined(GENERATING_DOCUMENTATION)
: public detail::immediate_executor_binder_result_type<T>,
public detail::immediate_executor_binder_argument_type<T>,
public detail::immediate_executor_binder_argument_types<T>
#endif // !defined(GENERATING_DOCUMENTATION)
{
public:
/// The type of the target object.
typedef T target_type;
/// The type of the associated immediate executor.
typedef Executor immediate_executor_type;
#if defined(GENERATING_DOCUMENTATION)
/// The return type if a function.
/**
* The type of @c result_type is based on the type @c T of the wrapper's
* target object:
*
* @li if @c T is a pointer to function type, @c result_type is a synonym for
* the return type of @c T;
*
* @li if @c T is a class type with a member type @c result_type, then @c
* result_type is a synonym for @c T::result_type;
*
* @li otherwise @c result_type is not defined.
*/
typedef see_below result_type;
/// The type of the function's argument.
/**
* The type of @c argument_type is based on the type @c T of the wrapper's
* target object:
*
* @li if @c T is a pointer to a function type accepting a single argument,
* @c argument_type is a synonym for the return type of @c T;
*
* @li if @c T is a class type with a member type @c argument_type, then @c
* argument_type is a synonym for @c T::argument_type;
*
* @li otherwise @c argument_type is not defined.
*/
typedef see_below argument_type;
/// The type of the function's first argument.
/**
* The type of @c first_argument_type is based on the type @c T of the
* wrapper's target object:
*
* @li if @c T is a pointer to a function type accepting two arguments, @c
* first_argument_type is a synonym for the return type of @c T;
*
* @li if @c T is a class type with a member type @c first_argument_type,
* then @c first_argument_type is a synonym for @c T::first_argument_type;
*
* @li otherwise @c first_argument_type is not defined.
*/
typedef see_below first_argument_type;
/// The type of the function's second argument.
/**
* The type of @c second_argument_type is based on the type @c T of the
* wrapper's target object:
*
* @li if @c T is a pointer to a function type accepting two arguments, @c
* second_argument_type is a synonym for the return type of @c T;
*
* @li if @c T is a class type with a member type @c first_argument_type,
* then @c second_argument_type is a synonym for @c T::second_argument_type;
*
* @li otherwise @c second_argument_type is not defined.
*/
typedef see_below second_argument_type;
#endif // defined(GENERATING_DOCUMENTATION)
/// Construct a immediate executor wrapper for the specified object.
/**
* This constructor is only valid if the type @c T is constructible from type
* @c U.
*/
template <typename U>
immediate_executor_binder(const immediate_executor_type& e,
BOOST_ASIO_MOVE_ARG(U) u)
: executor_(e),
target_(BOOST_ASIO_MOVE_CAST(U)(u))
{
}
/// Copy constructor.
immediate_executor_binder(const immediate_executor_binder& other)
: executor_(other.get_immediate_executor()),
target_(other.get())
{
}
/// Construct a copy, but specify a different immediate executor.
immediate_executor_binder(const immediate_executor_type& e,
const immediate_executor_binder& other)
: executor_(e),
target_(other.get())
{
}
/// Construct a copy of a different immediate executor wrapper type.
/**
* This constructor is only valid if the @c Executor type is
* constructible from type @c OtherExecutor, and the type @c T is
* constructible from type @c U.
*/
template <typename U, typename OtherExecutor>
immediate_executor_binder(
const immediate_executor_binder<U, OtherExecutor>& other)
: executor_(other.get_immediate_executor()),
target_(other.get())
{
}
/// Construct a copy of a different immediate executor wrapper type, but
/// specify a different immediate executor.
/**
* This constructor is only valid if the type @c T is constructible from type
* @c U.
*/
template <typename U, typename OtherExecutor>
immediate_executor_binder(const immediate_executor_type& e,
const immediate_executor_binder<U, OtherExecutor>& other)
: executor_(e),
target_(other.get())
{
}
#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Move constructor.
immediate_executor_binder(immediate_executor_binder&& other)
: executor_(BOOST_ASIO_MOVE_CAST(immediate_executor_type)(
other.get_immediate_executor())),
target_(BOOST_ASIO_MOVE_CAST(T)(other.get()))
{
}
/// Move construct the target object, but specify a different immediate
/// executor.
immediate_executor_binder(const immediate_executor_type& e,
immediate_executor_binder&& other)
: executor_(e),
target_(BOOST_ASIO_MOVE_CAST(T)(other.get()))
{
}
/// Move construct from a different immediate executor wrapper type.
template <typename U, typename OtherExecutor>
immediate_executor_binder(
immediate_executor_binder<U, OtherExecutor>&& other)
: executor_(BOOST_ASIO_MOVE_CAST(OtherExecutor)(
other.get_immediate_executor())),
target_(BOOST_ASIO_MOVE_CAST(U)(other.get()))
{
}
/// Move construct from a different immediate executor wrapper type, but
/// specify a different immediate executor.
template <typename U, typename OtherExecutor>
immediate_executor_binder(const immediate_executor_type& e,
immediate_executor_binder<U, OtherExecutor>&& other)
: executor_(e),
target_(BOOST_ASIO_MOVE_CAST(U)(other.get()))
{
}
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Destructor.
~immediate_executor_binder()
{
}
/// Obtain a reference to the target object.
target_type& get() BOOST_ASIO_NOEXCEPT
{
return target_;
}
/// Obtain a reference to the target object.
const target_type& get() const BOOST_ASIO_NOEXCEPT
{
return target_;
}
/// Obtain the associated immediate executor.
immediate_executor_type get_immediate_executor() const BOOST_ASIO_NOEXCEPT
{
return executor_;
}
#if defined(GENERATING_DOCUMENTATION)
template <typename... Args> auto operator()(Args&& ...);
template <typename... Args> auto operator()(Args&& ...) const;
#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
/// Forwarding function call operator.
template <typename... Args>
typename result_of<T(Args...)>::type operator()(
BOOST_ASIO_MOVE_ARG(Args)... args)
{
return target_(BOOST_ASIO_MOVE_CAST(Args)(args)...);
}
/// Forwarding function call operator.
template <typename... Args>
typename result_of<T(Args...)>::type operator()(
BOOST_ASIO_MOVE_ARG(Args)... args) const
{
return target_(BOOST_ASIO_MOVE_CAST(Args)(args)...);
}
#elif defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS) && !defined(_MSC_VER)
typename detail::immediate_executor_binder_result_of0<T>::type operator()()
{
return target_();
}
typename detail::immediate_executor_binder_result_of0<T>::type
operator()() const
{
return target_();
}
#define BOOST_ASIO_PRIVATE_BINDER_CALL_DEF(n) \
template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \
typename result_of<T(BOOST_ASIO_VARIADIC_TARGS(n))>::type operator()( \
BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \
{ \
return target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
} \
\
template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \
typename result_of<T(BOOST_ASIO_VARIADIC_TARGS(n))>::type operator()( \
BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) const \
{ \
return target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
} \
/**/
BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_BINDER_CALL_DEF)
#undef BOOST_ASIO_PRIVATE_BINDER_CALL_DEF
#else // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS) && !defined(_MSC_VER)
typedef typename detail::immediate_executor_binder_result_type<
T>::result_type_or_void result_type_or_void;
result_type_or_void operator()()
{
return target_();
}
result_type_or_void operator()() const
{
return target_();
}
#define BOOST_ASIO_PRIVATE_BINDER_CALL_DEF(n) \
template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \
result_type_or_void operator()( \
BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \
{ \
return target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
} \
\
template <BOOST_ASIO_VARIADIC_TPARAMS(n)> \
result_type_or_void operator()( \
BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) const \
{ \
return target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
} \
/**/
BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_BINDER_CALL_DEF)
#undef BOOST_ASIO_PRIVATE_BINDER_CALL_DEF
#endif // defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS) && !defined(_MSC_VER)
private:
Executor executor_;
T target_;
};
/// Associate an object of type @c T with a immediate executor of type
/// @c Executor.
template <typename Executor, typename T>
BOOST_ASIO_NODISCARD inline
immediate_executor_binder<typename decay<T>::type, Executor>
bind_immediate_executor(const Executor& e, BOOST_ASIO_MOVE_ARG(T) t)
{
return immediate_executor_binder<
typename decay<T>::type, Executor>(
e, BOOST_ASIO_MOVE_CAST(T)(t));
}
#if !defined(GENERATING_DOCUMENTATION)
namespace detail {
template <typename TargetAsyncResult,
typename Executor, typename = void>
struct immediate_executor_binder_async_result_completion_handler_type
{
};
template <typename TargetAsyncResult, typename Executor>
struct immediate_executor_binder_async_result_completion_handler_type<
TargetAsyncResult, Executor,
typename void_type<
typename TargetAsyncResult::completion_handler_type
>::type>
{
typedef immediate_executor_binder<
typename TargetAsyncResult::completion_handler_type, Executor>
completion_handler_type;
};
template <typename TargetAsyncResult, typename = void>
struct immediate_executor_binder_async_result_return_type
{
};
template <typename TargetAsyncResult>
struct immediate_executor_binder_async_result_return_type<
TargetAsyncResult,
typename void_type<
typename TargetAsyncResult::return_type
>::type>
{
typedef typename TargetAsyncResult::return_type return_type;
};
} // namespace detail
template <typename T, typename Executor, typename Signature>
class async_result<immediate_executor_binder<T, Executor>, Signature> :
public detail::immediate_executor_binder_async_result_completion_handler_type<
async_result<T, Signature>, Executor>,
public detail::immediate_executor_binder_async_result_return_type<
async_result<T, Signature> >
{
public:
explicit async_result(immediate_executor_binder<T, Executor>& b)
: target_(b.get())
{
}
typename async_result<T, Signature>::return_type get()
{
return target_.get();
}
template <typename Initiation>
struct init_wrapper
{
template <typename Init>
init_wrapper(const Executor& e, BOOST_ASIO_MOVE_ARG(Init) init)
: executor_(e),
initiation_(BOOST_ASIO_MOVE_CAST(Init)(init))
{
}
#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename Handler, typename... Args>
void operator()(
BOOST_ASIO_MOVE_ARG(Handler) handler,
BOOST_ASIO_MOVE_ARG(Args)... args)
{
BOOST_ASIO_MOVE_CAST(Initiation)(initiation_)(
immediate_executor_binder<
typename decay<Handler>::type, Executor>(
executor_, BOOST_ASIO_MOVE_CAST(Handler)(handler)),
BOOST_ASIO_MOVE_CAST(Args)(args)...);
}
template <typename Handler, typename... Args>
void operator()(
BOOST_ASIO_MOVE_ARG(Handler) handler,
BOOST_ASIO_MOVE_ARG(Args)... args) const
{
initiation_(
immediate_executor_binder<
typename decay<Handler>::type, Executor>(
executor_, BOOST_ASIO_MOVE_CAST(Handler)(handler)),
BOOST_ASIO_MOVE_CAST(Args)(args)...);
}
#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename Handler>
void operator()(
BOOST_ASIO_MOVE_ARG(Handler) handler)
{
BOOST_ASIO_MOVE_CAST(Initiation)(initiation_)(
immediate_executor_binder<
typename decay<Handler>::type, Executor>(
executor_, BOOST_ASIO_MOVE_CAST(Handler)(handler)));
}
template <typename Handler>
void operator()(
BOOST_ASIO_MOVE_ARG(Handler) handler) const
{
initiation_(
immediate_executor_binder<
typename decay<Handler>::type, Executor>(
executor_, BOOST_ASIO_MOVE_CAST(Handler)(handler)));
}
#define BOOST_ASIO_PRIVATE_INIT_WRAPPER_DEF(n) \
template <typename Handler, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
void operator()( \
BOOST_ASIO_MOVE_ARG(Handler) handler, \
BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \
{ \
BOOST_ASIO_MOVE_CAST(Initiation)(initiation_)( \
immediate_executor_binder< \
typename decay<Handler>::type, Executor>( \
executor_, BOOST_ASIO_MOVE_CAST(Handler)(handler)), \
BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
} \
\
template <typename Handler, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
void operator()( \
BOOST_ASIO_MOVE_ARG(Handler) handler, \
BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) const \
{ \
initiation_( \
immediate_executor_binder< \
typename decay<Handler>::type, Executor>( \
executor_, BOOST_ASIO_MOVE_CAST(Handler)(handler)), \
BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
} \
/**/
BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_INIT_WRAPPER_DEF)
#undef BOOST_ASIO_PRIVATE_INIT_WRAPPER_DEF
#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
Executor executor_;
Initiation initiation_;
};
#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename Initiation, typename RawCompletionToken, typename... Args>
static BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(T, Signature,
(async_initiate<T, Signature>(
declval<init_wrapper<typename decay<Initiation>::type> >(),
declval<RawCompletionToken>().get(),
declval<BOOST_ASIO_MOVE_ARG(Args)>()...)))
initiate(
BOOST_ASIO_MOVE_ARG(Initiation) initiation,
BOOST_ASIO_MOVE_ARG(RawCompletionToken) token,
BOOST_ASIO_MOVE_ARG(Args)... args)
{
return async_initiate<T, Signature>(
init_wrapper<typename decay<Initiation>::type>(
token.get_immediate_executor(),
BOOST_ASIO_MOVE_CAST(Initiation)(initiation)),
token.get(), BOOST_ASIO_MOVE_CAST(Args)(args)...);
}
#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename Initiation, typename RawCompletionToken>
static BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(T, Signature,
(async_initiate<T, Signature>(
declval<init_wrapper<typename decay<Initiation>::type> >(),
declval<RawCompletionToken>().get())))
initiate(
BOOST_ASIO_MOVE_ARG(Initiation) initiation,
BOOST_ASIO_MOVE_ARG(RawCompletionToken) token)
{
return async_initiate<T, Signature>(
init_wrapper<typename decay<Initiation>::type>(
token.get_immediate_executor(),
BOOST_ASIO_MOVE_CAST(Initiation)(initiation)),
token.get());
}
#define BOOST_ASIO_PRIVATE_INITIATE_DEF(n) \
template <typename Initiation, typename RawCompletionToken, \
BOOST_ASIO_VARIADIC_TPARAMS(n)> \
static BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(T, Signature, \
(async_initiate<T, Signature>( \
declval<init_wrapper<typename decay<Initiation>::type> >(), \
declval<RawCompletionToken>().get(), \
BOOST_ASIO_VARIADIC_MOVE_DECLVAL(n)))) \
initiate( \
BOOST_ASIO_MOVE_ARG(Initiation) initiation, \
BOOST_ASIO_MOVE_ARG(RawCompletionToken) token, \
BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \
{ \
return async_initiate<T, Signature>( \
init_wrapper<typename decay<Initiation>::type>( \
token.get_immediate_executor(), \
BOOST_ASIO_MOVE_CAST(Initiation)(initiation)), \
token.get(), BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \
} \
/**/
BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_INITIATE_DEF)
#undef BOOST_ASIO_PRIVATE_INITIATE_DEF
#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
private:
async_result(const async_result&) BOOST_ASIO_DELETED;
async_result& operator=(const async_result&) BOOST_ASIO_DELETED;
async_result<T, Signature> target_;
};
template <template <typename, typename> class Associator,
typename T, typename Executor, typename DefaultCandidate>
struct associator<Associator,
immediate_executor_binder<T, Executor>,
DefaultCandidate>
: Associator<T, DefaultCandidate>
{
static typename Associator<T, DefaultCandidate>::type
get(const immediate_executor_binder<T, Executor>& b)
BOOST_ASIO_NOEXCEPT
{
return Associator<T, DefaultCandidate>::get(b.get());
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<T, DefaultCandidate>::type)
get(const immediate_executor_binder<T, Executor>& b,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<T, DefaultCandidate>::get(b.get(), c)))
{
return Associator<T, DefaultCandidate>::get(b.get(), c);
}
};
template <typename T, typename Executor, typename Executor1>
struct associated_immediate_executor<
immediate_executor_binder<T, Executor>,
Executor1>
{
typedef Executor type;
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get(
const immediate_executor_binder<T, Executor>& b,
const Executor1& = Executor1()) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((b.get_immediate_executor()))
{
return b.get_immediate_executor();
}
};
#endif // !defined(GENERATING_DOCUMENTATION)
} // namespace asio
} // namespace boost
#include <boost/asio/detail/pop_options.hpp>
#endif // BOOST_ASIO_BIND_IMMEDIATE_EXECUTOR_HPP

View File

@ -2,7 +2,7 @@
// buffer.hpp
// ~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -893,6 +893,25 @@ private:
* bufs2.push_back(boost::asio::buffer(d2));
* bufs2.push_back(boost::asio::buffer(d3));
* bytes_transferred = sock.send(bufs2); @endcode
*
* @par Buffer Literals
*
* The `_buf` literal suffix, defined in namespace
* <tt>boost::asio::buffer_literals</tt>, may be used to create @c const_buffer
* objects from string, binary integer, and hexadecimal integer literals.
* For example:
*
* @code
* using namespace boost::asio::buffer_literals;
*
* boost::asio::const_buffer b1 = "hello"_buf;
* boost::asio::const_buffer b2 = 0xdeadbeef_buf;
* boost::asio::const_buffer b3 = 0x0123456789abcdef0123456789abcdef_buf;
* boost::asio::const_buffer b4 = 0b1010101011001100_buf; @endcode
*
* Note that the memory associated with a buffer literal is valid for the
* lifetime of the program. This means that the buffer can be safely used with
* asynchronous operations.
*/
/*@{*/
@ -1568,6 +1587,14 @@ BOOST_ASIO_NODISCARD inline BOOST_ASIO_MUTABLE_BUFFER buffer(
is_contiguous_iterator<typename T::iterator>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_convertible<T, const_buffer>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_convertible<T, mutable_buffer>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_const<
typename remove_reference<
@ -1598,6 +1625,14 @@ BOOST_ASIO_NODISCARD inline BOOST_ASIO_MUTABLE_BUFFER buffer(
is_contiguous_iterator<typename T::iterator>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_convertible<T, const_buffer>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_convertible<T, mutable_buffer>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_const<
typename remove_reference<
@ -1627,6 +1662,14 @@ BOOST_ASIO_NODISCARD inline BOOST_ASIO_CONST_BUFFER buffer(
is_contiguous_iterator<typename T::iterator>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_convertible<T, const_buffer>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_convertible<T, mutable_buffer>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
is_const<
typename remove_reference<
@ -1657,6 +1700,14 @@ BOOST_ASIO_NODISCARD inline BOOST_ASIO_CONST_BUFFER buffer(
is_contiguous_iterator<typename T::iterator>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_convertible<T, const_buffer>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_convertible<T, mutable_buffer>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
is_const<
typename remove_reference<
@ -1685,6 +1736,14 @@ BOOST_ASIO_NODISCARD inline BOOST_ASIO_CONST_BUFFER buffer(
typename constraint<
is_contiguous_iterator<typename T::const_iterator>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_convertible<T, const_buffer>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_convertible<T, mutable_buffer>::value,
defaulted_constraint
>::type = defaulted_constraint()) BOOST_ASIO_NOEXCEPT
{
return BOOST_ASIO_CONST_BUFFER(
@ -1707,6 +1766,14 @@ BOOST_ASIO_NODISCARD inline BOOST_ASIO_CONST_BUFFER buffer(
typename constraint<
is_contiguous_iterator<typename T::const_iterator>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_convertible<T, const_buffer>::value,
defaulted_constraint
>::type = defaulted_constraint(),
typename constraint<
!is_convertible<T, mutable_buffer>::value,
defaulted_constraint
>::type = defaulted_constraint()) BOOST_ASIO_NOEXCEPT
{
return BOOST_ASIO_CONST_BUFFER(
@ -2672,6 +2739,172 @@ struct is_dynamic_buffer
{
};
#if (defined(BOOST_ASIO_HAS_USER_DEFINED_LITERALS) \
&& defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)) \
|| defined(GENERATING_DOCUMENTATION)
namespace buffer_literals {
namespace detail {
template <char... Chars>
struct chars {};
template <unsigned char... Bytes>
struct bytes {};
// Literal processor that converts binary literals to an array of bytes.
template <typename Bytes, char... Chars>
struct bin_literal;
template <unsigned char... Bytes>
struct bin_literal<bytes<Bytes...> >
{
static const std::size_t size = sizeof...(Bytes);
static const unsigned char data[sizeof...(Bytes)];
};
template <unsigned char... Bytes>
const unsigned char bin_literal<bytes<Bytes...> >::data[sizeof...(Bytes)]
= { Bytes... };
template <unsigned char... Bytes, char Bit7, char Bit6, char Bit5,
char Bit4, char Bit3, char Bit2, char Bit1, char Bit0, char... Chars>
struct bin_literal<bytes<Bytes...>, Bit7, Bit6,
Bit5, Bit4, Bit3, Bit2, Bit1, Bit0, Chars...> :
bin_literal<
bytes<Bytes...,
static_cast<unsigned char>(
(Bit7 == '1' ? 0x80 : 0) |
(Bit6 == '1' ? 0x40 : 0) |
(Bit5 == '1' ? 0x20 : 0) |
(Bit4 == '1' ? 0x10 : 0) |
(Bit3 == '1' ? 0x08 : 0) |
(Bit2 == '1' ? 0x04 : 0) |
(Bit1 == '1' ? 0x02 : 0) |
(Bit0 == '1' ? 0x01 : 0))
>, Chars...> {};
template <unsigned char... Bytes, char... Chars>
struct bin_literal<bytes<Bytes...>, Chars...>
{
static_assert(sizeof...(Chars) == 0,
"number of digits in a binary buffer literal must be a multiple of 8");
static const std::size_t size = 0;
static const unsigned char data[1];
};
template <unsigned char... Bytes, char... Chars>
const unsigned char bin_literal<bytes<Bytes...>, Chars...>::data[1] = {};
// Literal processor that converts hexadecimal literals to an array of bytes.
template <typename Bytes, char... Chars>
struct hex_literal;
template <unsigned char... Bytes>
struct hex_literal<bytes<Bytes...> >
{
static const std::size_t size = sizeof...(Bytes);
static const unsigned char data[sizeof...(Bytes)];
};
template <unsigned char... Bytes>
const unsigned char hex_literal<bytes<Bytes...> >::data[sizeof...(Bytes)]
= { Bytes... };
template <unsigned char... Bytes, char Hi, char Lo, char... Chars>
struct hex_literal<bytes<Bytes...>, Hi, Lo, Chars...> :
hex_literal<
bytes<Bytes...,
static_cast<unsigned char>(
Lo >= 'A' && Lo <= 'F' ? Lo - 'A' + 10 :
(Lo >= 'a' && Lo <= 'f' ? Lo - 'a' + 10 : Lo - '0')) |
((static_cast<unsigned char>(
Hi >= 'A' && Hi <= 'F' ? Hi - 'A' + 10 :
(Hi >= 'a' && Hi <= 'f' ? Hi - 'a' + 10 : Hi - '0'))) << 4)
>, Chars...> {};
template <unsigned char... Bytes, char Char>
struct hex_literal<bytes<Bytes...>, Char>
{
static_assert(!Char,
"a hexadecimal buffer literal must have an even number of digits");
static const std::size_t size = 0;
static const unsigned char data[1];
};
template <unsigned char... Bytes, char Char>
const unsigned char hex_literal<bytes<Bytes...>, Char>::data[1] = {};
// Helper template that removes digit separators and then passes the cleaned
// variadic pack of characters to the literal processor.
template <template <typename, char...> class Literal,
typename Clean, char... Raw>
struct remove_separators;
template <template <typename, char...> class Literal,
char... Clean, char... Raw>
struct remove_separators<Literal, chars<Clean...>, '\'', Raw...> :
remove_separators<Literal, chars<Clean...>, Raw...> {};
template <template <typename, char...> class Literal,
char... Clean, char C, char... Raw>
struct remove_separators<Literal, chars<Clean...>, C, Raw...> :
remove_separators<Literal, chars<Clean..., C>, Raw...> {};
template <template <typename, char...> class Literal, char... Clean>
struct remove_separators<Literal, chars<Clean...> > :
Literal<bytes<>, Clean...> {};
// Helper template to determine the literal type based on the prefix.
template <char... Chars>
struct literal;
template <char... Chars>
struct literal<'0', 'b', Chars...> :
remove_separators<bin_literal, chars<>, Chars...>{};
template <char... Chars>
struct literal<'0', 'B', Chars...> :
remove_separators<bin_literal, chars<>, Chars...>{};
template <char... Chars>
struct literal<'0', 'x', Chars...> :
remove_separators<hex_literal, chars<>, Chars...>{};
template <char... Chars>
struct literal<'0', 'X', Chars...> :
remove_separators<hex_literal, chars<>, Chars...>{};
} // namespace detail
/// Literal operator for creating const_buffer objects from string literals.
inline BOOST_ASIO_CONST_BUFFER operator"" _buf(const char* data, std::size_t n)
{
return BOOST_ASIO_CONST_BUFFER(data, n);
}
/// Literal operator for creating const_buffer objects from unbounded binary or
/// hexadecimal integer literals.
template <char... Chars>
inline BOOST_ASIO_CONST_BUFFER operator"" _buf()
{
return BOOST_ASIO_CONST_BUFFER(
+detail::literal<Chars...>::data,
detail::literal<Chars...>::size);
}
} // namespace buffer_literals
#endif // (defined(BOOST_ASIO_HAS_USER_DEFINED_LITERALS)
// && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES))
// || defined(GENERATING_DOCUMENTATION)
} // namespace asio
} // namespace boost

View File

@ -2,7 +2,7 @@
// buffer_registration.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// buffered_read_stream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -73,16 +73,17 @@ public:
/// Construct, passing the specified argument to initialise the next layer.
template <typename Arg>
explicit buffered_read_stream(Arg& a)
: next_layer_(a),
explicit buffered_read_stream(BOOST_ASIO_MOVE_OR_LVALUE_ARG(Arg) a)
: next_layer_(BOOST_ASIO_MOVE_OR_LVALUE(Arg)(a)),
storage_(default_buffer_size)
{
}
/// Construct, passing the specified argument to initialise the next layer.
template <typename Arg>
buffered_read_stream(Arg& a, std::size_t buffer_size)
: next_layer_(a),
buffered_read_stream(BOOST_ASIO_MOVE_OR_LVALUE_ARG(Arg) a,
std::size_t buffer_size)
: next_layer_(BOOST_ASIO_MOVE_OR_LVALUE(Arg)(a)),
storage_(buffer_size)
{
}

View File

@ -2,7 +2,7 @@
// buffered_read_stream_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// buffered_stream.hpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -57,17 +57,17 @@ public:
/// Construct, passing the specified argument to initialise the next layer.
template <typename Arg>
explicit buffered_stream(Arg& a)
: inner_stream_impl_(a),
explicit buffered_stream(BOOST_ASIO_MOVE_OR_LVALUE_ARG(Arg) a)
: inner_stream_impl_(BOOST_ASIO_MOVE_OR_LVALUE(Arg)(a)),
stream_impl_(inner_stream_impl_)
{
}
/// Construct, passing the specified argument to initialise the next layer.
template <typename Arg>
explicit buffered_stream(Arg& a, std::size_t read_buffer_size,
std::size_t write_buffer_size)
: inner_stream_impl_(a, write_buffer_size),
explicit buffered_stream(BOOST_ASIO_MOVE_OR_LVALUE_ARG(Arg) a,
std::size_t read_buffer_size, std::size_t write_buffer_size)
: inner_stream_impl_(BOOST_ASIO_MOVE_OR_LVALUE(Arg)(a), write_buffer_size),
stream_impl_(inner_stream_impl_, read_buffer_size)
{
}

View File

@ -2,7 +2,7 @@
// buffered_stream_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// buffered_write_stream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -73,16 +73,17 @@ public:
/// Construct, passing the specified argument to initialise the next layer.
template <typename Arg>
explicit buffered_write_stream(Arg& a)
: next_layer_(a),
explicit buffered_write_stream(BOOST_ASIO_MOVE_OR_LVALUE_ARG(Arg) a)
: next_layer_(BOOST_ASIO_MOVE_OR_LVALUE(Arg)(a)),
storage_(default_buffer_size)
{
}
/// Construct, passing the specified argument to initialise the next layer.
template <typename Arg>
buffered_write_stream(Arg& a, std::size_t buffer_size)
: next_layer_(a),
buffered_write_stream(BOOST_ASIO_MOVE_OR_LVALUE_ARG(Arg) a,
std::size_t buffer_size)
: next_layer_(BOOST_ASIO_MOVE_OR_LVALUE(Arg)(a)),
storage_(buffer_size)
{
}

View File

@ -2,7 +2,7 @@
// buffered_write_stream_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// buffers_iterator.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// cancellation_signal.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// cancellation_state.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// cancellation_type.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// co_spawn.hpp
// ~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// completion_condition.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// compose.hpp
// ~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -19,16 +19,12 @@
#include <boost/asio/associated_executor.hpp>
#include <boost/asio/async_result.hpp>
#include <boost/asio/detail/base_from_cancellation_state.hpp>
#include <boost/asio/detail/composed_work.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>
#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/detail/variadic_templates.hpp>
#include <boost/asio/execution/executor.hpp>
#include <boost/asio/execution/outstanding_work.hpp>
#include <boost/asio/executor_work_guard.hpp>
#include <boost/asio/is_executor.hpp>
#include <boost/asio/system_executor.hpp>
#include <boost/asio/detail/push_options.hpp>
@ -36,274 +32,6 @@ namespace boost {
namespace asio {
namespace detail {
template <typename Executor, typename = void>
class composed_work_guard
{
public:
typedef typename decay<
typename prefer_result<Executor,
execution::outstanding_work_t::tracked_t
>::type
>::type executor_type;
composed_work_guard(const Executor& ex)
: executor_(boost::asio::prefer(ex, execution::outstanding_work.tracked))
{
}
void reset()
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return executor_;
}
private:
executor_type executor_;
};
template <>
struct composed_work_guard<system_executor>
{
public:
typedef system_executor executor_type;
composed_work_guard(const system_executor&)
{
}
void reset()
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return system_executor();
}
};
#if !defined(BOOST_ASIO_NO_TS_EXECUTORS)
template <typename Executor>
struct composed_work_guard<Executor,
typename enable_if<
!execution::is_executor<Executor>::value
>::type> : executor_work_guard<Executor>
{
composed_work_guard(const Executor& ex)
: executor_work_guard<Executor>(ex)
{
}
};
#endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS)
template <typename>
struct composed_io_executors;
template <>
struct composed_io_executors<void()>
{
composed_io_executors() BOOST_ASIO_NOEXCEPT
: head_(system_executor())
{
}
typedef system_executor head_type;
system_executor head_;
};
inline composed_io_executors<void()> make_composed_io_executors()
{
return composed_io_executors<void()>();
}
template <typename Head>
struct composed_io_executors<void(Head)>
{
explicit composed_io_executors(const Head& ex) BOOST_ASIO_NOEXCEPT
: head_(ex)
{
}
typedef Head head_type;
Head head_;
};
template <typename Head>
inline composed_io_executors<void(Head)>
make_composed_io_executors(const Head& head)
{
return composed_io_executors<void(Head)>(head);
}
#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename Head, typename... Tail>
struct composed_io_executors<void(Head, Tail...)>
{
explicit composed_io_executors(const Head& head,
const Tail&... tail) BOOST_ASIO_NOEXCEPT
: head_(head),
tail_(tail...)
{
}
void reset()
{
head_.reset();
tail_.reset();
}
typedef Head head_type;
Head head_;
composed_io_executors<void(Tail...)> tail_;
};
template <typename Head, typename... Tail>
inline composed_io_executors<void(Head, Tail...)>
make_composed_io_executors(const Head& head, const Tail&... tail)
{
return composed_io_executors<void(Head, Tail...)>(head, tail...);
}
#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
#define BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF(n) \
template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
struct composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
{ \
explicit composed_io_executors(const Head& head, \
BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) BOOST_ASIO_NOEXCEPT \
: head_(head), \
tail_(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)) \
{ \
} \
\
void reset() \
{ \
head_.reset(); \
tail_.reset(); \
} \
\
typedef Head head_type; \
Head head_; \
composed_io_executors<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \
}; \
\
template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
inline composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
make_composed_io_executors(const Head& head, \
BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) \
{ \
return composed_io_executors< \
void(Head, BOOST_ASIO_VARIADIC_TARGS(n))>( \
head, BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)); \
} \
/**/
BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF)
#undef BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF
#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename>
struct composed_work;
template <>
struct composed_work<void()>
{
typedef composed_io_executors<void()> executors_type;
composed_work(const executors_type&) BOOST_ASIO_NOEXCEPT
: head_(system_executor())
{
}
void reset()
{
head_.reset();
}
typedef system_executor head_type;
composed_work_guard<system_executor> head_;
};
template <typename Head>
struct composed_work<void(Head)>
{
typedef composed_io_executors<void(Head)> executors_type;
explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT
: head_(ex.head_)
{
}
void reset()
{
head_.reset();
}
typedef Head head_type;
composed_work_guard<Head> head_;
};
#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename Head, typename... Tail>
struct composed_work<void(Head, Tail...)>
{
typedef composed_io_executors<void(Head, Tail...)> executors_type;
explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT
: head_(ex.head_),
tail_(ex.tail_)
{
}
void reset()
{
head_.reset();
tail_.reset();
}
typedef Head head_type;
composed_work_guard<Head> head_;
composed_work<void(Tail...)> tail_;
};
#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
#define BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF(n) \
template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
struct composed_work<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
{ \
typedef composed_io_executors<void(Head, \
BOOST_ASIO_VARIADIC_TARGS(n))> executors_type; \
\
explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT \
: head_(ex.head_), \
tail_(ex.tail_) \
{ \
} \
\
void reset() \
{ \
head_.reset(); \
tail_.reset(); \
} \
\
typedef Head head_type; \
composed_work_guard<Head> head_; \
composed_work<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \
}; \
/**/
BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF)
#undef BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF
#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename Impl, typename Work, typename Handler, typename Signature>
class composed_op;
@ -344,11 +72,16 @@ public:
}
#endif // defined(BOOST_ASIO_HAS_MOVE)
typedef typename associated_executor<Handler,
typename composed_work_guard<
typename Work::head_type
>::executor_type
>::type executor_type;
typedef typename composed_work_guard<
typename Work::head_type>::executor_type io_executor_type;
io_executor_type get_io_executor() const BOOST_ASIO_NOEXCEPT
{
return work_.head_.get_executor();
}
typedef typename associated_executor<Handler, io_executor_type>::type
executor_type;
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
@ -441,6 +174,11 @@ public:
BOOST_ASIO_MOVE_CAST(OutFilter)(out_filter));
}
cancellation_type_t cancelled() const BOOST_ASIO_NOEXCEPT
{
return base_from_cancellation_state<Handler>::cancelled();
}
//private:
Impl impl_;
Work work_;
@ -549,29 +287,6 @@ inline initiate_composed_op<Signature, Executors> make_initiate_composed_op(
BOOST_ASIO_MOVE_CAST(composed_io_executors<Executors>)(executors));
}
template <typename IoObject>
inline typename IoObject::executor_type
get_composed_io_executor(IoObject& io_object,
typename enable_if<
!is_executor<IoObject>::value
>::type* = 0,
typename enable_if<
!execution::is_executor<IoObject>::value
>::type* = 0)
{
return io_object.get_executor();
}
template <typename Executor>
inline const Executor& get_composed_io_executor(const Executor& ex,
typename enable_if<
is_executor<Executor>::value
|| execution::is_executor<Executor>::value
>::type* = 0)
{
return ex;
}
} // namespace detail
#if !defined(GENERATING_DOCUMENTATION)
@ -584,9 +299,19 @@ struct associator<Associator,
DefaultCandidate>
: Associator<Handler, DefaultCandidate>
{
static typename Associator<Handler, DefaultCandidate>::type get(
const detail::composed_op<Impl, Work, Handler, Signature>& h,
const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
static typename Associator<Handler, DefaultCandidate>::type
get(const detail::composed_op<Impl, Work, Handler, Signature>& h)
BOOST_ASIO_NOEXCEPT
{
return Associator<Handler, DefaultCandidate>::get(h.handler_);
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<Handler, DefaultCandidate>::type)
get(const detail::composed_op<Impl, Work, Handler, Signature>& h,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<Handler, DefaultCandidate>::get(h.handler_, c)))
{
return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
}
@ -609,7 +334,7 @@ struct associator<Associator,
* handler. The remaining arguments are any arguments that originate from the
* completion handlers of any asynchronous operations performed by the
* implementation.
*
* @param token The completion token.
*
* @param io_objects_or_executors Zero or more I/O objects or I/O executors for

View File

@ -2,7 +2,7 @@
// connect.hpp
// ~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// connect_pipe.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

90
boost/asio/consign.hpp Normal file
View File

@ -0,0 +1,90 @@
//
// consign.hpp
// ~~~~~~~~~~
//
// Copyright (c) 2003-2023 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)
//
#ifndef BOOST_ASIO_CONSIGN_HPP
#define BOOST_ASIO_CONSIGN_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <boost/asio/detail/config.hpp>
#if (defined(BOOST_ASIO_HAS_STD_TUPLE) \
&& defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)) \
|| defined(GENERATING_DOCUMENTATION)
#include <tuple>
#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
/// Completion token type used to specify that the completion handler should
/// carry additional values along with it.
/**
* This completion token adapter is typically used to keep at least one copy of
* an object, such as a smart pointer, alive until the completion handler is
* called.
*/
template <typename CompletionToken, typename... Values>
class consign_t
{
public:
/// Constructor.
template <typename T, typename... V>
BOOST_ASIO_CONSTEXPR explicit consign_t(
BOOST_ASIO_MOVE_ARG(T) completion_token,
BOOST_ASIO_MOVE_ARG(V)... values)
: token_(BOOST_ASIO_MOVE_CAST(T)(completion_token)),
values_(BOOST_ASIO_MOVE_CAST(V)(values)...)
{
}
#if defined(GENERATING_DOCUMENTATION)
private:
#endif // defined(GENERATING_DOCUMENTATION)
CompletionToken token_;
std::tuple<Values...> values_;
};
/// Completion token adapter used to specify that the completion handler should
/// carry additional values along with it.
/**
* This completion token adapter is typically used to keep at least one copy of
* an object, such as a smart pointer, alive until the completion handler is
* called.
*/
template <typename CompletionToken, typename... Values>
BOOST_ASIO_NODISCARD inline BOOST_ASIO_CONSTEXPR consign_t<
typename decay<CompletionToken>::type, typename decay<Values>::type...>
consign(BOOST_ASIO_MOVE_ARG(CompletionToken) completion_token,
BOOST_ASIO_MOVE_ARG(Values)... values)
{
return consign_t<
typename decay<CompletionToken>::type, typename decay<Values>::type...>(
BOOST_ASIO_MOVE_CAST(CompletionToken)(completion_token),
BOOST_ASIO_MOVE_CAST(Values)(values)...);
}
} // namespace asio
} // namespace boost
#include <boost/asio/detail/pop_options.hpp>
#include <boost/asio/impl/consign.hpp>
#endif // (defined(BOOST_ASIO_HAS_STD_TUPLE)
// && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES))
// || defined(GENERATING_DOCUMENTATION)
#endif // BOOST_ASIO_CONSIGN_HPP

View File

@ -2,7 +2,7 @@
// coroutine.hpp
// ~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// deadline_timer.hpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// defer.hpp
// ~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -17,21 +17,18 @@
#include <boost/asio/detail/config.hpp>
#include <boost/asio/async_result.hpp>
#include <boost/asio/detail/initiate_defer.hpp>
#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/execution_context.hpp>
#include <boost/asio/execution/blocking.hpp>
#include <boost/asio/execution/executor.hpp>
#include <boost/asio/is_executor.hpp>
#include <boost/asio/require.hpp>
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
namespace detail {
class initiate_defer;
template <typename> class initiate_defer_with_executor;
} // namespace detail
/// Submits a completion token or function object for execution.
/**
@ -68,12 +65,11 @@ template <typename> class initiate_defer_with_executor;
* @code auto alloc = get_associated_allocator(handler); @endcode
*
* @li If <tt>execution::is_executor<Ex>::value</tt> is true, performs
* @code execution::execute(
* prefer(
* require(ex, execution::blocking.never),
* execution::relationship.continuation,
* execution::allocator(alloc)),
* std::forward<CompletionHandler>(completion_handler)); @endcode
* @code prefer(
* require(ex, execution::blocking.never),
* execution::relationship.continuation,
* execution::allocator(alloc)
* ).execute(std::forward<CompletionHandler>(completion_handler)); @endcode
*
* @li If <tt>execution::is_executor<Ex>::value</tt> is false, performs
* @code ex.defer(
@ -88,7 +84,11 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) defer(
BOOST_ASIO_MOVE_ARG(NullaryToken) token)
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
async_initiate<NullaryToken, void()>(
declval<detail::initiate_defer>(), token)));
declval<detail::initiate_defer>(), token)))
{
return async_initiate<NullaryToken, void()>(
detail::initiate_defer(), token);
}
/// Submits a completion token or function object for execution.
/**
@ -137,11 +137,8 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) defer(
* handler_ that is a decay-copy of @c completion_handler, and a function call
* operator that performs:
* @code auto a = get_associated_allocator(handler_);
* execution::execute(
* prefer(executor_,
* execution::blocking.possibly,
* execution::allocator(a)),
* std::move(handler_)); @endcode
* prefer(executor_, execution::allocator(a)).execute(std::move(handler_));
* @endcode
*
* @li If <tt>execution::is_executor<Ex1>::value</tt> is false, constructs a
* function object @c f with a member @c work_ that is initialised with
@ -152,12 +149,11 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) defer(
* work_.reset(); @endcode
*
* @li If <tt>execution::is_executor<Ex>::value</tt> is true, performs
* @code execution::execute(
* prefer(
* require(ex, execution::blocking.never),
* execution::relationship.continuation,
* execution::allocator(alloc)),
* std::move(f)); @endcode
* @code prefer(
* require(ex, execution::blocking.never),
* execution::relationship.continuation,
* execution::allocator(alloc)
* ).execute(std::move(f)); @endcode
*
* @li If <tt>execution::is_executor<Ex>::value</tt> is false, performs
* @code ex.defer(std::move(f), alloc); @endcode
@ -173,11 +169,17 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) defer(
BOOST_ASIO_MOVE_ARG(NullaryToken) token
BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(Executor),
typename constraint<
execution::is_executor<Executor>::value || is_executor<Executor>::value
(execution::is_executor<Executor>::value
&& can_require<Executor, execution::blocking_t::never_t>::value)
|| is_executor<Executor>::value
>::type = 0)
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
async_initiate<NullaryToken, void()>(
declval<detail::initiate_defer_with_executor<Executor> >(), token)));
declval<detail::initiate_defer_with_executor<Executor> >(), token)))
{
return async_initiate<NullaryToken, void()>(
detail::initiate_defer_with_executor<Executor>(ex), token);
}
/// Submits a completion token or function object for execution.
/**
@ -206,13 +208,17 @@ BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(NullaryToken, void()) defer(
BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX((
async_initiate<NullaryToken, void()>(
declval<detail::initiate_defer_with_executor<
typename ExecutionContext::executor_type> >(), token)));
typename ExecutionContext::executor_type> >(), token)))
{
return async_initiate<NullaryToken, void()>(
detail::initiate_defer_with_executor<
typename ExecutionContext::executor_type>(
ctx.get_executor()), token);
}
} // namespace asio
} // namespace boost
#include <boost/asio/detail/pop_options.hpp>
#include <boost/asio/impl/defer.hpp>
#endif // BOOST_ASIO_DEFER_HPP

View File

@ -2,7 +2,7 @@
// deferred.hpp
// ~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -39,23 +39,27 @@ struct is_deferred : false_type
{
};
/// Helper type to wrap multiple completion signatures.
template <typename... Signatures>
struct deferred_signatures
{
};
namespace detail {
// Helper trait for getting the completion signature of the tail in a sequence
// Helper trait for getting the completion signatures of the tail in a sequence
// when invoked with the specified arguments.
template <typename HeadSignature, typename Tail>
struct deferred_sequence_signature;
template <typename Tail, typename... Signatures>
struct deferred_sequence_signatures;
template <typename R, typename... Args, typename Tail>
struct deferred_sequence_signature<R(Args...), Tail>
template <typename Tail, typename R, typename... Args, typename... Signatures>
struct deferred_sequence_signatures<Tail, R(Args...), Signatures...>
: completion_signature_of<decltype(declval<Tail>()(declval<Args>()...))>
{
static_assert(
!is_same<decltype(declval<Tail>()(declval<Args>()...)), void>::value,
"deferred functions must produce a deferred return type");
typedef typename completion_signature_of<
decltype(declval<Tail>()(declval<Args>()...))>::type type;
};
// Completion handler for the head component of a deferred sequence.
@ -84,6 +88,88 @@ public:
Tail tail_;
};
template <typename Head, typename Tail, typename... Signatures>
class deferred_sequence_base
{
private:
struct initiate
{
template <typename Handler>
void operator()(BOOST_ASIO_MOVE_ARG(Handler) handler,
Head head, BOOST_ASIO_MOVE_ARG(Tail) tail)
{
BOOST_ASIO_MOVE_OR_LVALUE(Head)(head)(
deferred_sequence_handler<
typename decay<Handler>::type,
typename decay<Tail>::type>(
BOOST_ASIO_MOVE_CAST(Handler)(handler),
BOOST_ASIO_MOVE_CAST(Tail)(tail)));
}
};
Head head_;
Tail tail_;
public:
template <typename H, typename T>
BOOST_ASIO_CONSTEXPR explicit deferred_sequence_base(
BOOST_ASIO_MOVE_ARG(H) head, BOOST_ASIO_MOVE_ARG(T) tail)
: head_(BOOST_ASIO_MOVE_CAST(H)(head)),
tail_(BOOST_ASIO_MOVE_CAST(T)(tail))
{
}
template <BOOST_ASIO_COMPLETION_TOKEN_FOR(Signatures...) CompletionToken>
auto operator()(
BOOST_ASIO_MOVE_ARG(CompletionToken) token) BOOST_ASIO_RVALUE_REF_QUAL
-> decltype(
boost::asio::async_initiate<CompletionToken, Signatures...>(
declval<initiate>(), token,
BOOST_ASIO_MOVE_OR_LVALUE(Head)(this->head_),
BOOST_ASIO_MOVE_OR_LVALUE(Tail)(this->tail_)))
{
return boost::asio::async_initiate<CompletionToken, Signatures...>(
initiate(), token,
BOOST_ASIO_MOVE_OR_LVALUE(Head)(head_),
BOOST_ASIO_MOVE_OR_LVALUE(Tail)(tail_));
}
#if defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
template <BOOST_ASIO_COMPLETION_TOKEN_FOR(Signatures...) CompletionToken>
auto operator()(
BOOST_ASIO_MOVE_ARG(CompletionToken) token) const &
-> decltype(
boost::asio::async_initiate<CompletionToken, Signatures...>(
initiate(), token, this->head_, this->tail_))
{
return boost::asio::async_initiate<CompletionToken, Signatures...>(
initiate(), token, head_, tail_);
}
#endif // defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
};
// Two-step application of variadic Signatures to determine correct base type.
template <typename Head, typename Tail>
struct deferred_sequence_types
{
template <typename... Signatures>
struct op1
{
typedef deferred_sequence_base<Head, Tail, Signatures...> type;
};
template <typename... Signatures>
struct op2
{
typedef typename deferred_sequence_signatures<Tail, Signatures...>::template
apply<op1>::type::type type;
};
typedef typename completion_signature_of<Head>::template
apply<op2>::type::type base;
};
} // namespace detail
/// Used to represent an empty deferred action.
@ -334,6 +420,88 @@ public:
#endif // defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
};
/// Encapsulates a deferred asynchronous operation thas has multiple completion
/// signatures.
template <typename... Signatures, typename Initiation, typename... InitArgs>
class BOOST_ASIO_NODISCARD deferred_async_operation<
deferred_signatures<Signatures...>, Initiation, InitArgs...>
{
private:
typedef typename decay<Initiation>::type initiation_t;
initiation_t initiation_;
typedef std::tuple<typename decay<InitArgs>::type...> init_args_t;
init_args_t init_args_;
template <typename CompletionToken, std::size_t... I>
auto invoke_helper(
BOOST_ASIO_MOVE_ARG(CompletionToken) token,
detail::index_sequence<I...>)
-> decltype(
boost::asio::async_initiate<CompletionToken, Signatures...>(
BOOST_ASIO_MOVE_CAST(initiation_t)(initiation_), token,
std::get<I>(BOOST_ASIO_MOVE_CAST(init_args_t)(init_args_))...))
{
return boost::asio::async_initiate<CompletionToken, Signatures...>(
BOOST_ASIO_MOVE_CAST(initiation_t)(initiation_), token,
std::get<I>(BOOST_ASIO_MOVE_CAST(init_args_t)(init_args_))...);
}
#if defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
template <typename CompletionToken, std::size_t... I>
auto const_invoke_helper(
BOOST_ASIO_MOVE_ARG(CompletionToken) token,
detail::index_sequence<I...>) const &
-> decltype(
boost::asio::async_initiate<CompletionToken, Signatures...>(
initiation_t(initiation_), token, std::get<I>(init_args_)...))
{
return boost::asio::async_initiate<CompletionToken, Signatures...>(
initiation_t(initiation_), token, std::get<I>(init_args_)...);
}
#endif // defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
public:
/// Construct a deferred asynchronous operation from the arguments to an
/// initiation function object.
template <typename I, typename... A>
BOOST_ASIO_CONSTEXPR explicit deferred_async_operation(
deferred_init_tag, BOOST_ASIO_MOVE_ARG(I) initiation,
BOOST_ASIO_MOVE_ARG(A)... init_args)
: initiation_(BOOST_ASIO_MOVE_CAST(I)(initiation)),
init_args_(BOOST_ASIO_MOVE_CAST(A)(init_args)...)
{
}
/// Initiate the asynchronous operation using the supplied completion token.
template <BOOST_ASIO_COMPLETION_TOKEN_FOR(Signatures...) CompletionToken>
auto operator()(
BOOST_ASIO_MOVE_ARG(CompletionToken) token) BOOST_ASIO_RVALUE_REF_QUAL
-> decltype(
this->invoke_helper(
BOOST_ASIO_MOVE_CAST(CompletionToken)(token),
detail::index_sequence_for<InitArgs...>()))
{
return this->invoke_helper(
BOOST_ASIO_MOVE_CAST(CompletionToken)(token),
detail::index_sequence_for<InitArgs...>());
}
#if defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
template <BOOST_ASIO_COMPLETION_TOKEN_FOR(Signatures...) CompletionToken>
auto operator()(
BOOST_ASIO_MOVE_ARG(CompletionToken) token) const &
-> decltype(
this->const_invoke_helper(
BOOST_ASIO_MOVE_CAST(CompletionToken)(token),
detail::index_sequence_for<InitArgs...>()))
{
return this->const_invoke_helper(
BOOST_ASIO_MOVE_CAST(CompletionToken)(token),
detail::index_sequence_for<InitArgs...>());
}
#endif // defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
};
#if !defined(GENERATING_DOCUMENTATION)
template <typename Signature, typename Initiation, typename... InitArgs>
struct is_deferred<
@ -344,66 +512,25 @@ struct is_deferred<
/// Defines a link between two consecutive operations in a sequence.
template <typename Head, typename Tail>
class BOOST_ASIO_NODISCARD deferred_sequence
class BOOST_ASIO_NODISCARD deferred_sequence :
public detail::deferred_sequence_types<Head, Tail>::base
{
private:
typedef typename detail::deferred_sequence_signature<
typename completion_signature_of<Head>::type, Tail>::type
signature;
struct initiate
{
template <typename Handler>
void operator()(BOOST_ASIO_MOVE_ARG(Handler) handler,
Head head, BOOST_ASIO_MOVE_ARG(Tail) tail)
{
BOOST_ASIO_MOVE_OR_LVALUE(Head)(head)(
detail::deferred_sequence_handler<
typename decay<Handler>::type,
typename decay<Tail>::type>(
BOOST_ASIO_MOVE_CAST(Handler)(handler),
BOOST_ASIO_MOVE_CAST(Tail)(tail)));
}
};
Head head_;
Tail tail_;
public:
template <typename H, typename T>
BOOST_ASIO_CONSTEXPR explicit deferred_sequence(deferred_init_tag,
BOOST_ASIO_MOVE_ARG(H) head, BOOST_ASIO_MOVE_ARG(T) tail)
: head_(BOOST_ASIO_MOVE_CAST(H)(head)),
tail_(BOOST_ASIO_MOVE_CAST(T)(tail))
: detail::deferred_sequence_types<Head, Tail>::base(
BOOST_ASIO_MOVE_CAST(H)(head), BOOST_ASIO_MOVE_CAST(T)(tail))
{
}
template <BOOST_ASIO_COMPLETION_TOKEN_FOR(signature) CompletionToken>
auto operator()(
BOOST_ASIO_MOVE_ARG(CompletionToken) token) BOOST_ASIO_RVALUE_REF_QUAL
-> decltype(
boost::asio::async_initiate<CompletionToken, signature>(
declval<initiate>(), token,
BOOST_ASIO_MOVE_OR_LVALUE(Head)(this->head_),
BOOST_ASIO_MOVE_OR_LVALUE(Tail)(this->tail_)))
{
return boost::asio::async_initiate<CompletionToken, signature>(
initiate(), token,
BOOST_ASIO_MOVE_OR_LVALUE(Head)(head_),
BOOST_ASIO_MOVE_OR_LVALUE(Tail)(tail_));
}
#if defined(GENERATING_DOCUMENTATION)
template <typename CompletionToken>
auto operator()(BOOST_ASIO_MOVE_ARG(CompletionToken) token)
BOOST_ASIO_RVALUE_REF_QUAL;
#if defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
template <BOOST_ASIO_COMPLETION_TOKEN_FOR(signature) CompletionToken>
auto operator()(
BOOST_ASIO_MOVE_ARG(CompletionToken) token) const &
-> decltype(
boost::asio::async_initiate<CompletionToken, signature>(
initiate(), token, head_, tail_))
{
return boost::asio::async_initiate<CompletionToken, signature>(
initiate(), token, head_, tail_);
}
template <typename CompletionToken>
auto operator()(BOOST_ASIO_MOVE_ARG(CompletionToken) token) const &;
#endif // defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
};

View File

@ -2,7 +2,7 @@
// detached.hpp
// ~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/array.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/array_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/assert.hpp
// ~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/atomic_count.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/base_from_cancellation_state.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/base_from_completion_cond.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/bind_handler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -950,9 +950,18 @@ struct associator<Associator,
detail::binder0<Handler>, DefaultCandidate>
: Associator<Handler, DefaultCandidate>
{
static typename Associator<Handler, DefaultCandidate>::type get(
const detail::binder0<Handler>& h,
const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
static typename Associator<Handler, DefaultCandidate>::type
get(const detail::binder0<Handler>& h) BOOST_ASIO_NOEXCEPT
{
return Associator<Handler, DefaultCandidate>::get(h.handler_);
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<Handler, DefaultCandidate>::type)
get(const detail::binder0<Handler>& h,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<Handler, DefaultCandidate>::get(h.handler_, c)))
{
return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
}
@ -964,9 +973,18 @@ struct associator<Associator,
detail::binder1<Handler, Arg1>, DefaultCandidate>
: Associator<Handler, DefaultCandidate>
{
static typename Associator<Handler, DefaultCandidate>::type get(
const detail::binder1<Handler, Arg1>& h,
const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
static typename Associator<Handler, DefaultCandidate>::type
get(const detail::binder1<Handler, Arg1>& h) BOOST_ASIO_NOEXCEPT
{
return Associator<Handler, DefaultCandidate>::get(h.handler_);
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<Handler, DefaultCandidate>::type)
get(const detail::binder1<Handler, Arg1>& h,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<Handler, DefaultCandidate>::get(h.handler_, c)))
{
return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
}
@ -979,9 +997,18 @@ struct associator<Associator,
detail::binder2<Handler, Arg1, Arg2>, DefaultCandidate>
: Associator<Handler, DefaultCandidate>
{
static typename Associator<Handler, DefaultCandidate>::type get(
const detail::binder2<Handler, Arg1, Arg2>& h,
const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
static typename Associator<Handler, DefaultCandidate>::type
get(const detail::binder2<Handler, Arg1, Arg2>& h) BOOST_ASIO_NOEXCEPT
{
return Associator<Handler, DefaultCandidate>::get(h.handler_);
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<Handler, DefaultCandidate>::type)
get(const detail::binder2<Handler, Arg1, Arg2>& h,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<Handler, DefaultCandidate>::get(h.handler_, c)))
{
return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
}
@ -994,9 +1021,18 @@ struct associator<Associator,
detail::binder3<Handler, Arg1, Arg2, Arg3>, DefaultCandidate>
: Associator<Handler, DefaultCandidate>
{
static typename Associator<Handler, DefaultCandidate>::type get(
const detail::binder3<Handler, Arg1, Arg2, Arg3>& h,
const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
static typename Associator<Handler, DefaultCandidate>::type
get(const detail::binder3<Handler, Arg1, Arg2, Arg3>& h) BOOST_ASIO_NOEXCEPT
{
return Associator<Handler, DefaultCandidate>::get(h.handler_);
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<Handler, DefaultCandidate>::type)
get(const detail::binder3<Handler, Arg1, Arg2, Arg3>& h,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<Handler, DefaultCandidate>::get(h.handler_, c)))
{
return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
}
@ -1009,9 +1045,19 @@ struct associator<Associator,
detail::binder4<Handler, Arg1, Arg2, Arg3, Arg4>, DefaultCandidate>
: Associator<Handler, DefaultCandidate>
{
static typename Associator<Handler, DefaultCandidate>::type get(
const detail::binder4<Handler, Arg1, Arg2, Arg3, Arg4>& h,
const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
static typename Associator<Handler, DefaultCandidate>::type
get(const detail::binder4<Handler, Arg1, Arg2, Arg3, Arg4>& h)
BOOST_ASIO_NOEXCEPT
{
return Associator<Handler, DefaultCandidate>::get(h.handler_);
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<Handler, DefaultCandidate>::type)
get(const detail::binder4<Handler, Arg1, Arg2, Arg3, Arg4>& h,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<Handler, DefaultCandidate>::get(h.handler_, c)))
{
return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
}
@ -1024,9 +1070,19 @@ struct associator<Associator,
detail::binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>, DefaultCandidate>
: Associator<Handler, DefaultCandidate>
{
static typename Associator<Handler, DefaultCandidate>::type get(
const detail::binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>& h,
const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
static typename Associator<Handler, DefaultCandidate>::type
get(const detail::binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>& h)
BOOST_ASIO_NOEXCEPT
{
return Associator<Handler, DefaultCandidate>::get(h.handler_);
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<Handler, DefaultCandidate>::type)
get(const detail::binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>& h,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<Handler, DefaultCandidate>::get(h.handler_, c)))
{
return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
}
@ -1040,9 +1096,18 @@ struct associator<Associator,
detail::move_binder1<Handler, Arg1>, DefaultCandidate>
: Associator<Handler, DefaultCandidate>
{
static typename Associator<Handler, DefaultCandidate>::type get(
const detail::move_binder1<Handler, Arg1>& h,
const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
static typename Associator<Handler, DefaultCandidate>::type
get(const detail::move_binder1<Handler, Arg1>& h) BOOST_ASIO_NOEXCEPT
{
return Associator<Handler, DefaultCandidate>::get(h.handler_);
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<Handler, DefaultCandidate>::type)
get(const detail::move_binder1<Handler, Arg1>& h,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<Handler, DefaultCandidate>::get(h.handler_, c)))
{
return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
}
@ -1055,9 +1120,18 @@ struct associator<Associator,
detail::move_binder2<Handler, Arg1, Arg2>, DefaultCandidate>
: Associator<Handler, DefaultCandidate>
{
static typename Associator<Handler, DefaultCandidate>::type get(
const detail::move_binder2<Handler, Arg1, Arg2>& h,
const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
static typename Associator<Handler, DefaultCandidate>::type
get(const detail::move_binder2<Handler, Arg1, Arg2>& h) BOOST_ASIO_NOEXCEPT
{
return Associator<Handler, DefaultCandidate>::get(h.handler_);
}
static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
typename Associator<Handler, DefaultCandidate>::type)
get(const detail::move_binder2<Handler, Arg1, Arg2>& h,
const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
Associator<Handler, DefaultCandidate>::get(h.handler_, c)))
{
return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
}

View File

@ -2,7 +2,7 @@
// detail/blocking_executor_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -78,6 +78,7 @@ public:
const boost::system::error_code& /*ec*/,
std::size_t /*bytes_transferred*/)
{
BOOST_ASIO_ASSUME(base != 0);
blocking_executor_op* o(static_cast<blocking_executor_op*>(base));
typename blocking_executor_op_base<Operation>::do_complete_cleanup

View File

@ -2,7 +2,7 @@
// detail/buffer_resize_guard.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/buffer_sequence_adapter.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/buffered_stream_storage.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/bulk_executor_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -50,6 +50,7 @@ public:
std::size_t /*bytes_transferred*/)
{
// Take ownership of the handler object.
BOOST_ASIO_ASSUME(base != 0);
bulk_executor_op* o(static_cast<bulk_executor_op*>(base));
Alloc allocator(o->allocator_);
ptr p = { detail::addressof(allocator), o, o };

View File

@ -2,7 +2,7 @@
// detail/call_stack.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/chrono.hpp
// ~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/chrono_time_traits.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/completion_handler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -0,0 +1,330 @@
//
// detail/composed_work.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2023 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)
//
#ifndef BOOST_ASIO_DETAIL_COMPOSED_WORK_HPP
#define BOOST_ASIO_DETAIL_COMPOSED_WORK_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <boost/asio/detail/config.hpp>
#include <boost/asio/detail/type_traits.hpp>
#include <boost/asio/detail/variadic_templates.hpp>
#include <boost/asio/execution/executor.hpp>
#include <boost/asio/execution/outstanding_work.hpp>
#include <boost/asio/executor_work_guard.hpp>
#include <boost/asio/is_executor.hpp>
#include <boost/asio/system_executor.hpp>
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
namespace detail {
template <typename Executor, typename = void>
class composed_work_guard
{
public:
typedef typename decay<
typename prefer_result<Executor,
execution::outstanding_work_t::tracked_t
>::type
>::type executor_type;
composed_work_guard(const Executor& ex)
: executor_(boost::asio::prefer(ex, execution::outstanding_work.tracked))
{
}
void reset()
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return executor_;
}
private:
executor_type executor_;
};
template <>
struct composed_work_guard<system_executor>
{
public:
typedef system_executor executor_type;
composed_work_guard(const system_executor&)
{
}
void reset()
{
}
executor_type get_executor() const BOOST_ASIO_NOEXCEPT
{
return system_executor();
}
};
#if !defined(BOOST_ASIO_NO_TS_EXECUTORS)
template <typename Executor>
struct composed_work_guard<Executor,
typename enable_if<
!execution::is_executor<Executor>::value
>::type> : executor_work_guard<Executor>
{
composed_work_guard(const Executor& ex)
: executor_work_guard<Executor>(ex)
{
}
};
#endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS)
template <typename>
struct composed_io_executors;
template <>
struct composed_io_executors<void()>
{
composed_io_executors() BOOST_ASIO_NOEXCEPT
: head_(system_executor())
{
}
typedef system_executor head_type;
system_executor head_;
};
inline composed_io_executors<void()> make_composed_io_executors()
{
return composed_io_executors<void()>();
}
template <typename Head>
struct composed_io_executors<void(Head)>
{
explicit composed_io_executors(const Head& ex) BOOST_ASIO_NOEXCEPT
: head_(ex)
{
}
typedef Head head_type;
Head head_;
};
template <typename Head>
inline composed_io_executors<void(Head)>
make_composed_io_executors(const Head& head)
{
return composed_io_executors<void(Head)>(head);
}
#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename Head, typename... Tail>
struct composed_io_executors<void(Head, Tail...)>
{
explicit composed_io_executors(const Head& head,
const Tail&... tail) BOOST_ASIO_NOEXCEPT
: head_(head),
tail_(tail...)
{
}
void reset()
{
head_.reset();
tail_.reset();
}
typedef Head head_type;
Head head_;
composed_io_executors<void(Tail...)> tail_;
};
template <typename Head, typename... Tail>
inline composed_io_executors<void(Head, Tail...)>
make_composed_io_executors(const Head& head, const Tail&... tail)
{
return composed_io_executors<void(Head, Tail...)>(head, tail...);
}
#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
#define BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF(n) \
template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
struct composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
{ \
explicit composed_io_executors(const Head& head, \
BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) BOOST_ASIO_NOEXCEPT \
: head_(head), \
tail_(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)) \
{ \
} \
\
void reset() \
{ \
head_.reset(); \
tail_.reset(); \
} \
\
typedef Head head_type; \
Head head_; \
composed_io_executors<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \
}; \
\
template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
inline composed_io_executors<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
make_composed_io_executors(const Head& head, \
BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n)) \
{ \
return composed_io_executors< \
void(Head, BOOST_ASIO_VARIADIC_TARGS(n))>( \
head, BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)); \
} \
/**/
BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF)
#undef BOOST_ASIO_PRIVATE_COMPOSED_IO_EXECUTORS_DEF
#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename>
struct composed_work;
template <>
struct composed_work<void()>
{
typedef composed_io_executors<void()> executors_type;
composed_work(const executors_type&) BOOST_ASIO_NOEXCEPT
: head_(system_executor())
{
}
void reset()
{
head_.reset();
}
typedef system_executor head_type;
composed_work_guard<system_executor> head_;
};
template <typename Head>
struct composed_work<void(Head)>
{
typedef composed_io_executors<void(Head)> executors_type;
explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT
: head_(ex.head_)
{
}
void reset()
{
head_.reset();
}
typedef Head head_type;
composed_work_guard<Head> head_;
};
#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename Head, typename... Tail>
struct composed_work<void(Head, Tail...)>
{
typedef composed_io_executors<void(Head, Tail...)> executors_type;
explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT
: head_(ex.head_),
tail_(ex.tail_)
{
}
void reset()
{
head_.reset();
tail_.reset();
}
typedef Head head_type;
composed_work_guard<Head> head_;
composed_work<void(Tail...)> tail_;
};
#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
#define BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF(n) \
template <typename Head, BOOST_ASIO_VARIADIC_TPARAMS(n)> \
struct composed_work<void(Head, BOOST_ASIO_VARIADIC_TARGS(n))> \
{ \
typedef composed_io_executors<void(Head, \
BOOST_ASIO_VARIADIC_TARGS(n))> executors_type; \
\
explicit composed_work(const executors_type& ex) BOOST_ASIO_NOEXCEPT \
: head_(ex.head_), \
tail_(ex.tail_) \
{ \
} \
\
void reset() \
{ \
head_.reset(); \
tail_.reset(); \
} \
\
typedef Head head_type; \
composed_work_guard<Head> head_; \
composed_work<void(BOOST_ASIO_VARIADIC_TARGS(n))> tail_; \
}; \
/**/
BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF)
#undef BOOST_ASIO_PRIVATE_COMPOSED_WORK_DEF
#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
template <typename IoObject>
inline typename IoObject::executor_type
get_composed_io_executor(IoObject& io_object,
typename enable_if<
!is_executor<IoObject>::value
>::type* = 0,
typename enable_if<
!execution::is_executor<IoObject>::value
>::type* = 0)
{
return io_object.get_executor();
}
template <typename Executor>
inline const Executor& get_composed_io_executor(const Executor& ex,
typename enable_if<
is_executor<Executor>::value
|| execution::is_executor<Executor>::value
>::type* = 0)
{
return ex;
}
} // namespace detail
} // namespace asio
} // namespace boost
#include <boost/asio/detail/pop_options.hpp>
#endif // BOOST_ASIO_DETAIL_COMPOSED_WORK_HPP

View File

@ -2,7 +2,7 @@
// detail/concurrency_hint.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/conditionally_enabled_event.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/conditionally_enabled_mutex.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/config.hpp
// ~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -135,6 +135,7 @@
# define BOOST_ASIO_MOVE_CAST(type) static_cast<type&&>
# define BOOST_ASIO_MOVE_CAST2(type1, type2) static_cast<type1, type2&&>
# define BOOST_ASIO_MOVE_OR_LVALUE(type) static_cast<type&&>
# define BOOST_ASIO_MOVE_OR_LVALUE_ARG(type) type&&
# define BOOST_ASIO_MOVE_OR_LVALUE_TYPE(type) type
#endif // defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST)
@ -163,6 +164,7 @@
# define BOOST_ASIO_MOVE_CAST(type) static_cast<const type&>
# define BOOST_ASIO_MOVE_CAST2(type1, type2) static_cast<const type1, type2&>
# define BOOST_ASIO_MOVE_OR_LVALUE(type)
# define BOOST_ASIO_MOVE_OR_LVALUE_ARG(type) type&
# define BOOST_ASIO_MOVE_OR_LVALUE_TYPE(type) type&
#endif // !defined(BOOST_ASIO_MOVE_CAST)
@ -371,6 +373,17 @@
# endif // defined(BOOST_ASIO_MSVC)
# endif // !defined(BOOST_ASIO_DISABLE_DECLTYPE)
#endif // !defined(BOOST_ASIO_HAS_DECLTYPE)
#if defined(BOOST_ASIO_HAS_DECLTYPE)
# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(t) auto
# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(t0, t1) auto
# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX3(t0, t1, t2) auto
# define BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(expr) -> decltype expr
#else // defined(BOOST_ASIO_HAS_DECLTYPE)
# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(t) t
# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(t0, t1) t0, t1
# define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX3(t0, t1, t2) t0, t1, t2
# define BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(expr)
#endif // defined(BOOST_ASIO_HAS_DECLTYPE)
// Support alias templates on compilers known to allow it.
#if !defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES)
@ -407,7 +420,11 @@
# if (__cpp_return_type_deduction >= 201304)
# define BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION 1
# endif // (__cpp_return_type_deduction >= 201304)
# endif // defined(__cpp_return_type_deduction)
# elif defined(BOOST_ASIO_MSVC)
# if (_MSC_VER >= 1900 && _MSVC_LANG >= 201402)
# define BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION 1
# endif // (_MSC_VER >= 1900 && _MSVC_LANG >= 201402)
# endif // defined(BOOST_ASIO_MSVC)
# endif // !defined(BOOST_ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
#endif // !defined(BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION)
@ -630,6 +647,19 @@
# define BOOST_ASIO_DEFAULT_ALIGN 1
#endif // defined(BOOST_ASIO_HAS_ALIGNOF)
// Support for user-defined literals.
#if !defined(BOOST_ASIO_HAS_USER_DEFINED_LITERALS)
# if !defined(BOOST_ASIO_DISABLE_USER_DEFINED_LITERALS)
# if (__cplusplus >= 201103)
# define BOOST_ASIO_HAS_USER_DEFINED_LITERALS 1
# elif defined(BOOST_ASIO_MSVC)
# if (_MSC_VER >= 1900 && _MSVC_LANG >= 201103)
# define BOOST_ASIO_HAS_USER_DEFINED_LITERALS 1
# endif // (_MSC_VER >= 1900 && _MSVC_LANG >= 201103)
# endif // defined(BOOST_ASIO_MSVC)
# endif // !defined(BOOST_ASIO_DISABLE_USER_DEFINED_LITERALS)
#endif // !defined(BOOST_ASIO_HAS_USER_DEFINED_LITERALS)
// Standard library support for aligned allocation.
#if !defined(BOOST_ASIO_HAS_STD_ALIGNED_ALLOC)
# if !defined(BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC)
@ -675,6 +705,30 @@
# endif // !defined(BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC)
#endif // !defined(BOOST_ASIO_HAS_STD_ALIGNED_ALLOC)
// Standard library support for std::align.
#if !defined(BOOST_ASIO_HAS_STD_ALIGN)
# if !defined(BOOST_ASIO_DISABLE_STD_ALIGN)
# if defined(__clang__)
# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
# define BOOST_ASIO_HAS_STD_ALIGN 1
# elif (__cplusplus >= 201103)
# define BOOST_ASIO_HAS_STD_ALIGN 1
# endif // (__cplusplus >= 201103)
# elif defined(__GNUC__)
# if (__GNUC__ >= 6)
# if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
# define BOOST_ASIO_HAS_STD_ALIGN 1
# endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
# endif // (__GNUC__ >= 6)
# endif // defined(__GNUC__)
# if defined(BOOST_ASIO_MSVC)
# if (_MSC_VER >= 1700)
# define BOOST_ASIO_HAS_STD_ALIGN 1
# endif // (_MSC_VER >= 1700)
# endif // defined(BOOST_ASIO_MSVC)
# endif // !defined(BOOST_ASIO_DISABLE_STD_ALIGN)
#endif // !defined(BOOST_ASIO_HAS_STD_ALIGN)
// Standard library support for system errors.
# if !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR)
# if defined(__clang__)
@ -1311,14 +1365,11 @@
# if (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
# define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1
# endif // (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
# else // defined(BOOST_ASIO_MSVC)
# if (__cplusplus >= 201703)
# define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1
# endif // (__cplusplus >= 201703)
# endif // defined(BOOST_ASIO_MSVC)
# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
# if (_LIBCPP_VERSION >= 13000)
# if (__cplusplus >= 201703)
# define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1
# endif // (__cplusplus >= 201703)
# endif // (_LIBCPP_VERSION >= 13000)
# endif // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
# endif // !defined(BOOST_ASIO_DISABLE_STD_INVOKE_RESULT)
#endif // !defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
@ -1394,6 +1445,30 @@
# endif // !defined(BOOST_ASIO_DISABLE_STD_ANY)
#endif // !defined(BOOST_ASIO_HAS_STD_ANY)
// Standard library support for std::variant.
#if !defined(BOOST_ASIO_HAS_STD_VARIANT)
# if !defined(BOOST_ASIO_DISABLE_STD_VARIANT)
# if defined(__clang__)
# if (__cplusplus >= 201703)
# if __has_include(<variant>)
# define BOOST_ASIO_HAS_STD_VARIANT 1
# endif // __has_include(<variant>)
# endif // (__cplusplus >= 201703)
# elif defined(__GNUC__)
# if (__GNUC__ >= 7)
# if (__cplusplus >= 201703)
# define BOOST_ASIO_HAS_STD_VARIANT 1
# endif // (__cplusplus >= 201703)
# endif // (__GNUC__ >= 7)
# endif // defined(__GNUC__)
# if defined(BOOST_ASIO_MSVC)
# if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
# define BOOST_ASIO_HAS_STD_VARIANT 1
# endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
# endif // defined(BOOST_ASIO_MSVC)
# endif // !defined(BOOST_ASIO_DISABLE_STD_VARIANT)
#endif // !defined(BOOST_ASIO_HAS_STD_VARIANT)
// Standard library support for std::source_location.
#if !defined(BOOST_ASIO_HAS_STD_SOURCE_LOCATION)
# if !defined(BOOST_ASIO_DISABLE_STD_SOURCE_LOCATION)
@ -2042,6 +2117,22 @@
# define BOOST_ASIO_UNUSED_VARIABLE
#endif // !defined(BOOST_ASIO_UNUSED_VARIABLE)
// Helper macro to tell the optimiser what may be assumed to be true.
#if defined(BOOST_ASIO_MSVC)
# define BOOST_ASIO_ASSUME(expr) __assume(expr)
#elif defined(__clang__)
# if __has_builtin(__builtin_assume)
# define BOOST_ASIO_ASSUME(expr) __builtin_assume(expr)
# endif // __has_builtin(__builtin_assume)
#elif defined(__GNUC__)
# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
# define BOOST_ASIO_ASSUME(expr) if (expr) {} else { __builtin_unreachable(); }
# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
#endif // defined(__GNUC__)
#if !defined(BOOST_ASIO_ASSUME)
# define BOOST_ASIO_ASSUME(expr) (void)0
#endif // !defined(BOOST_ASIO_ASSUME)
// Support the co_await keyword on compilers known to allow it.
#if !defined(BOOST_ASIO_HAS_CO_AWAIT)
# if !defined(BOOST_ASIO_DISABLE_CO_AWAIT)
@ -2054,11 +2145,23 @@
# endif // defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
# endif // (_MSC_FULL_VER >= 190023506)
# elif defined(__clang__)
# if (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
# if __has_include(<experimental/coroutine>)
# define BOOST_ASIO_HAS_CO_AWAIT 1
# endif // __has_include(<experimental/coroutine>)
# endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
# if (__clang_major__ >= 14)
# if (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
# if __has_include(<coroutine>)
# define BOOST_ASIO_HAS_CO_AWAIT 1
# endif // __has_include(<coroutine>)
# elif (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
# if __has_include(<experimental/coroutine>)
# define BOOST_ASIO_HAS_CO_AWAIT 1
# endif // __has_include(<experimental/coroutine>)
# endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
# else // (__clang_major__ >= 14)
# if (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
# if __has_include(<experimental/coroutine>)
# define BOOST_ASIO_HAS_CO_AWAIT 1
# endif // __has_include(<experimental/coroutine>)
# endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
# endif // (__clang_major__ >= 14)
# elif defined(__GNUC__)
# if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
# if __has_include(<coroutine>)
@ -2076,8 +2179,15 @@
# if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705)
# define BOOST_ASIO_HAS_STD_COROUTINE 1
# endif // (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705)
# endif // defined(BOOST_ASIO_MSVC)
# if defined(__GNUC__)
# elif defined(__clang__)
# if (__clang_major__ >= 14)
# if (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
# if __has_include(<coroutine>)
# define BOOST_ASIO_HAS_STD_COROUTINE 1
# endif // __has_include(<coroutine>)
# endif // (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
# endif // (__clang_major__ >= 14)
# elif defined(__GNUC__)
# if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
# if __has_include(<coroutine>)
# define BOOST_ASIO_HAS_STD_COROUTINE 1
@ -2158,4 +2268,15 @@
# endif // !defined(BOOST_ASIO_DISABLE_STD_TO_ADDRESS)
#endif // !defined(BOOST_ASIO_HAS_STD_TO_ADDRESS)
// Standard library support for snprintf.
#if !defined(BOOST_ASIO_HAS_SNPRINTF)
# if !defined(BOOST_ASIO_DISABLE_SNPRINTF)
# if defined(__apple_build_version__)
# if (__clang_major__ >= 14)
# define BOOST_ASIO_HAS_SNPRINTF 1
# endif // (__clang_major__ >= 14)
# endif // defined(__apple_build_version__)
# endif // !defined(BOOST_ASIO_DISABLE_SNPRINTF)
#endif // !defined(BOOST_ASIO_HAS_SNPRINTF)
#endif // BOOST_ASIO_DETAIL_CONFIG_HPP

View File

@ -2,7 +2,7 @@
// detail/consuming_buffers.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/cstddef.hpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/cstdint.hpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/date_time_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/deadline_timer_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/dependent_type.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/descriptor_ops.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/descriptor_read_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -26,6 +26,7 @@
#include <boost/asio/detail/handler_work.hpp>
#include <boost/asio/detail/memory.hpp>
#include <boost/asio/detail/reactor_op.hpp>
#include <boost/asio/dispatch.hpp>
#include <boost/asio/detail/push_options.hpp>
@ -49,6 +50,7 @@ public:
static status do_perform(reactor_op* base)
{
BOOST_ASIO_ASSUME(base != 0);
descriptor_read_op_base* o(static_cast<descriptor_read_op_base*>(base));
typedef buffer_sequence_adapter<boost::asio::mutable_buffer,
@ -86,6 +88,9 @@ class descriptor_read_op
: public descriptor_read_op_base<MutableBufferSequence>
{
public:
typedef Handler handler_type;
typedef IoExecutor io_executor_type;
BOOST_ASIO_DEFINE_HANDLER_PTR(descriptor_read_op);
descriptor_read_op(const boost::system::error_code& success_ec,
@ -103,6 +108,7 @@ public:
std::size_t /*bytes_transferred*/)
{
// Take ownership of the handler object.
BOOST_ASIO_ASSUME(base != 0);
descriptor_read_op* o(static_cast<descriptor_read_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
@ -136,6 +142,38 @@ public:
}
}
static void do_immediate(operation* base, bool, const void* io_ex)
{
// Take ownership of the handler object.
BOOST_ASIO_ASSUME(base != 0);
descriptor_read_op* o(static_cast<descriptor_read_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
BOOST_ASIO_HANDLER_COMPLETION((*o));
// Take ownership of the operation's outstanding work.
immediate_handler_work<Handler, IoExecutor> w(
BOOST_ASIO_MOVE_CAST2(handler_work<Handler, IoExecutor>)(
o->work_));
BOOST_ASIO_ERROR_LOCATION(o->ec_);
// Make a copy of the handler so that the memory can be deallocated before
// the upcall is made. Even if we're not about to make an upcall, a
// sub-object of the handler may be the true owner of the memory associated
// with the handler. Consequently, a local copy of the handler is required
// to ensure that any owning sub-object remains valid until after we have
// deallocated the memory here.
detail::binder2<Handler, boost::system::error_code, std::size_t>
handler(o->handler_, o->ec_, o->bytes_transferred_);
p.h = boost::asio::detail::addressof(handler.handler_);
p.reset();
BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
w.complete(handler, handler.handler_, io_ex);
BOOST_ASIO_HANDLER_INVOCATION_END;
}
private:
Handler handler_;
handler_work<Handler, IoExecutor> work_;

View File

@ -2,7 +2,7 @@
// detail/descriptor_write_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -49,6 +49,7 @@ public:
static status do_perform(reactor_op* base)
{
BOOST_ASIO_ASSUME(base != 0);
descriptor_write_op_base* o(static_cast<descriptor_write_op_base*>(base));
typedef buffer_sequence_adapter<boost::asio::const_buffer,
@ -86,6 +87,9 @@ class descriptor_write_op
: public descriptor_write_op_base<ConstBufferSequence>
{
public:
typedef Handler handler_type;
typedef IoExecutor io_executor_type;
BOOST_ASIO_DEFINE_HANDLER_PTR(descriptor_write_op);
descriptor_write_op(const boost::system::error_code& success_ec,
@ -103,6 +107,7 @@ public:
std::size_t /*bytes_transferred*/)
{
// Take ownership of the handler object.
BOOST_ASIO_ASSUME(base != 0);
descriptor_write_op* o(static_cast<descriptor_write_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
@ -136,6 +141,38 @@ public:
}
}
static void do_immediate(operation* base, bool, const void* io_ex)
{
// Take ownership of the handler object.
BOOST_ASIO_ASSUME(base != 0);
descriptor_write_op* o(static_cast<descriptor_write_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
BOOST_ASIO_HANDLER_COMPLETION((*o));
// Take ownership of the operation's outstanding work.
immediate_handler_work<Handler, IoExecutor> w(
BOOST_ASIO_MOVE_CAST2(handler_work<Handler, IoExecutor>)(
o->work_));
BOOST_ASIO_ERROR_LOCATION(o->ec_);
// Make a copy of the handler so that the memory can be deallocated before
// the upcall is made. Even if we're not about to make an upcall, a
// sub-object of the handler may be the true owner of the memory associated
// with the handler. Consequently, a local copy of the handler is required
// to ensure that any owning sub-object remains valid until after we have
// deallocated the memory here.
detail::binder2<Handler, boost::system::error_code, std::size_t>
handler(o->handler_, o->ec_, o->bytes_transferred_);
p.h = boost::asio::detail::addressof(handler.handler_);
p.reset();
BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
w.complete(handler, handler.handler_, io_ex);
BOOST_ASIO_HANDLER_INVOCATION_END;
}
private:
Handler handler_;
handler_work<Handler, IoExecutor> work_;

View File

@ -2,7 +2,7 @@
// detail/dev_poll_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -87,13 +87,31 @@ public:
per_descriptor_data& source_descriptor_data);
// Post a reactor operation for immediate completion.
void post_immediate_completion(reactor_op* op, bool is_continuation);
void post_immediate_completion(operation* op, bool is_continuation) const;
// Post a reactor operation for immediate completion.
BOOST_ASIO_DECL static void call_post_immediate_completion(
operation* op, bool is_continuation, const void* self);
// Start a new operation. The reactor operation will be performed when the
// given descriptor is flagged as ready, or an error has occurred.
BOOST_ASIO_DECL void start_op(int op_type, socket_type descriptor,
per_descriptor_data&, reactor_op* op,
bool is_continuation, bool allow_speculative);
bool is_continuation, bool allow_speculative,
void (*on_immediate)(operation*, bool, const void*),
const void* immediate_arg);
// Start a new operation. The reactor operation will be performed when the
// given descriptor is flagged as ready, or an error has occurred.
void start_op(int op_type, socket_type descriptor,
per_descriptor_data& descriptor_data, reactor_op* op,
bool is_continuation, bool allow_speculative)
{
start_op(op_type, descriptor, descriptor_data,
op, is_continuation, allow_speculative,
&epoll_reactor::call_post_immediate_completion, this);
}
// Cancel all operations associated with the given descriptor. The
// handlers associated with the descriptor will be invoked with the

View File

@ -2,7 +2,7 @@
// detail/epoll_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)
@ -117,13 +117,30 @@ public:
per_descriptor_data& source_descriptor_data);
// Post a reactor operation for immediate completion.
void post_immediate_completion(operation* op, bool is_continuation);
void post_immediate_completion(operation* op, bool is_continuation) const;
// Post a reactor operation for immediate completion.
BOOST_ASIO_DECL static void call_post_immediate_completion(
operation* op, bool is_continuation, const void* self);
// Start a new operation. The reactor operation will be performed when the
// given descriptor is flagged as ready, or an error has occurred.
BOOST_ASIO_DECL void start_op(int op_type, socket_type descriptor,
per_descriptor_data& descriptor_data, reactor_op* op,
bool is_continuation, bool allow_speculative);
bool is_continuation, bool allow_speculative,
void (*on_immediate)(operation*, bool, const void*),
const void* immediate_arg);
// Start a new operation. The reactor operation will be performed when the
// given descriptor is flagged as ready, or an error has occurred.
void start_op(int op_type, socket_type descriptor,
per_descriptor_data& descriptor_data, reactor_op* op,
bool is_continuation, bool allow_speculative)
{
start_op(op_type, descriptor, descriptor_data,
op, is_continuation, allow_speculative,
&epoll_reactor::call_post_immediate_completion, this);
}
// Cancel all operations associated with the given descriptor. The
// handlers associated with the descriptor will be invoked with the

View File

@ -2,7 +2,7 @@
// detail/event.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 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)

View File

@ -2,7 +2,7 @@
// detail/eventfd_select_interrupter.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Roelof Naude (roelof.naude at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying

Some files were not shown because too many files have changed in this diff Show More