diff --git a/doc/platform_macros.qbk b/doc/platform_macros.qbk index 6786e320..61301243 100644 --- a/doc/platform_macros.qbk +++ b/doc/platform_macros.qbk @@ -26,16 +26,16 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_ALIAS_TEMPLATES`] [ - Support alias templates on compilers known to allow it. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_ALIAS_TEMPLATES`] + [] ] [ [`BOOST_ASIO_HAS_ALIGNOF`] [ - Support for the alignof operator. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_ALIGNOF`] + [] ] [ [`BOOST_ASIO_HAS_BOOST_ALIGN`] @@ -166,9 +166,9 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_CONSTEXPR`] [ - Support constexpr on compilers known to allow it. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_CONSTEXPR`] + [] ] [ [`BOOST_ASIO_HAS_CO_AWAIT`] @@ -180,30 +180,30 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_CSTDINT`] [ - Standard library support for the cstdint header. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_CSTDINT`] + [] ] [ [`BOOST_ASIO_HAS_CXX11_ALLOCATORS`] [ - Standard library support for the C++11 allocator additions. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_CXX11_ALLOCATORS`] + [] ] [ [`BOOST_ASIO_HAS_DECLTYPE`] [ - Support automatic type deduction on compilers known to support it. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_DECLTYPE`] + [] ] [ [`BOOST_ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS`] [ - Support default function template arguments on compilers known to allow it. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS`] + [] ] [ [`BOOST_ASIO_HAS_DEV_POLL`] @@ -215,21 +215,21 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_ENUM_CLASS`] [ - Support enum classes on compilers known to allow them. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_ENUM_CLASS`] + [] ] [ [`BOOST_ASIO_HAS_EPOLL`] [ - Linux: epoll, eventfd and timerfd. + Linux: epoll, eventfd, timerfd and io_uring. ] [`BOOST_ASIO_DISABLE_EPOLL`] ] [ [`BOOST_ASIO_HAS_EVENTFD`] [ - Linux: epoll, eventfd and timerfd. + Linux: epoll, eventfd, timerfd and io_uring. ] [`BOOST_ASIO_DISABLE_EVENTFD`] ] @@ -285,9 +285,9 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_MOVE`] [ - Support move construction and assignment on compilers known to allow it. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_MOVE`] + [] ] [ [`BOOST_ASIO_HAS_MSG_NOSIGNAL`] @@ -299,9 +299,9 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_NOEXCEPT`] [ - Support noexcept on compilers known to allow it. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_NOEXCEPT`] + [] ] [ [`BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE`] @@ -313,9 +313,9 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_NULLPTR`] [ - Standard library support for the nullptr_t type. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_NULLPTR`] + [] ] [ [`BOOST_ASIO_HAS_PIPE`] @@ -341,9 +341,9 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS`] [ - Support ref-qualified functions on compilers known to allow it. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_REF_QUALIFIED_FUNCTIONS`] + [] ] [ [`BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION`] @@ -387,6 +387,13 @@ with Boost.Asio's needs. ] [`BOOST_ASIO_DISABLE_SIGNAL`] ] + [ + [`BOOST_ASIO_HAS_SNPRINTF`] + [ + Standard library support for snprintf. + ] + [`BOOST_ASIO_DISABLE_SNPRINTF`] + ] [ [`BOOST_ASIO_HAS_SOURCE_LOCATION`] [ @@ -404,9 +411,16 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_STD_ADDRESSOF`] [ - Standard library support for addressof. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_ADDRESSOF`] + [] + ] + [ + [`BOOST_ASIO_HAS_STD_ALIGN`] + [ + Always enabled. Retained for backwards compatibility in user code. + ] + [] ] [ [`BOOST_ASIO_HAS_STD_ALIGNED_ALLOC`] @@ -418,9 +432,9 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_STD_ALLOCATOR_ARG`] [ - Standard library support for allocator_arg_t. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_ALLOCATOR_ARG`] + [] ] [ [`BOOST_ASIO_HAS_STD_ANY`] @@ -432,39 +446,28 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_STD_ARRAY`] [ - Standard library support for arrays. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_ARRAY`] + [] ] [ [`BOOST_ASIO_HAS_STD_ATOMIC`] [ - Standard library support for atomic operations. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_ATOMIC`] + [] ] [ [`BOOST_ASIO_HAS_STD_CALL_ONCE`] [ - Standard library support for the call_once function. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_CALL_ONCE`] + [] ] [ [`BOOST_ASIO_HAS_STD_CHRONO`] [ - Standard library support for chrono. Some standard libraries (such as the - libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x - drafts, rather than the eventually standardised name of steady_clock. - ] - [`BOOST_ASIO_DISABLE_STD_CHRONO`] - ] - [ - [`BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK`] - [ - Standard library support for chrono. Some standard libraries (such as the - libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x - drafts, rather than the eventually standardised name of steady_clock. + Always enabled. Retained for backwards compatibility in user code. ] [] ] @@ -485,9 +488,9 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_STD_EXCEPTION_PTR`] [ - Standard library support for std::exception_ptr and std::current_exception. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_EXCEPTION_PTR`] + [] ] [ [`BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION`] @@ -506,23 +509,23 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_STD_FUNCTION`] [ - Standard library support for the function class. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_FUNCTION`] + [] ] [ [`BOOST_ASIO_HAS_STD_FUTURE`] [ - Standard library support for futures. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_FUTURE`] + [] ] [ [`BOOST_ASIO_HAS_STD_HASH`] [ - Standard library support for std::hash. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_HASH`] + [] ] [ [`BOOST_ASIO_HAS_STD_INDEX_SEQUENCE`] @@ -541,37 +544,37 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_STD_IOSTREAM_MOVE`] [ - Standard library support for iostream move construction and assignment. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_IOSTREAM_MOVE`] + [] ] [ [`BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR`] [ - Standard library support for the mutex and condition variable classes. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_MUTEX_AND_CONDVAR`] + [] ] [ [`BOOST_ASIO_HAS_STD_NESTED_EXCEPTION`] [ - Standard library support for std::nested_exception. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_NESTED_EXCEPTION`] + [] ] [ [`BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER`] [ - Standard library support for the reference_wrapper class. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_REFERENCE_WRAPPER`] + [] ] [ [`BOOST_ASIO_HAS_STD_SHARED_PTR`] [ - Standard library support for shared_ptr and weak_ptr. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_SHARED_PTR`] + [] ] [ [`BOOST_ASIO_HAS_STD_STRING_VIEW`] @@ -583,16 +586,16 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_STD_SYSTEM_ERROR`] [ - Standard library support for system errors. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR`] + [] ] [ [`BOOST_ASIO_HAS_STD_THREAD`] [ - Standard library support for the thread class. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_THREAD`] + [] ] [ [`BOOST_ASIO_HAS_STD_TO_ADDRESS`] @@ -604,16 +607,23 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_STD_TUPLE`] [ - Standard library support for std::tuple. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_TUPLE`] + [] ] [ [`BOOST_ASIO_HAS_STD_TYPE_TRAITS`] [ - Standard library support for type traits. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_STD_TYPE_TRAITS`] + [] + ] + [ + [`BOOST_ASIO_HAS_STD_VARIANT`] + [ + Standard library support for std::variant. + ] + [`BOOST_ASIO_DISABLE_STD_VARIANT`] ] [ [`BOOST_ASIO_HAS_STRING_VIEW`] @@ -632,14 +642,14 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION`] [ - Support for the __thread keyword extension. + Support for the __thread keyword extension, or equivalent. ] [`BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION`] ] [ [`BOOST_ASIO_HAS_TIMERFD`] [ - Linux: epoll, eventfd and timerfd. + Linux: epoll, eventfd, timerfd and io_uring. ] [] ] @@ -652,6 +662,13 @@ with Boost.Asio's needs. ] [] ] + [ + [`BOOST_ASIO_HAS_USER_DEFINED_LITERALS`] + [ + Always enabled. Retained for backwards compatibility in user code. + ] + [] + ] [ [`BOOST_ASIO_HAS_VARIABLE_TEMPLATES`] [ @@ -669,9 +686,9 @@ with Boost.Asio's needs. [ [`BOOST_ASIO_HAS_VARIADIC_TEMPLATES`] [ - Support variadic templates on compilers known to allow it. + Always enabled. Retained for backwards compatibility in user code. ] - [`BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES`] + [] ] [ [`BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE`] diff --git a/include/boost/asio/any_completion_executor.hpp b/include/boost/asio/any_completion_executor.hpp index a006bbc9..319fab23 100644 --- a/include/boost/asio/any_completion_executor.hpp +++ b/include/boost/asio/any_completion_executor.hpp @@ -76,20 +76,18 @@ public: #endif // !defined(GENERATING_DOCUMENTATION) /// Default constructor. - BOOST_ASIO_DECL any_completion_executor() BOOST_ASIO_NOEXCEPT; + BOOST_ASIO_DECL any_completion_executor() noexcept; /// Construct in an empty state. Equivalent effects to default constructor. - BOOST_ASIO_DECL any_completion_executor(nullptr_t) BOOST_ASIO_NOEXCEPT; + BOOST_ASIO_DECL any_completion_executor(nullptr_t) noexcept; /// Copy constructor. BOOST_ASIO_DECL any_completion_executor( - const any_completion_executor& e) BOOST_ASIO_NOEXCEPT; + const any_completion_executor& e) 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) + any_completion_executor&& e) noexcept; /// Construct to point to the same target as another any_executor. #if defined(GENERATING_DOCUMENTATION) @@ -99,7 +97,7 @@ public: #else // defined(GENERATING_DOCUMENTATION) template any_completion_executor(OtherAnyExecutor e, - typename constraint< + constraint_t< conditional< !is_same::value && is_base_of, false_type >::type::value - >::type = 0) - : base_type(BOOST_ASIO_MOVE_CAST(OtherAnyExecutor)(e)) + > = 0) + : base_type(static_cast(e)) { } #endif // defined(GENERATING_DOCUMENTATION) @@ -123,7 +121,7 @@ public: #else // defined(GENERATING_DOCUMENTATION) template any_completion_executor(std::nothrow_t, OtherAnyExecutor e, - typename constraint< + constraint_t< conditional< !is_same::value && is_base_of, false_type >::type::value - >::type = 0) BOOST_ASIO_NOEXCEPT - : base_type(std::nothrow, BOOST_ASIO_MOVE_CAST(OtherAnyExecutor)(e)) + > = 0) noexcept + : base_type(std::nothrow, static_cast(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; + const any_completion_executor& e) 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) + any_completion_executor&& e) noexcept; /// Construct a polymorphic wrapper for the specified executor. #if defined(GENERATING_DOCUMENTATION) @@ -156,7 +152,7 @@ public: #else // defined(GENERATING_DOCUMENTATION) template any_completion_executor(Executor e, - typename constraint< + constraint_t< conditional< !is_same::value && !is_base_of, false_type >::type::value - >::type = 0) - : base_type(BOOST_ASIO_MOVE_CAST(Executor)(e)) + > = 0) + : base_type(static_cast(e)) { } #endif // defined(GENERATING_DOCUMENTATION) @@ -178,7 +174,7 @@ public: #else // defined(GENERATING_DOCUMENTATION) template any_completion_executor(std::nothrow_t, Executor e, - typename constraint< + constraint_t< conditional< !is_same::value && !is_base_of, false_type >::type::value - >::type = 0) BOOST_ASIO_NOEXCEPT - : base_type(std::nothrow, BOOST_ASIO_MOVE_CAST(Executor)(e)) + > = 0) noexcept + : base_type(std::nothrow, static_cast(e)) { } #endif // defined(GENERATING_DOCUMENTATION) /// Assignment operator. BOOST_ASIO_DECL any_completion_executor& operator=( - const any_completion_executor& e) BOOST_ASIO_NOEXCEPT; + const any_completion_executor& e) 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) + any_completion_executor&& e) noexcept; /// Assignment operator that sets the polymorphic wrapper to the empty state. BOOST_ASIO_DECL any_completion_executor& operator=(nullptr_t); @@ -210,7 +204,7 @@ public: BOOST_ASIO_DECL ~any_completion_executor(); /// Swap targets with another polymorphic wrapper. - BOOST_ASIO_DECL void swap(any_completion_executor& other) BOOST_ASIO_NOEXCEPT; + BOOST_ASIO_DECL void swap(any_completion_executor& other) noexcept; /// Obtain a polymorphic wrapper with the specified property. /** @@ -223,9 +217,9 @@ public: */ template any_completion_executor require(const Property& p, - typename constraint< + constraint_t< traits::require_member::is_valid - >::type = 0) const + > = 0) const { return static_cast(*this).require(p); } @@ -241,9 +235,9 @@ public: */ template any_completion_executor prefer(const Property& p, - typename constraint< + constraint_t< traits::prefer_member::is_valid - >::type = 0) const + > = 0) const { return static_cast(*this).prefer(p); } diff --git a/include/boost/asio/any_completion_handler.hpp b/include/boost/asio/any_completion_handler.hpp index 3164492d..9952008f 100644 --- a/include/boost/asio/any_completion_handler.hpp +++ b/include/boost/asio/any_completion_handler.hpp @@ -12,12 +12,6 @@ #define BOOST_ASIO_ANY_COMPLETION_HANDLER_HPP #include - -#if (defined(BOOST_ASIO_HAS_STD_TUPLE) \ - && defined(BOOST_ASIO_HAS_MOVE) \ - && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)) \ - || defined(GENERATING_DOCUMENTATION) - #include #include #include @@ -42,11 +36,11 @@ class any_completion_handler_impl_base public: template explicit any_completion_handler_impl_base(S&& slot) - : cancel_state_(BOOST_ASIO_MOVE_CAST(S)(slot), enable_total_cancellation()) + : cancel_state_(static_cast(slot), enable_total_cancellation()) { } - cancellation_slot get_cancellation_slot() const BOOST_ASIO_NOEXCEPT + cancellation_slot get_cancellation_slot() const noexcept { return cancel_state_.slot(); } @@ -62,8 +56,8 @@ class any_completion_handler_impl : public: template 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)) + : any_completion_handler_impl_base(static_cast(slot)), + handler_(static_cast(h)) { } @@ -106,7 +100,7 @@ public: 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)); + static_cast(slot), static_cast(h)); uninit_ptr.release(); return ptr; @@ -122,14 +116,14 @@ public: } any_completion_executor executor( - const any_completion_executor& candidate) const BOOST_ASIO_NOEXCEPT + const any_completion_executor& candidate) const noexcept { return any_completion_executor(std::nothrow, (get_associated_executor)(handler_, candidate)); } any_completion_executor immediate_executor( - const any_io_executor& candidate) const BOOST_ASIO_NOEXCEPT + const any_io_executor& candidate) const noexcept { return any_completion_executor(std::nothrow, (get_associated_immediate_executor)(handler_, candidate)); @@ -190,11 +184,11 @@ public: boost::asio::recycling_allocator())}; std::unique_ptr ptr(this, d); - Handler handler(BOOST_ASIO_MOVE_CAST(Handler)(handler_)); + Handler handler(static_cast(handler_)); ptr.reset(); - BOOST_ASIO_MOVE_CAST(Handler)(handler)( - BOOST_ASIO_MOVE_CAST(Args)(args)...); + static_cast(handler)( + static_cast(args)...); } private: @@ -217,14 +211,14 @@ public: void call(any_completion_handler_impl_base* impl, Args... args) const { - call_fn_(impl, BOOST_ASIO_MOVE_CAST(Args)(args)...); + call_fn_(impl, static_cast(args)...); } template static void impl(any_completion_handler_impl_base* impl, Args... args) { static_cast*>(impl)->call( - BOOST_ASIO_MOVE_CAST(Args)(args)...); + static_cast(args)...); } private: @@ -476,7 +470,7 @@ private: detail::any_completion_handler_impl_base* impl_; constexpr any_completion_handler_allocator(int, - const any_completion_handler& h) BOOST_ASIO_NOEXCEPT + const any_completion_handler& h) noexcept : fn_table_(h.fn_table_), impl_(h.impl_) { @@ -498,7 +492,7 @@ public: template constexpr any_completion_handler_allocator( const any_completion_handler_allocator& a) - BOOST_ASIO_NOEXCEPT + noexcept : fn_table_(a.fn_table_), impl_(a.impl_) { @@ -506,14 +500,14 @@ public: /// Equality operator. constexpr bool operator==( - const any_completion_handler_allocator& other) const BOOST_ASIO_NOEXCEPT + const any_completion_handler_allocator& other) const 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 + const any_completion_handler_allocator& other) const noexcept { return fn_table_ != other.fn_table_ || impl_ != other.impl_; } @@ -550,7 +544,7 @@ private: detail::any_completion_handler_impl_base* impl_; constexpr any_completion_handler_allocator(int, - const any_completion_handler& h) BOOST_ASIO_NOEXCEPT + const any_completion_handler& h) noexcept : fn_table_(h.fn_table_), impl_(h.impl_) { @@ -572,7 +566,7 @@ public: template constexpr any_completion_handler_allocator( const any_completion_handler_allocator& a) - BOOST_ASIO_NOEXCEPT + noexcept : fn_table_(a.fn_table_), impl_(a.impl_) { @@ -580,14 +574,14 @@ public: /// Equality operator. constexpr bool operator==( - const any_completion_handler_allocator& other) const BOOST_ASIO_NOEXCEPT + const any_completion_handler_allocator& other) const 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 + const any_completion_handler_allocator& other) const noexcept { return fn_table_ != other.fn_table_ || impl_ != other.impl_; } @@ -652,16 +646,16 @@ public: } /// Construct an @c any_completion_handler to contain the specified target. - template ::type> + template > any_completion_handler(H&& h, - typename constraint< - !is_same::type, any_completion_handler>::value - >::type = 0) + constraint_t< + !is_same, any_completion_handler>::value + > = 0) : fn_table_( &detail::any_completion_handler_fn_table_instance< Handler, Signatures...>::value), impl_(detail::any_completion_handler_impl::create( - (get_associated_cancellation_slot)(h), BOOST_ASIO_MOVE_CAST(H)(h))) + (get_associated_cancellation_slot)(h), static_cast(h))) { } @@ -669,7 +663,7 @@ public: /** * After the operation, the moved-from object @c other has no target. */ - any_completion_handler(any_completion_handler&& other) BOOST_ASIO_NOEXCEPT + any_completion_handler(any_completion_handler&& other) noexcept : fn_table_(other.fn_table_), impl_(other.impl_) { @@ -682,15 +676,15 @@ public: * 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&& other) noexcept { any_completion_handler( - BOOST_ASIO_MOVE_CAST(any_completion_handler)(other)).swap(*this); + static_cast(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& operator=(nullptr_t) noexcept { any_completion_handler().swap(*this); return *this; @@ -704,32 +698,32 @@ public: } /// Test if the polymorphic wrapper is empty. - constexpr explicit operator bool() const BOOST_ASIO_NOEXCEPT + constexpr explicit operator bool() const noexcept { return impl_ != nullptr; } /// Test if the polymorphic wrapper is non-empty. - constexpr bool operator!() const BOOST_ASIO_NOEXCEPT + constexpr bool operator!() const noexcept { return impl_ == nullptr; } /// Swap the content of an @c any_completion_handler with another. - void swap(any_completion_handler& other) BOOST_ASIO_NOEXCEPT + void swap(any_completion_handler& other) 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 + allocator_type get_allocator() const noexcept { return allocator_type(0, *this); } /// Get the associated cancellation slot. - cancellation_slot_type get_cancellation_slot() const BOOST_ASIO_NOEXCEPT + cancellation_slot_type get_cancellation_slot() const noexcept { return impl_->get_cancellation_slot(); } @@ -745,12 +739,12 @@ public: */ template auto operator()(Args&&... args) - -> decltype(fn_table_->call(impl_, BOOST_ASIO_MOVE_CAST(Args)(args)...)) + -> decltype(fn_table_->call(impl_, static_cast(args)...)) { if (detail::any_completion_handler_impl_base* impl = impl_) { impl_ = nullptr; - return fn_table_->call(impl, BOOST_ASIO_MOVE_CAST(Args)(args)...); + return fn_table_->call(impl, static_cast(args)...); } std::bad_function_call ex; boost::asio::detail::throw_exception(ex); @@ -758,28 +752,28 @@ public: /// Equality operator. friend constexpr bool operator==( - const any_completion_handler& a, nullptr_t) BOOST_ASIO_NOEXCEPT + const any_completion_handler& a, nullptr_t) noexcept { return a.impl_ == nullptr; } /// Equality operator. friend constexpr bool operator==( - nullptr_t, const any_completion_handler& b) BOOST_ASIO_NOEXCEPT + nullptr_t, const any_completion_handler& b) noexcept { return nullptr == b.impl_; } /// Inequality operator. friend constexpr bool operator!=( - const any_completion_handler& a, nullptr_t) BOOST_ASIO_NOEXCEPT + const any_completion_handler& a, nullptr_t) noexcept { return a.impl_ != nullptr; } /// Inequality operator. friend constexpr bool operator!=( - nullptr_t, const any_completion_handler& b) BOOST_ASIO_NOEXCEPT + nullptr_t, const any_completion_handler& b) noexcept { return nullptr != b.impl_; } @@ -791,7 +785,7 @@ struct associated_executor, Candidate> using type = any_completion_executor; static type get(const any_completion_handler& handler, - const Candidate& candidate = Candidate()) BOOST_ASIO_NOEXCEPT + const Candidate& candidate = Candidate()) noexcept { return handler.fn_table_->executor(handler.impl_, any_completion_executor(std::nothrow, candidate)); @@ -805,7 +799,7 @@ struct associated_immediate_executor< using type = any_completion_executor; static type get(const any_completion_handler& handler, - const Candidate& candidate = Candidate()) BOOST_ASIO_NOEXCEPT + const Candidate& candidate = Candidate()) noexcept { return handler.fn_table_->immediate_executor(handler.impl_, any_io_executor(std::nothrow, candidate)); @@ -817,9 +811,4 @@ struct associated_immediate_executor< #include -#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 diff --git a/include/boost/asio/any_io_executor.hpp b/include/boost/asio/any_io_executor.hpp index 12e0008b..4d6a058d 100644 --- a/include/boost/asio/any_io_executor.hpp +++ b/include/boost/asio/any_io_executor.hpp @@ -88,18 +88,16 @@ public: #endif // !defined(GENERATING_DOCUMENTATION) /// Default constructor. - BOOST_ASIO_DECL any_io_executor() BOOST_ASIO_NOEXCEPT; + BOOST_ASIO_DECL any_io_executor() noexcept; /// Construct in an empty state. Equivalent effects to default constructor. - BOOST_ASIO_DECL any_io_executor(nullptr_t) BOOST_ASIO_NOEXCEPT; + BOOST_ASIO_DECL any_io_executor(nullptr_t) noexcept; /// Copy constructor. - BOOST_ASIO_DECL any_io_executor(const any_io_executor& e) BOOST_ASIO_NOEXCEPT; + BOOST_ASIO_DECL any_io_executor(const any_io_executor& e) noexcept; -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move constructor. - BOOST_ASIO_DECL any_io_executor(any_io_executor&& e) BOOST_ASIO_NOEXCEPT; -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + BOOST_ASIO_DECL any_io_executor(any_io_executor&& e) noexcept; /// Construct to point to the same target as another any_executor. #if defined(GENERATING_DOCUMENTATION) @@ -108,8 +106,8 @@ public: #else // defined(GENERATING_DOCUMENTATION) template any_io_executor(OtherAnyExecutor e, - typename constraint< - conditional< + constraint_t< + conditional_t< !is_same::value && is_base_of::value, @@ -117,9 +115,9 @@ public: 0, supportable_properties_type>::template is_valid_target, false_type - >::type::value - >::type = 0) - : base_type(BOOST_ASIO_MOVE_CAST(OtherAnyExecutor)(e)) + >::value + > = 0) + : base_type(static_cast(e)) { } #endif // defined(GENERATING_DOCUMENTATION) @@ -132,8 +130,8 @@ public: #else // defined(GENERATING_DOCUMENTATION) template any_io_executor(std::nothrow_t, OtherAnyExecutor e, - typename constraint< - conditional< + constraint_t< + conditional_t< !is_same::value && is_base_of::value, @@ -141,22 +139,19 @@ public: 0, supportable_properties_type>::template is_valid_target, false_type - >::type::value - >::type = 0) BOOST_ASIO_NOEXCEPT - : base_type(std::nothrow, BOOST_ASIO_MOVE_CAST(OtherAnyExecutor)(e)) + >::value + > = 0) noexcept + : base_type(std::nothrow, static_cast(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; + const any_io_executor& e) 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) + BOOST_ASIO_DECL any_io_executor(std::nothrow_t, any_io_executor&& e) noexcept; /// Construct a polymorphic wrapper for the specified executor. #if defined(GENERATING_DOCUMENTATION) @@ -165,17 +160,17 @@ public: #else // defined(GENERATING_DOCUMENTATION) template any_io_executor(Executor e, - typename constraint< - conditional< + constraint_t< + conditional_t< !is_same::value && !is_base_of::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)) + >::value + > = 0) + : base_type(static_cast(e)) { } #endif // defined(GENERATING_DOCUMENTATION) @@ -187,30 +182,27 @@ public: #else // defined(GENERATING_DOCUMENTATION) template any_io_executor(std::nothrow_t, Executor e, - typename constraint< - conditional< + constraint_t< + conditional_t< !is_same::value && !is_base_of::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)) + >::value + > = 0) noexcept + : base_type(std::nothrow, static_cast(e)) { } #endif // defined(GENERATING_DOCUMENTATION) /// Assignment operator. BOOST_ASIO_DECL any_io_executor& operator=( - const any_io_executor& e) BOOST_ASIO_NOEXCEPT; + const any_io_executor& e) noexcept; -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move assignment operator. - BOOST_ASIO_DECL any_io_executor& operator=( - any_io_executor&& e) BOOST_ASIO_NOEXCEPT; -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + BOOST_ASIO_DECL any_io_executor& operator=(any_io_executor&& e) noexcept; /// Assignment operator that sets the polymorphic wrapper to the empty state. BOOST_ASIO_DECL any_io_executor& operator=(nullptr_t); @@ -219,7 +211,7 @@ public: BOOST_ASIO_DECL ~any_io_executor(); /// Swap targets with another polymorphic wrapper. - BOOST_ASIO_DECL void swap(any_io_executor& other) BOOST_ASIO_NOEXCEPT; + BOOST_ASIO_DECL void swap(any_io_executor& other) noexcept; /// Obtain a polymorphic wrapper with the specified property. /** @@ -232,9 +224,9 @@ public: */ template any_io_executor require(const Property& p, - typename constraint< + constraint_t< traits::require_member::is_valid - >::type = 0) const + > = 0) const { return static_cast(*this).require(p); } @@ -250,9 +242,9 @@ public: */ template any_io_executor prefer(const Property& p, - typename constraint< + constraint_t< traits::prefer_member::is_valid - >::type = 0) const + > = 0) const { return static_cast(*this).prefer(p); } diff --git a/include/boost/asio/append.hpp b/include/boost/asio/append.hpp index 7b34641c..fc3d8624 100644 --- a/include/boost/asio/append.hpp +++ b/include/boost/asio/append.hpp @@ -16,11 +16,6 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include - -#if (defined(BOOST_ASIO_HAS_STD_TUPLE) \ - && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)) \ - || defined(GENERATING_DOCUMENTATION) - #include #include @@ -38,11 +33,9 @@ class append_t public: /// Constructor. template - BOOST_ASIO_CONSTEXPR explicit append_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)...) + constexpr explicit append_t(T&& completion_token, V&&... values) + : token_(static_cast(completion_token)), + values_(static_cast(values)...) { } @@ -55,15 +48,13 @@ public: /// arguments should be passed additional values after the results of the /// operation. template -BOOST_ASIO_NODISCARD inline BOOST_ASIO_CONSTEXPR append_t< - typename decay::type, typename decay::type...> -append(BOOST_ASIO_MOVE_ARG(CompletionToken) completion_token, - BOOST_ASIO_MOVE_ARG(Values)... values) +BOOST_ASIO_NODISCARD inline constexpr +append_t, decay_t...> +append(CompletionToken&& completion_token, Values&&... values) { - return append_t< - typename decay::type, typename decay::type...>( - BOOST_ASIO_MOVE_CAST(CompletionToken)(completion_token), - BOOST_ASIO_MOVE_CAST(Values)(values)...); + return append_t, decay_t...>( + static_cast(completion_token), + static_cast(values)...); } } // namespace asio @@ -73,8 +64,4 @@ append(BOOST_ASIO_MOVE_ARG(CompletionToken) completion_token, #include -#endif // (defined(BOOST_ASIO_HAS_STD_TUPLE) - // && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)) - // || defined(GENERATING_DOCUMENTATION) - #endif // BOOST_ASIO_APPEND_HPP diff --git a/include/boost/asio/as_tuple.hpp b/include/boost/asio/as_tuple.hpp index 03aeac1e..0f89b460 100644 --- a/include/boost/asio/as_tuple.hpp +++ b/include/boost/asio/as_tuple.hpp @@ -16,11 +16,6 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include - -#if (defined(BOOST_ASIO_HAS_STD_TUPLE) \ - && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)) \ - || defined(GENERATING_DOCUMENTATION) - #include #include @@ -51,18 +46,18 @@ public: * token is itself defaulted as an argument to allow it to capture a source * location. */ - BOOST_ASIO_CONSTEXPR as_tuple_t( + constexpr as_tuple_t( default_constructor_tag = default_constructor_tag(), CompletionToken token = CompletionToken()) - : token_(BOOST_ASIO_MOVE_CAST(CompletionToken)(token)) + : token_(static_cast(token)) { } /// Constructor. template - BOOST_ASIO_CONSTEXPR explicit as_tuple_t( - BOOST_ASIO_MOVE_ARG(T) completion_token) - : token_(BOOST_ASIO_MOVE_CAST(T)(completion_token)) + constexpr explicit as_tuple_t( + T&& completion_token) + : token_(static_cast(completion_token)) { } @@ -77,13 +72,13 @@ public: /// Construct the adapted executor from the inner executor type. template executor_with_default(const InnerExecutor1& ex, - typename constraint< - conditional< + constraint_t< + conditional_t< !is_same::value, is_convertible, false_type - >::type::value - >::type = 0) BOOST_ASIO_NOEXCEPT + >::value + > = 0) noexcept : InnerExecutor(ex) { } @@ -91,25 +86,21 @@ public: /// Type alias to adapt an I/O object to use @c as_tuple_t as its /// default completion token type. -#if defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) \ - || defined(GENERATING_DOCUMENTATION) template using as_default_on_t = typename T::template rebind_executor< - executor_with_default >::other; -#endif // defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) - // || defined(GENERATING_DOCUMENTATION) + executor_with_default>::other; /// Function helper to adapt an I/O object to use @c as_tuple_t as its /// default completion token type. template - static typename decay::type::template rebind_executor< - executor_with_default::type::executor_type> + static typename decay_t::template rebind_executor< + executor_with_default::executor_type> >::other - as_default_on(BOOST_ASIO_MOVE_ARG(T) object) + as_default_on(T&& object) { - return typename decay::type::template rebind_executor< - executor_with_default::type::executor_type> - >::other(BOOST_ASIO_MOVE_CAST(T)(object)); + return typename decay_t::template rebind_executor< + executor_with_default::executor_type> + >::other(static_cast(object)); } //private: @@ -120,11 +111,11 @@ public: /// arguments should be combined into a single tuple argument. template BOOST_ASIO_NODISCARD inline -BOOST_ASIO_CONSTEXPR as_tuple_t::type> -as_tuple(BOOST_ASIO_MOVE_ARG(CompletionToken) completion_token) +constexpr as_tuple_t> +as_tuple(CompletionToken&& completion_token) { - return as_tuple_t::type>( - BOOST_ASIO_MOVE_CAST(CompletionToken)(completion_token)); + return as_tuple_t>( + static_cast(completion_token)); } } // namespace asio @@ -134,8 +125,4 @@ as_tuple(BOOST_ASIO_MOVE_ARG(CompletionToken) completion_token) #include -#endif // (defined(BOOST_ASIO_HAS_STD_TUPLE) - // && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)) - // || defined(GENERATING_DOCUMENTATION) - #endif // BOOST_ASIO_AS_TUPLE_HPP diff --git a/include/boost/asio/associated_allocator.hpp b/include/boost/asio/associated_allocator.hpp index 50cc9c45..38825fa3 100644 --- a/include/boost/asio/associated_allocator.hpp +++ b/include/boost/asio/associated_allocator.hpp @@ -37,9 +37,7 @@ struct has_allocator_type : false_type }; template -struct has_allocator_type::type> - : true_type +struct has_allocator_type> : true_type { }; @@ -50,33 +48,30 @@ struct associated_allocator_impl typedef A type; - static type get(const T&) BOOST_ASIO_NOEXCEPT + static type get(const T&) noexcept { return type(); } - static const type& get(const T&, const A& a) BOOST_ASIO_NOEXCEPT + static const type& get(const T&, const A& a) noexcept { return a; } }; template -struct associated_allocator_impl::type> +struct associated_allocator_impl> { typedef typename T::allocator_type type; - static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( - const T& t) BOOST_ASIO_NOEXCEPT - BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_allocator())) + static auto get(const T& t) noexcept + -> decltype(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())) + static auto get(const T& t, const A&) noexcept + -> decltype(t.get_allocator()) { return t.get_allocator(); } @@ -84,12 +79,12 @@ struct associated_allocator_impl struct associated_allocator_impl::value - >::type, - typename void_type< + >, + void_t< typename associator::type - >::type> : associator + >> : associator { }; @@ -116,7 +111,7 @@ struct associated_allocator_impl > +template > struct associated_allocator #if !defined(GENERATING_DOCUMENTATION) : detail::associated_allocator_impl @@ -129,11 +124,11 @@ struct associated_allocator /// If @c T has a nested type @c allocator_type, returns /// t.get_allocator(). Otherwise returns @c type(). - static decltype(auto) get(const T& t) BOOST_ASIO_NOEXCEPT; + static decltype(auto) get(const T& t) noexcept; /// If @c T has a nested type @c allocator_type, returns /// t.get_allocator(). Otherwise returns @c a. - static decltype(auto) get(const T& t, const Allocator& a) BOOST_ASIO_NOEXCEPT; + static decltype(auto) get(const T& t, const Allocator& a) noexcept; #endif // defined(GENERATING_DOCUMENTATION) }; @@ -143,7 +138,7 @@ struct associated_allocator */ template BOOST_ASIO_NODISCARD inline typename associated_allocator::type -get_associated_allocator(const T& t) BOOST_ASIO_NOEXCEPT +get_associated_allocator(const T& t) noexcept { return associated_allocator::get(t); } @@ -153,23 +148,17 @@ get_associated_allocator(const T& t) BOOST_ASIO_NOEXCEPT * @returns associated_allocator::get(t, a) */ template -BOOST_ASIO_NODISCARD inline BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( - typename associated_allocator::type) -get_associated_allocator(const T& t, const Allocator& a) BOOST_ASIO_NOEXCEPT - BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_allocator::get(t, a))) +BOOST_ASIO_NODISCARD inline auto get_associated_allocator( + const T& t, const Allocator& a) noexcept + -> decltype(associated_allocator::get(t, a)) { return associated_allocator::get(t, a); } -#if defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) - -template > +template > using associated_allocator_t = typename associated_allocator::type; -#endif // defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) - namespace detail { template @@ -179,22 +168,19 @@ struct associated_allocator_forwarding_base template struct associated_allocator_forwarding_base::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 struct associated_allocator, Allocator> @@ -208,25 +194,20 @@ struct associated_allocator, Allocator> /// Forwards the request to get the allocator to the associator specialisation /// for the unwrapped type @c T. - static type get(reference_wrapper t) BOOST_ASIO_NOEXCEPT + static type get(reference_wrapper t) noexcept { return associated_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, const Allocator& a) BOOST_ASIO_NOEXCEPT - BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_allocator::get(t.get(), a))) + static auto get(reference_wrapper t, const Allocator& a) noexcept + -> decltype(associated_allocator::get(t.get(), a)) { return associated_allocator::get(t.get(), a); } }; -#endif // defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER) - // || defined(GENERATING_DOCUMENTATION) - } // namespace asio } // namespace boost diff --git a/include/boost/asio/associated_cancellation_slot.hpp b/include/boost/asio/associated_cancellation_slot.hpp index ab55354f..e44bff9f 100644 --- a/include/boost/asio/associated_cancellation_slot.hpp +++ b/include/boost/asio/associated_cancellation_slot.hpp @@ -37,9 +37,8 @@ struct has_cancellation_slot_type : false_type }; template -struct has_cancellation_slot_type::type> - : true_type +struct has_cancellation_slot_type> + : true_type { }; @@ -50,12 +49,12 @@ struct associated_cancellation_slot_impl typedef S type; - static type get(const T&) BOOST_ASIO_NOEXCEPT + static type get(const T&) noexcept { return type(); } - static const type& get(const T&, const S& s) BOOST_ASIO_NOEXCEPT + static const type& get(const T&, const S& s) noexcept { return s; } @@ -63,20 +62,18 @@ struct associated_cancellation_slot_impl template struct associated_cancellation_slot_impl::type> + void_t> { typedef typename T::cancellation_slot_type type; - 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())) + static auto get(const T& t) noexcept + -> decltype(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())) + static auto get(const T& t, const S&) noexcept + -> decltype(t.get_cancellation_slot()) { return t.get_cancellation_slot(); } @@ -84,12 +81,12 @@ struct associated_cancellation_slot_impl struct associated_cancellation_slot_impl::value - >::type, - typename void_type< + >, + void_t< typename associator::type - >::type> : associator + >> : associator { }; @@ -130,12 +127,12 @@ struct associated_cancellation_slot /// If @c T has a nested type @c cancellation_slot_type, returns /// t.get_cancellation_slot(). Otherwise returns @c type(). - static decltype(auto) get(const T& t) BOOST_ASIO_NOEXCEPT; + static decltype(auto) get(const T& t) noexcept; /// If @c T has a nested type @c cancellation_slot_type, returns /// t.get_cancellation_slot(). Otherwise returns @c s. static decltype(auto) get(const T& t, - const CancellationSlot& s) BOOST_ASIO_NOEXCEPT; + const CancellationSlot& s) noexcept; #endif // defined(GENERATING_DOCUMENTATION) }; @@ -145,7 +142,7 @@ struct associated_cancellation_slot */ template BOOST_ASIO_NODISCARD inline typename associated_cancellation_slot::type -get_associated_cancellation_slot(const T& t) BOOST_ASIO_NOEXCEPT +get_associated_cancellation_slot(const T& t) noexcept { return associated_cancellation_slot::get(t); } @@ -156,24 +153,17 @@ get_associated_cancellation_slot(const T& t) BOOST_ASIO_NOEXCEPT * CancellationSlot>::get(t, st) */ template -BOOST_ASIO_NODISCARD inline BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( - typename associated_cancellation_slot::type) -get_associated_cancellation_slot(const T& t, - const CancellationSlot& st) BOOST_ASIO_NOEXCEPT - BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_cancellation_slot::get(t, st))) +BOOST_ASIO_NODISCARD inline auto get_associated_cancellation_slot( + const T& t, const CancellationSlot& st) noexcept + -> decltype(associated_cancellation_slot::get(t, st)) { return associated_cancellation_slot::get(t, st); } -#if defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) - template using associated_cancellation_slot_t = typename associated_cancellation_slot::type; -#endif // defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) - namespace detail { template @@ -183,22 +173,19 @@ struct associated_cancellation_slot_forwarding_base template struct associated_cancellation_slot_forwarding_base::asio_associated_cancellation_slot_is_unspecialised, void >::value - >::type> + >> { typedef void asio_associated_cancellation_slot_is_unspecialised; }; } // namespace detail -#if defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER) \ - || defined(GENERATING_DOCUMENTATION) - /// Specialisation of associated_cancellation_slot for @c /// std::reference_wrapper. template @@ -213,25 +200,21 @@ struct associated_cancellation_slot, CancellationSlot> /// Forwards the request to get the cancellation slot to the associator /// specialisation for the unwrapped type @c T. - static type get(reference_wrapper t) BOOST_ASIO_NOEXCEPT + static type get(reference_wrapper t) noexcept { return associated_cancellation_slot::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, - const CancellationSlot& s) BOOST_ASIO_NOEXCEPT - BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_cancellation_slot::get(t.get(), s))) + static auto get(reference_wrapper t, const CancellationSlot& s) noexcept + -> decltype( + associated_cancellation_slot::get(t.get(), s)) { return associated_cancellation_slot::get(t.get(), s); } }; -#endif // defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER) - // || defined(GENERATING_DOCUMENTATION) - } // namespace asio } // namespace boost diff --git a/include/boost/asio/associated_executor.hpp b/include/boost/asio/associated_executor.hpp index 4ffc80f9..a8d4776a 100644 --- a/include/boost/asio/associated_executor.hpp +++ b/include/boost/asio/associated_executor.hpp @@ -39,8 +39,7 @@ struct has_executor_type : false_type }; template -struct has_executor_type::type> +struct has_executor_type> : true_type { }; @@ -52,33 +51,30 @@ struct associated_executor_impl typedef E type; - static type get(const T&) BOOST_ASIO_NOEXCEPT + static type get(const T&) noexcept { return type(); } - static const type& get(const T&, const E& e) BOOST_ASIO_NOEXCEPT + static const type& get(const T&, const E& e) noexcept { return e; } }; template -struct associated_executor_impl::type> +struct associated_executor_impl> { typedef typename T::executor_type type; - static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(type) get( - const T& t) BOOST_ASIO_NOEXCEPT - BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((t.get_executor())) + static auto get(const T& t) noexcept + -> decltype(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())) + static auto get(const T& t, const E&) noexcept + -> decltype(t.get_executor()) { return t.get_executor(); } @@ -86,12 +82,12 @@ struct associated_executor_impl struct associated_executor_impl::value - >::type, - typename void_type< + >, + void_t< typename associator::type - >::type> : associator + >> : associator { }; @@ -131,11 +127,11 @@ struct associated_executor /// If @c T has a nested type @c executor_type, returns /// t.get_executor(). Otherwise returns @c type(). - static decltype(auto) get(const T& t) BOOST_ASIO_NOEXCEPT; + static decltype(auto) get(const T& t) noexcept; /// If @c T has a nested type @c executor_type, returns /// t.get_executor(). Otherwise returns @c ex. - static decltype(auto) get(const T& t, const Executor& ex) BOOST_ASIO_NOEXCEPT; + static decltype(auto) get(const T& t, const Executor& ex) noexcept; #endif // defined(GENERATING_DOCUMENTATION) }; @@ -145,7 +141,7 @@ struct associated_executor */ template BOOST_ASIO_NODISCARD inline typename associated_executor::type -get_associated_executor(const T& t) BOOST_ASIO_NOEXCEPT +get_associated_executor(const T& t) noexcept { return associated_executor::get(t); } @@ -155,14 +151,12 @@ get_associated_executor(const T& t) BOOST_ASIO_NOEXCEPT * @returns associated_executor::get(t, ex) */ template -BOOST_ASIO_NODISCARD inline BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( - typename associated_executor::type) -get_associated_executor(const T& t, const Executor& ex, - typename constraint< +BOOST_ASIO_NODISCARD inline auto get_associated_executor( + const T& t, const Executor& ex, + constraint_t< is_executor::value || execution::is_executor::value - >::type = 0) BOOST_ASIO_NOEXCEPT - BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_executor::get(t, ex))) + > = 0) noexcept + -> decltype(associated_executor::get(t, ex)) { return associated_executor::get(t, ex); } @@ -176,20 +170,16 @@ template BOOST_ASIO_NODISCARD inline typename associated_executor::type get_associated_executor(const T& t, ExecutionContext& ctx, - typename constraint::value>::type = 0) BOOST_ASIO_NOEXCEPT + constraint_t::value> = 0) noexcept { return associated_executor::get(t, ctx.get_executor()); } -#if defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) - template using associated_executor_t = typename associated_executor::type; -#endif // defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) - namespace detail { template @@ -199,22 +189,19 @@ struct associated_executor_forwarding_base template struct associated_executor_forwarding_base::asio_associated_executor_is_unspecialised, void >::value - >::type> + >> { typedef void asio_associated_executor_is_unspecialised; }; } // namespace detail -#if defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER) \ - || defined(GENERATING_DOCUMENTATION) - /// Specialisation of associated_executor for @c std::reference_wrapper. template struct associated_executor, Executor> @@ -228,25 +215,20 @@ struct associated_executor, Executor> /// Forwards the request to get the executor to the associator specialisation /// for the unwrapped type @c T. - static type get(reference_wrapper t) BOOST_ASIO_NOEXCEPT + static type get(reference_wrapper t) noexcept { return associated_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, const Executor& ex) BOOST_ASIO_NOEXCEPT - BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_executor::get(t.get(), ex))) + static auto get(reference_wrapper t, const Executor& ex) noexcept + -> decltype(associated_executor::get(t.get(), ex)) { return associated_executor::get(t.get(), ex); } }; -#endif // defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER) - // || defined(GENERATING_DOCUMENTATION) - } // namespace asio } // namespace boost diff --git a/include/boost/asio/associated_immediate_executor.hpp b/include/boost/asio/associated_immediate_executor.hpp index d73d395f..ff0b8b88 100644 --- a/include/boost/asio/associated_immediate_executor.hpp +++ b/include/boost/asio/associated_immediate_executor.hpp @@ -42,7 +42,7 @@ struct has_immediate_executor_type : false_type template struct has_immediate_executor_type::type> + void_t> : true_type { }; @@ -50,9 +50,9 @@ struct has_immediate_executor_type struct default_immediate_executor { - typedef typename require_result::type type; + typedef require_result_t type; - static type get(const E& e) BOOST_ASIO_NOEXCEPT + static type get(const E& e) noexcept { return boost::asio::require(e, execution::blocking.never); } @@ -60,59 +60,57 @@ struct default_immediate_executor template struct default_immediate_executor::value - >::type, - typename enable_if< + >, + enable_if_t< is_executor::value - >::type> + >> { class type : public E { public: template explicit type(const Executor1& e, - typename constraint< - conditional< + constraint_t< + conditional_t< !is_same::value, is_convertible, false_type - >::type::value - >::type = 0) BOOST_ASIO_NOEXCEPT + >::value + > = 0) noexcept : E(e) { } - type(const type& other) BOOST_ASIO_NOEXCEPT + type(const type& other) noexcept : E(static_cast(other)) { } -#if defined(BOOST_ASIO_HAS_MOVE) - type(type&& other) BOOST_ASIO_NOEXCEPT - : E(BOOST_ASIO_MOVE_CAST(E)(other)) + type(type&& other) noexcept + : E(static_cast(other)) { } -#endif // defined(BOOST_ASIO_HAS_MOVE) template - void dispatch(BOOST_ASIO_MOVE_ARG(Function) f, const Allocator& a) const + void dispatch(Function&& f, const Allocator& a) const { - this->post(BOOST_ASIO_MOVE_CAST(Function)(f), a); + this->post(static_cast(f), a); } - friend bool operator==(const type& a, const type& b) BOOST_ASIO_NOEXCEPT + friend bool operator==(const type& a, const type& b) noexcept { return static_cast(a) == static_cast(b); } - friend bool operator!=(const type& a, const type& b) BOOST_ASIO_NOEXCEPT + friend bool operator!=(const type& a, const type& b) noexcept { return static_cast(a) != static_cast(b); } }; - static type get(const E& e) BOOST_ASIO_NOEXCEPT + static type get(const E& e) noexcept { return type(e); } @@ -125,9 +123,8 @@ struct associated_immediate_executor_impl typedef typename default_immediate_executor::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::get(e))) + static auto get(const T&, const E& e) noexcept + -> decltype(default_immediate_executor::get(e)) { return default_immediate_executor::get(e); } @@ -135,13 +132,12 @@ struct associated_immediate_executor_impl template struct associated_immediate_executor_impl::type> + void_t> { 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())) + static auto get(const T& t, const E&) noexcept + -> decltype(t.get_immediate_executor()) { return t.get_immediate_executor(); } @@ -149,12 +145,12 @@ struct associated_immediate_executor_impl struct associated_immediate_executor_impl::value - >::type, - typename void_type< + >, + void_t< typename associator::type - >::type> : associator + >> : associator { }; @@ -195,7 +191,7 @@ struct associated_immediate_executor /// If @c T has a nested type @c immediate_executor_type, returns /// t.get_immediate_executor(). Otherwise returns /// boost::asio::require(ex, boost::asio::execution::blocking.never). - static decltype(auto) get(const T& t, const Executor& ex) BOOST_ASIO_NOEXCEPT; + static decltype(auto) get(const T& t, const Executor& ex) noexcept; #endif // defined(GENERATING_DOCUMENTATION) }; @@ -204,14 +200,12 @@ struct associated_immediate_executor * @returns associated_immediate_executor::get(t, ex) */ template -BOOST_ASIO_NODISCARD inline BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2( - typename associated_immediate_executor::type) -get_associated_immediate_executor(const T& t, const Executor& ex, - typename constraint< +BOOST_ASIO_NODISCARD inline auto get_associated_immediate_executor( + const T& t, const Executor& ex, + constraint_t< is_executor::value || execution::is_executor::value - >::type = 0) BOOST_ASIO_NOEXCEPT - BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_immediate_executor::get(t, ex))) + > = 0) noexcept + -> decltype(associated_immediate_executor::get(t, ex)) { return associated_immediate_executor::get(t, ex); } @@ -225,21 +219,18 @@ template BOOST_ASIO_NODISCARD inline typename associated_immediate_executor::type get_associated_immediate_executor(const T& t, ExecutionContext& ctx, - typename constraint::value>::type = 0) BOOST_ASIO_NOEXCEPT + constraint_t< + is_convertible::value + > = 0) noexcept { return associated_immediate_executor::get(t, ctx.get_executor()); } -#if defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) - template using associated_immediate_executor_t = typename associated_immediate_executor::type; -#endif // defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) - namespace detail { template @@ -249,22 +240,19 @@ struct associated_immediate_executor_forwarding_base template struct associated_immediate_executor_forwarding_base::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 @@ -279,18 +267,13 @@ struct associated_immediate_executor, Executor> /// 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, const Executor& ex) BOOST_ASIO_NOEXCEPT - BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(( - associated_immediate_executor::get(t.get(), ex))) + static auto get(reference_wrapper t, const Executor& ex) noexcept + -> decltype(associated_immediate_executor::get(t.get(), ex)) { return associated_immediate_executor::get(t.get(), ex); } }; -#endif // defined(BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER) - // || defined(GENERATING_DOCUMENTATION) - } // namespace asio } // namespace boost diff --git a/include/boost/asio/async_result.hpp b/include/boost/asio/async_result.hpp index c73e0eed..a4525951 100644 --- a/include/boost/asio/async_result.hpp +++ b/include/boost/asio/async_result.hpp @@ -17,16 +17,13 @@ #include #include -#include #include namespace boost { namespace asio { -#if defined(BOOST_ASIO_HAS_CONCEPTS) \ - && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) \ - && defined(BOOST_ASIO_HAS_DECLTYPE) +#if defined(BOOST_ASIO_HAS_CONCEPTS) namespace detail { @@ -40,8 +37,6 @@ struct is_completion_signature : true_type { }; -#if defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS) - template struct is_completion_signature : true_type { @@ -70,7 +65,6 @@ struct is_completion_signature : true_type }; # endif // defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) -#endif // defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS) template struct are_completion_signatures : false_type @@ -108,8 +102,6 @@ struct is_completion_handler_for { }; -#if defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS) - template struct is_completion_handler_for : integral_constant)> @@ -143,7 +135,6 @@ struct is_completion_handler_for }; # endif // defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) -#endif // defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS) template struct is_completion_handler_for @@ -175,8 +166,6 @@ BOOST_ASIO_CONCEPT completion_handler_for = ::boost::asio::completion_handler_for #else // defined(BOOST_ASIO_HAS_CONCEPTS) - // && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - // && defined(BOOST_ASIO_HAS_DECLTYPE) #define BOOST_ASIO_COMPLETION_SIGNATURE typename #define BOOST_ASIO_COMPLETION_HANDLER_FOR(sig) typename @@ -184,8 +173,6 @@ BOOST_ASIO_CONCEPT completion_handler_for = #define BOOST_ASIO_COMPLETION_HANDLER_FOR3(sig0, sig1, sig2) typename #endif // defined(BOOST_ASIO_HAS_CONCEPTS) - // && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - // && defined(BOOST_ASIO_HAS_DECLTYPE) namespace detail { @@ -197,8 +184,6 @@ struct is_simple_completion_signature : false_type template struct simple_completion_signature; -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - template struct is_simple_completion_signature : true_type { @@ -229,8 +214,6 @@ struct simple_completion_signature typedef R type(Args...); }; -#if defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS) - template struct simple_completion_signature { @@ -264,197 +247,9 @@ struct simple_completion_signature }; # endif // defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) -#endif // defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS) -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template -struct is_simple_completion_signature : true_type -{ -}; - -#define BOOST_ASIO_PRIVATE_SIMPLE_SIG_DEF(n) \ - template \ - struct is_simple_completion_signature \ - : true_type \ - { \ - }; \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_SIMPLE_SIG_DEF) -#undef BOOST_ASIO_PRIVATE_SIMPLE_SIG_DEF - -template -struct are_simple_completion_signatures : false_type -{ -}; - -template -struct are_simple_completion_signatures - : is_simple_completion_signature -{ -}; - -template -struct are_simple_completion_signatures - : integral_constant::value - && is_simple_completion_signature::value)> -{ -}; - -template -struct are_simple_completion_signatures - : integral_constant::value - && is_simple_completion_signature::value - && is_simple_completion_signature::value)> -{ -}; - -template <> -struct simple_completion_signature -{ - typedef void type; -}; - -template -struct simple_completion_signature -{ - typedef R type(); -}; - -#define BOOST_ASIO_PRIVATE_SIMPLE_SIG_DEF(n) \ - template \ - struct simple_completion_signature \ - { \ - typedef R type(BOOST_ASIO_VARIADIC_TARGS(n)); \ - }; \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_SIMPLE_SIG_DEF) -#undef BOOST_ASIO_PRIVATE_SIMPLE_SIG_DEF - -#if defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS) - -template -struct simple_completion_signature -{ - typedef R type(); -}; - -template -struct simple_completion_signature -{ - typedef R type(); -}; - -#define BOOST_ASIO_PRIVATE_SIMPLE_SIG_DEF(n) \ - template \ - struct simple_completion_signature< \ - R(BOOST_ASIO_VARIADIC_TARGS(n)) &> \ - { \ - typedef R type(BOOST_ASIO_VARIADIC_TARGS(n)); \ - }; \ - \ - template \ - struct simple_completion_signature< \ - R(BOOST_ASIO_VARIADIC_TARGS(n)) &&> \ - { \ - typedef R type(BOOST_ASIO_VARIADIC_TARGS(n)); \ - }; \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_SIMPLE_SIG_DEF) -#undef BOOST_ASIO_PRIVATE_SIMPLE_SIG_DEF - -# if defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) - -template -struct simple_completion_signature -{ - typedef R type(); -}; - -template -struct simple_completion_signature -{ - typedef R type(); -}; - -template -struct simple_completion_signature -{ - typedef R type(); -}; - -#define BOOST_ASIO_PRIVATE_SIMPLE_SIG_DEF(n) \ - template \ - struct simple_completion_signature< \ - R(BOOST_ASIO_VARIADIC_TARGS(n)) noexcept> \ - { \ - typedef R type(BOOST_ASIO_VARIADIC_TARGS(n)); \ - }; \ - \ - template \ - struct simple_completion_signature< \ - R(BOOST_ASIO_VARIADIC_TARGS(n)) & noexcept> \ - { \ - typedef R type(BOOST_ASIO_VARIADIC_TARGS(n)); \ - }; \ - \ - template \ - struct simple_completion_signature< \ - R(BOOST_ASIO_VARIADIC_TARGS(n)) && noexcept> \ - { \ - typedef R type(BOOST_ASIO_VARIADIC_TARGS(n)); \ - }; \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_SIMPLE_SIG_DEF) -#undef BOOST_ASIO_PRIVATE_SIMPLE_SIG_DEF - -# endif // defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE) -#endif // defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS) - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) \ - || defined(GENERATING_DOCUMENTATION) - -# define BOOST_ASIO_COMPLETION_SIGNATURES_TPARAMS \ - BOOST_ASIO_COMPLETION_SIGNATURE... Signatures - -# define BOOST_ASIO_COMPLETION_SIGNATURES_TSPECPARAMS \ - BOOST_ASIO_COMPLETION_SIGNATURE... Signatures - -# define BOOST_ASIO_COMPLETION_SIGNATURES_TARGS Signatures... - -# define BOOST_ASIO_COMPLETION_SIGNATURES_TSIMPLEARGS \ - typename boost::asio::detail::simple_completion_signature< \ - Signatures>::type... - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - // || defined(GENERATING_DOCUMENTATION) - -# define BOOST_ASIO_COMPLETION_SIGNATURES_TPARAMS \ - typename Sig0 = void, \ - typename Sig1 = void, \ - typename Sig2 = void - -# define BOOST_ASIO_COMPLETION_SIGNATURES_TSPECPARAMS \ - typename Sig0, \ - typename Sig1, \ - typename Sig2 - -# define BOOST_ASIO_COMPLETION_SIGNATURES_TARGS Sig0, Sig1, Sig2 - -# define BOOST_ASIO_COMPLETION_SIGNATURES_TSIMPLEARGS \ - typename ::boost::asio::detail::simple_completion_signature::type, \ - typename ::boost::asio::detail::simple_completion_signature::type, \ - typename ::boost::asio::detail::simple_completion_signature::type - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - // || defined(GENERATING_DOCUMENTATION) - -template +template class completion_handler_async_result { public: @@ -469,56 +264,22 @@ public: { } -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - template - static return_type initiate( - BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_MOVE_ARG(RawCompletionToken) token, - BOOST_ASIO_MOVE_ARG(Args)... args) + static return_type initiate(Initiation&& initiation, + RawCompletionToken&& token, Args&&... args) { - BOOST_ASIO_MOVE_CAST(Initiation)(initiation)( - BOOST_ASIO_MOVE_CAST(RawCompletionToken)(token), - BOOST_ASIO_MOVE_CAST(Args)(args)...); + static_cast(initiation)( + static_cast(token), + static_cast(args)...); } -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template - static return_type initiate( - BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_MOVE_ARG(RawCompletionToken) token) - { - BOOST_ASIO_MOVE_CAST(Initiation)(initiation)( - BOOST_ASIO_MOVE_CAST(RawCompletionToken)(token)); - } - -#define BOOST_ASIO_PRIVATE_INITIATE_DEF(n) \ - template \ - static return_type initiate( \ - BOOST_ASIO_MOVE_ARG(Initiation) initiation, \ - BOOST_ASIO_MOVE_ARG(RawCompletionToken) token, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - BOOST_ASIO_MOVE_CAST(Initiation)(initiation)( \ - BOOST_ASIO_MOVE_CAST(RawCompletionToken)(token), \ - 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: completion_handler_async_result( - const completion_handler_async_result&) BOOST_ASIO_DELETED; + const completion_handler_async_result&) = delete; completion_handler_async_result& operator=( - const completion_handler_async_result&) BOOST_ASIO_DELETED; + const completion_handler_async_result&) = delete; }; } // namespace detail @@ -543,7 +304,8 @@ private: * The primary template assumes that the CompletionToken is the completion * handler. */ -template +template class async_result { public: @@ -568,70 +330,44 @@ public: /// obtain the value to be returned from the initiating function. template static return_type initiate( - BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_MOVE_ARG(RawCompletionToken) token, - BOOST_ASIO_MOVE_ARG(Args)... args); + Initiation&& initiation, + RawCompletionToken&& token, + Args&&... args); private: - async_result(const async_result&) BOOST_ASIO_DELETED; - async_result& operator=(const async_result&) BOOST_ASIO_DELETED; + async_result(const async_result&) = delete; + async_result& operator=(const async_result&) = delete; }; #else // defined(GENERATING_DOCUMENTATION) -#if defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS) - -template +template class async_result : - public conditional< - detail::are_simple_completion_signatures< - BOOST_ASIO_COMPLETION_SIGNATURES_TARGS>::value, - detail::completion_handler_async_result< - CompletionToken, BOOST_ASIO_COMPLETION_SIGNATURES_TARGS>, + public conditional_t< + detail::are_simple_completion_signatures::value, + detail::completion_handler_async_result, async_result - >::type + typename detail::simple_completion_signature::type...> + > { public: - typedef typename conditional< - detail::are_simple_completion_signatures< - BOOST_ASIO_COMPLETION_SIGNATURES_TARGS>::value, - detail::completion_handler_async_result< - CompletionToken, BOOST_ASIO_COMPLETION_SIGNATURES_TARGS>, + typedef conditional_t< + detail::are_simple_completion_signatures::value, + detail::completion_handler_async_result, async_result - >::type base_type; + typename detail::simple_completion_signature::type...> + > base_type; using base_type::base_type; private: - async_result(const async_result&) BOOST_ASIO_DELETED; - async_result& operator=(const async_result&) BOOST_ASIO_DELETED; + async_result(const async_result&) = delete; + async_result& operator=(const async_result&) = delete; }; -#else // defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS) - -template -class async_result : - public detail::completion_handler_async_result< - CompletionToken, BOOST_ASIO_COMPLETION_SIGNATURES_TARGS> -{ -public: - explicit async_result(CompletionToken& h) - : detail::completion_handler_async_result< - CompletionToken, BOOST_ASIO_COMPLETION_SIGNATURES_TARGS>(h) - { - } - -private: - async_result(const async_result&) BOOST_ASIO_DELETED; - async_result& operator=(const async_result&) BOOST_ASIO_DELETED; -}; - -#endif // defined(BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS) - -template -class async_result +template +class async_result { // Empty. }; @@ -641,65 +377,39 @@ class async_result /// Helper template to deduce the handler type from a CompletionToken, capture /// a local copy of the handler, and then create an async_result for the /// handler. -template +template struct async_completion { /// The real handler type to be used for the asynchronous operation. typedef typename boost::asio::async_result< - typename decay::type, - BOOST_ASIO_COMPLETION_SIGNATURES_TARGS>::completion_handler_type - completion_handler_type; + decay_t, Signatures...>::completion_handler_type + completion_handler_type; -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Constructor. /** * The constructor creates the concrete completion handler and makes the link * between the handler and the asynchronous result. */ explicit async_completion(CompletionToken& token) - : completion_handler(static_cast::value, - completion_handler_type&, CompletionToken&&>::type>(token)), + completion_handler_type&, CompletionToken&&>>(token)), result(completion_handler) { } -#else // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - explicit async_completion(typename decay::type& token) - : completion_handler(token), - result(completion_handler) - { - } - - explicit async_completion(const typename decay::type& token) - : completion_handler(token), - result(completion_handler) - { - } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// A copy of, or reference to, a real handler object. -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - typename conditional< + conditional_t< is_same::value, - completion_handler_type&, completion_handler_type>::type completion_handler; -#else // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - completion_handler_type completion_handler; -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + completion_handler_type&, completion_handler_type> completion_handler; /// The result of the asynchronous operation's initiating function. - async_result::type, - BOOST_ASIO_COMPLETION_SIGNATURES_TARGS> result; + async_result, Signatures...> result; }; namespace detail { -template -struct async_result_helper - : async_result::type, - BOOST_ASIO_COMPLETION_SIGNATURES_TARGS> -{ -}; - struct async_result_memfns_base { void initiate(); @@ -725,11 +435,11 @@ char async_result_initiate_memfn_helper( void (async_result_memfns_base::*)(), &async_result_memfns_derived::initiate>*); -template +template struct async_result_has_initiate_memfn : integral_constant::type, - BOOST_ASIO_COMPLETION_SIGNATURES_TARGS> + async_result, Signatures...> >(0)) != 1> { }; @@ -743,25 +453,6 @@ struct async_result_has_initiate_memfn void_or_deduced # define BOOST_ASIO_INITFN_RESULT_TYPE3(ct, sig0, sig1, sig2) \ void_or_deduced -#elif defined(_MSC_VER) && (_MSC_VER < 1500) -# define BOOST_ASIO_INITFN_RESULT_TYPE(ct, sig) \ - typename ::boost::asio::detail::async_result_helper< \ - ct, sig>::return_type -# define BOOST_ASIO_INITFN_RESULT_TYPE2(ct, sig0, sig1) \ - typename ::boost::asio::detail::async_result_helper< \ - ct, sig0, sig1>::return_type -# define BOOST_ASIO_INITFN_RESULT_TYPE3(ct, sig0, sig1, sig2) \ - typename ::boost::asio::detail::async_result_helper< \ - ct, sig0, sig1, sig2>::return_type -#define BOOST_ASIO_HANDLER_TYPE(ct, sig) \ - typename ::boost::asio::detail::async_result_helper< \ - ct, sig>::completion_handler_type -#define BOOST_ASIO_HANDLER_TYPE2(ct, sig0, sig1) \ - typename ::boost::asio::detail::async_result_helper< \ - ct, sig0, sig1>::completion_handler_type -#define BOOST_ASIO_HANDLER_TYPE3(ct, sig0, sig1, sig2) \ - typename ::boost::asio::detail::async_result_helper< \ - ct, sig0, sig1, sig2>::completion_handler_type #else # define BOOST_ASIO_INITFN_RESULT_TYPE(ct, sig) \ typename ::boost::asio::async_result< \ @@ -824,7 +515,7 @@ struct async_result_has_initiate_memfn # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX3(ct, sig0, sig1, sig2) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(expr) -#elif defined(BOOST_ASIO_HAS_DECLTYPE) +#else # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ct, sig) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX2(ct, sig0, sig1) \ @@ -832,14 +523,6 @@ struct async_result_has_initiate_memfn # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX3(ct, sig0, sig1, sig2) \ auto # define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(expr) -> decltype expr -#else -# define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ct, sig) \ - BOOST_ASIO_INITFN_RESULT_TYPE(ct, sig) -# define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX2(ct, sig0, sig1) \ - BOOST_ASIO_INITFN_RESULT_TYPE2(ct, sig0, sig1) -# define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX3(ct, sig0, sig1, sig2) \ - BOOST_ASIO_INITFN_RESULT_TYPE3(ct, sig0, sig1, sig2) -# define BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(expr) #endif #if defined(GENERATING_DOCUMENTATION) @@ -849,20 +532,13 @@ struct async_result_has_initiate_memfn void_or_deduced # define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE3(ct, sig0, sig1, sig2, expr) \ void_or_deduced -#elif defined(BOOST_ASIO_HAS_DECLTYPE) -# define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(ct, sig, expr) \ - decltype expr -# define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE2(ct, sig0, sig1, expr) \ - decltype expr -# define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE3(ct, sig0, sig1, sig2, expr) \ - decltype expr #else # define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(ct, sig, expr) \ - BOOST_ASIO_INITFN_RESULT_TYPE(ct, sig) + decltype expr # define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE2(ct, sig0, sig1, expr) \ - BOOST_ASIO_INITFN_RESULT_TYPE2(ct, sig0, sig1) + decltype expr # define BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE3(ct, sig0, sig1, sig2, expr) \ - BOOST_ASIO_INITFN_RESULT_TYPE3(ct, sig0, sig1, sig2) + decltype expr #endif #if defined(GENERATING_DOCUMENTATION) @@ -871,326 +547,57 @@ template void_or_deduced async_initiate( - BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken), - BOOST_ASIO_MOVE_ARG(Args)... args); + Initiation&& initiation, + type_identity_t& token, + Args&&... args); -#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) +#else // defined(GENERATING_DOCUMENTATION) template -inline typename constraint< +inline auto async_initiate(Initiation&& initiation, + type_identity_t& token, Args&&... args) + -> constraint_t< detail::async_result_has_initiate_memfn< CompletionToken, Signatures...>::value, - BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(CompletionToken, Signatures..., - (async_result::type, - Signatures...>::initiate(declval(), - declval(), - declval()...)))>::type -async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, - BOOST_ASIO_MOVE_ARG(Args)... args) + decltype( + async_result, Signatures...>::initiate( + static_cast(initiation), + static_cast(token), + static_cast(args)...))> { - return async_result::type, - Signatures...>::initiate(BOOST_ASIO_MOVE_CAST(Initiation)(initiation), - BOOST_ASIO_MOVE_CAST(CompletionToken)(token), - BOOST_ASIO_MOVE_CAST(Args)(args)...); + return async_result, Signatures...>::initiate( + static_cast(initiation), + static_cast(token), + static_cast(args)...); } template -inline typename constraint< +inline constraint_t< !detail::async_result_has_initiate_memfn< CompletionToken, Signatures...>::value, - BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, Signatures...)>::type -async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, - BOOST_ASIO_MOVE_ARG(Args)... args) + typename async_result, Signatures...>::return_type> +async_initiate(Initiation&& initiation, + type_identity_t& token, Args&&... args) { async_completion completion(token); - BOOST_ASIO_MOVE_CAST(Initiation)(initiation)( - BOOST_ASIO_MOVE_CAST(BOOST_ASIO_HANDLER_TYPE(CompletionToken, - Signatures...))(completion.completion_handler), - BOOST_ASIO_MOVE_CAST(Args)(args)...); + static_cast(initiation)( + static_cast< + typename async_result, + Signatures...>::completion_handler_type&&>( + completion.completion_handler), + static_cast(args)...); return completion.result.get(); } -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) +#endif // defined(GENERATING_DOCUMENTATION) -template -inline typename constraint< - detail::async_result_has_initiate_memfn< - CompletionToken, Sig0>::value, - BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(CompletionToken, Sig0, - (async_result::type, - Sig0>::initiate(declval(), - declval())))>::type -async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token) -{ - return async_result::type, - Sig0>::initiate(BOOST_ASIO_MOVE_CAST(Initiation)(initiation), - BOOST_ASIO_MOVE_CAST(CompletionToken)(token)); -} - -template -inline typename constraint< - detail::async_result_has_initiate_memfn< - CompletionToken, Sig0, Sig1>::value, - BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE2(CompletionToken, Sig0, Sig1, - (async_result::type, - Sig0, Sig1>::initiate(declval(), - declval())))>::type -async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token) -{ - return async_result::type, - Sig0, Sig1>::initiate(BOOST_ASIO_MOVE_CAST(Initiation)(initiation), - BOOST_ASIO_MOVE_CAST(CompletionToken)(token)); -} - -template -inline typename constraint< - detail::async_result_has_initiate_memfn< - CompletionToken, Sig0, Sig1, Sig2>::value, - BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE3(CompletionToken, Sig0, Sig1, Sig2, - (async_result::type, - Sig0, Sig1, Sig2>::initiate(declval(), - declval())))>::type -async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token) -{ - return async_result::type, - Sig0, Sig1, Sig2>::initiate(BOOST_ASIO_MOVE_CAST(Initiation)(initiation), - BOOST_ASIO_MOVE_CAST(CompletionToken)(token)); -} - -template -inline typename constraint< - !detail::async_result_has_initiate_memfn< - CompletionToken, Sig0>::value, - BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, Sig0)>::type -async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token) -{ - async_completion completion(token); - - BOOST_ASIO_MOVE_CAST(Initiation)(initiation)( - BOOST_ASIO_MOVE_CAST(BOOST_ASIO_HANDLER_TYPE(CompletionToken, - Sig0))(completion.completion_handler)); - - return completion.result.get(); -} - -template -inline typename constraint< - !detail::async_result_has_initiate_memfn< - CompletionToken, Sig0, Sig1>::value, - BOOST_ASIO_INITFN_RESULT_TYPE2(CompletionToken, Sig0, Sig1)>::type -async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token) -{ - async_completion completion(token); - - BOOST_ASIO_MOVE_CAST(Initiation)(initiation)( - BOOST_ASIO_MOVE_CAST(BOOST_ASIO_HANDLER_TYPE2(CompletionToken, - Sig0, Sig1))(completion.completion_handler)); - - return completion.result.get(); -} - -template -inline typename constraint< - !detail::async_result_has_initiate_memfn< - CompletionToken, Sig0, Sig1, Sig2>::value, - BOOST_ASIO_INITFN_RESULT_TYPE3(CompletionToken, Sig0, Sig1, Sig2)>::type -async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token) -{ - async_completion completion(token); - - BOOST_ASIO_MOVE_CAST(Initiation)(initiation)( - BOOST_ASIO_MOVE_CAST(BOOST_ASIO_HANDLER_TYPE3(CompletionToken, - Sig0, Sig1, Sig2))(completion.completion_handler)); - - return completion.result.get(); -} - -#define BOOST_ASIO_PRIVATE_INITIATE_DEF(n) \ - template \ - inline typename constraint< \ - detail::async_result_has_initiate_memfn< \ - CompletionToken, Sig0>::value, \ - BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE( \ - CompletionToken, Sig0, \ - (async_result::type, \ - Sig0>::initiate( \ - declval(), \ - declval(), \ - BOOST_ASIO_VARIADIC_MOVE_DECLVAL(n))))>::type \ - async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, \ - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - return async_result::type, \ - Sig0>::initiate( \ - BOOST_ASIO_MOVE_CAST(Initiation)(initiation), \ - BOOST_ASIO_MOVE_CAST(CompletionToken)(token), \ - BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - \ - template \ - inline typename constraint< \ - detail::async_result_has_initiate_memfn< \ - CompletionToken, Sig0, Sig1>::value, \ - BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE2( \ - CompletionToken, Sig0, Sig1, \ - (async_result::type, \ - Sig0, Sig1>::initiate( \ - declval(), \ - declval(), \ - BOOST_ASIO_VARIADIC_MOVE_DECLVAL(n))))>::type \ - async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, \ - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - return async_result::type, \ - Sig0, Sig1>::initiate( \ - BOOST_ASIO_MOVE_CAST(Initiation)(initiation), \ - BOOST_ASIO_MOVE_CAST(CompletionToken)(token), \ - BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - \ - template \ - inline typename constraint< \ - detail::async_result_has_initiate_memfn< \ - CompletionToken, Sig0, Sig1, Sig2>::value, \ - BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE3( \ - CompletionToken, Sig0, Sig1, Sig2, \ - (async_result::type, \ - Sig0, Sig1, Sig2>::initiate( \ - declval(), \ - declval(), \ - BOOST_ASIO_VARIADIC_MOVE_DECLVAL(n))))>::type \ - async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, \ - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - return async_result::type, \ - Sig0, Sig1, Sig2>::initiate( \ - BOOST_ASIO_MOVE_CAST(Initiation)(initiation), \ - BOOST_ASIO_MOVE_CAST(CompletionToken)(token), \ - BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - \ - template \ - inline typename constraint< \ - !detail::async_result_has_initiate_memfn< \ - CompletionToken, Sig0>::value, \ - BOOST_ASIO_INITFN_RESULT_TYPE(CompletionToken, Sig0)>::type \ - async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, \ - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - async_completion completion(token); \ - \ - BOOST_ASIO_MOVE_CAST(Initiation)(initiation)( \ - BOOST_ASIO_MOVE_CAST(BOOST_ASIO_HANDLER_TYPE(CompletionToken, \ - Sig0))(completion.completion_handler), \ - BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - \ - return completion.result.get(); \ - } \ - \ - template \ - inline typename constraint< \ - !detail::async_result_has_initiate_memfn< \ - CompletionToken, Sig0, Sig1>::value, \ - BOOST_ASIO_INITFN_RESULT_TYPE2(CompletionToken, Sig0, Sig1)>::type \ - async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, \ - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - async_completion completion(token); \ - \ - BOOST_ASIO_MOVE_CAST(Initiation)(initiation)( \ - BOOST_ASIO_MOVE_CAST(BOOST_ASIO_HANDLER_TYPE2(CompletionToken, \ - Sig0, Sig1))(completion.completion_handler), \ - BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - \ - return completion.result.get(); \ - } \ - \ - template \ - inline typename constraint< \ - !detail::async_result_has_initiate_memfn< \ - CompletionToken, Sig0, Sig1, Sig2>::value, \ - BOOST_ASIO_INITFN_RESULT_TYPE3(CompletionToken, Sig0, Sig1, Sig2)>::type \ - async_initiate(BOOST_ASIO_MOVE_ARG(Initiation) initiation, \ - BOOST_ASIO_NONDEDUCED_MOVE_ARG(CompletionToken) token, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - async_completion completion(token); \ - \ - BOOST_ASIO_MOVE_CAST(Initiation)(initiation)( \ - BOOST_ASIO_MOVE_CAST(BOOST_ASIO_HANDLER_TYPE3(CompletionToken, \ - Sig0, Sig1, Sig2))(completion.completion_handler), \ - BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - \ - return completion.result.get(); \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_INITIATE_DEF) -#undef BOOST_ASIO_PRIVATE_INITIATE_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#if defined(BOOST_ASIO_HAS_CONCEPTS) \ - && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) \ - && defined(BOOST_ASIO_HAS_DECLTYPE) +#if defined(BOOST_ASIO_HAS_CONCEPTS) namespace detail { @@ -1223,16 +630,12 @@ BOOST_ASIO_CONCEPT completion_token_for = ::boost::asio::completion_token_for #else // defined(BOOST_ASIO_HAS_CONCEPTS) - // && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - // && defined(BOOST_ASIO_HAS_DECLTYPE) #define BOOST_ASIO_COMPLETION_TOKEN_FOR(sig) typename #define BOOST_ASIO_COMPLETION_TOKEN_FOR2(sig0, sig1) typename #define BOOST_ASIO_COMPLETION_TOKEN_FOR3(sig0, sig1, sig2) typename #endif // defined(BOOST_ASIO_HAS_CONCEPTS) - // && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - // && defined(BOOST_ASIO_HAS_DECLTYPE) namespace detail { @@ -1246,21 +649,21 @@ struct is_async_operation_call : false_type template struct is_async_operation_call::type, + result_of_t, async_operation_probe_result >::value - >::type - >::type> : true_type + > + > + > : true_type { }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) template class async_result @@ -1269,56 +672,13 @@ public: typedef detail::async_operation_probe_result return_type; template - static return_type initiate(BOOST_ASIO_MOVE_ARG(Initiation), - detail::async_operation_probe, BOOST_ASIO_MOVE_ARG(InitArgs)...) + static return_type initiate(Initiation&&, + detail::async_operation_probe, InitArgs&&...) { return return_type(); } }; -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -namespace detail { - -struct async_result_probe_base -{ - typedef detail::async_operation_probe_result return_type; - - template - static return_type initiate(BOOST_ASIO_MOVE_ARG(Initiation), - detail::async_operation_probe) - { - return return_type(); - } - -#define BOOST_ASIO_PRIVATE_INITIATE_DEF(n) \ - template \ - static return_type initiate(BOOST_ASIO_MOVE_ARG(Initiation), \ - detail::async_operation_probe, \ - BOOST_ASIO_VARIADIC_UNNAMED_MOVE_PARAMS(n)) \ - { \ - return return_type(); \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_INITIATE_DEF) -#undef BOOST_ASIO_PRIVATE_INITIATE_DEF -}; - -} // namespace detail - -template -class async_result - : public detail::async_result_probe_base {}; - -template -class async_result - : public detail::async_result_probe_base {}; - -template -class async_result - : public detail::async_result_probe_base {}; - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) #endif // !defined(GENERATING_DOCUMENTATION) #if defined(GENERATING_DOCUMENTATION) @@ -1336,7 +696,7 @@ struct is_async_operation : integral_constant { }; -#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) +#else // defined(GENERATING_DOCUMENTATION) template struct is_async_operation : @@ -1345,35 +705,9 @@ struct is_async_operation : { }; -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) +#endif // defined(GENERATING_DOCUMENTATION) -template -struct is_async_operation; - -template -struct is_async_operation : - detail::is_async_operation_call< - T(detail::async_operation_probe)> -{ -}; - -#define BOOST_ASIO_PRIVATE_IS_ASYNC_OP_DEF(n) \ - template \ - struct is_async_operation : \ - detail::is_async_operation_call< \ - T(BOOST_ASIO_VARIADIC_TARGS(n), detail::async_operation_probe)> \ - { \ - }; \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_IS_ASYNC_OP_DEF) -#undef BOOST_ASIO_PRIVATE_IS_ASYNC_OP_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -#if defined(BOOST_ASIO_HAS_CONCEPTS) \ - && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) +#if defined(BOOST_ASIO_HAS_CONCEPTS) template BOOST_ASIO_CONCEPT async_operation = is_async_operation::value; @@ -1388,7 +722,6 @@ BOOST_ASIO_CONCEPT async_operation = is_async_operation::value; ::boost::asio::async_operation #else // defined(BOOST_ASIO_HAS_CONCEPTS) - // && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) #define BOOST_ASIO_ASYNC_OPERATION(t) typename #define BOOST_ASIO_ASYNC_OPERATION1(t, a0) typename @@ -1396,14 +729,11 @@ BOOST_ASIO_CONCEPT async_operation = is_async_operation::value; #define BOOST_ASIO_ASYNC_OPERATION3(t, a0, a1, a2) typename #endif // defined(BOOST_ASIO_HAS_CONCEPTS) - // && defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) namespace detail { struct completion_signature_probe {}; -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - template struct completion_signature_probe_result { @@ -1436,25 +766,9 @@ struct completion_signature_probe_result }; }; -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template -struct completion_signature_probe_result -{ - typedef T type; -}; - -template <> -struct completion_signature_probe_result -{ -}; - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - } // namespace detail #if !defined(GENERATING_DOCUMENTATION) -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) template class async_result @@ -1463,8 +777,8 @@ public: typedef detail::completion_signature_probe_result return_type; template - static return_type initiate(BOOST_ASIO_MOVE_ARG(Initiation), - detail::completion_signature_probe, BOOST_ASIO_MOVE_ARG(InitArgs)...) + static return_type initiate(Initiation&&, + detail::completion_signature_probe, InitArgs&&...) { return return_type(); } @@ -1477,62 +791,13 @@ public: typedef detail::completion_signature_probe_result return_type; template - static return_type initiate(BOOST_ASIO_MOVE_ARG(Initiation), - detail::completion_signature_probe, BOOST_ASIO_MOVE_ARG(InitArgs)...) + static return_type initiate(Initiation&&, + detail::completion_signature_probe, InitArgs&&...) { return return_type(); } }; -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -namespace detail { - -template -class async_result_sig_probe_base -{ -public: - typedef detail::completion_signature_probe_result return_type; - - template - static return_type initiate(BOOST_ASIO_MOVE_ARG(Initiation), - detail::async_operation_probe) - { - return return_type(); - } - -#define BOOST_ASIO_PRIVATE_INITIATE_DEF(n) \ - template \ - static return_type initiate(BOOST_ASIO_MOVE_ARG(Initiation), \ - detail::completion_signature_probe, \ - BOOST_ASIO_VARIADIC_UNNAMED_MOVE_PARAMS(n)) \ - { \ - return return_type(); \ - } \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_INITIATE_DEF) -#undef BOOST_ASIO_PRIVATE_INITIATE_DEF -}; - -} // namespace detail - -template <> -class async_result - : public detail::async_result_sig_probe_base {}; - -template -class async_result - : public detail::async_result_sig_probe_base {}; - -template -class async_result - : public detail::async_result_sig_probe_base {}; - -template -class async_result - : public detail::async_result_sig_probe_base {}; - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) #endif // !defined(GENERATING_DOCUMENTATION) #if defined(GENERATING_DOCUMENTATION) @@ -1555,50 +820,19 @@ struct completion_signature_of typedef automatically_determined type; }; -template -using completion_signature_of_t = - typename completion_signature_of::type; - -#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) +#else // defined(GENERATING_DOCUMENTATION) template struct completion_signature_of : - result_of::type + result_of_t { }; -#if defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) +#endif // defined(GENERATING_DOCUMENTATION) + template using completion_signature_of_t = typename completion_signature_of::type; -#endif // defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) - -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -template -struct completion_signature_of; - -template -struct completion_signature_of : - result_of::type -{ -}; - -#define BOOST_ASIO_PRIVATE_COMPLETION_SIG_OF_DEF(n) \ - template \ - struct completion_signature_of : \ - result_of< \ - T(BOOST_ASIO_VARIADIC_TARGS(n), \ - detail::completion_signature_probe)>::type \ - { \ - }; \ - /**/ - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_COMPLETION_SIG_OF_DEF) -#undef BOOST_ASIO_PRIVATE_COMPLETION_SIG_OF_DEF - -#endif // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) namespace detail { @@ -1610,7 +844,8 @@ struct default_completion_token_impl template struct default_completion_token_impl::type> + void_t + > { typedef typename T::default_completion_token_type type; }; @@ -1644,27 +879,14 @@ struct default_completion_token }; #endif -#if defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) - template using default_completion_token_t = typename default_completion_token::type; -#endif // defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES) - -#if defined(BOOST_ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS) - #define BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(e) \ = typename ::boost::asio::default_completion_token::type #define BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(e) \ = typename ::boost::asio::default_completion_token::type() -#else // defined(BOOST_ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS) - -#define BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(e) -#define BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(e) - -#endif // defined(BOOST_ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS) - } // namespace asio } // namespace boost diff --git a/include/boost/asio/basic_datagram_socket.hpp b/include/boost/asio/basic_datagram_socket.hpp index 7f6326bf..c2287db7 100644 --- a/include/boost/asio/basic_datagram_socket.hpp +++ b/include/boost/asio/basic_datagram_socket.hpp @@ -114,9 +114,9 @@ public: */ template explicit basic_datagram_socket(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : basic_socket(context) { } @@ -152,10 +152,10 @@ public: template basic_datagram_socket(ExecutionContext& context, const protocol_type& protocol, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_socket(context, protocol) { } @@ -199,9 +199,9 @@ public: template basic_datagram_socket(ExecutionContext& context, const endpoint_type& endpoint, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : basic_socket(context, endpoint) { } @@ -244,14 +244,13 @@ public: template basic_datagram_socket(ExecutionContext& context, const protocol_type& protocol, const native_handle_type& native_socket, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : basic_socket(context, protocol, native_socket) { } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_datagram_socket from another. /** * This constructor moves a datagram socket from one object to another. @@ -263,7 +262,7 @@ public: * constructed using the @c basic_datagram_socket(const executor_type&) * constructor. */ - basic_datagram_socket(basic_datagram_socket&& other) BOOST_ASIO_NOEXCEPT + basic_datagram_socket(basic_datagram_socket&& other) noexcept : basic_socket(std::move(other)) { } @@ -300,10 +299,10 @@ public: */ template basic_datagram_socket(basic_datagram_socket&& other, - typename constraint< + constraint_t< is_convertible::value && is_convertible::value - >::type = 0) + > = 0) : basic_socket(std::move(other)) { } @@ -322,16 +321,15 @@ public: * constructor. */ template - typename constraint< + constraint_t< is_convertible::value && is_convertible::value, basic_datagram_socket& - >::type operator=(basic_datagram_socket&& other) + > operator=(basic_datagram_socket&& other) { basic_socket::operator=(std::move(other)); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destroys the socket. /** @@ -480,18 +478,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_send(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) WriteToken = default_completion_token_t> + auto async_send(const ConstBufferSequence& buffers, + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, socket_base::message_flags(0)))) + buffers, socket_base::message_flags(0))) { return async_initiate( @@ -545,18 +539,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_send(const ConstBufferSequence& buffers, + std::size_t)) WriteToken = default_completion_token_t> + auto async_send(const ConstBufferSequence& buffers, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers, flags))) + declval(), token, buffers, flags)) { return async_initiate( @@ -706,19 +696,15 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_send_to(const ConstBufferSequence& buffers, + std::size_t)) WriteToken = default_completion_token_t> + auto async_send_to(const ConstBufferSequence& buffers, const endpoint_type& destination, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, buffers, - destination, socket_base::message_flags(0)))) + destination, socket_base::message_flags(0))) { return async_initiate( @@ -771,19 +757,15 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_send_to(const ConstBufferSequence& buffers, + std::size_t)) WriteToken = default_completion_token_t> + auto async_send_to(const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, destination, flags))) + buffers, destination, flags)) { return async_initiate( @@ -934,18 +916,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) ReadToken = default_completion_token_t> + auto async_receive(const MutableBufferSequence& buffers, + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, socket_base::message_flags(0)))) + buffers, socket_base::message_flags(0))) { return async_initiate( @@ -999,18 +977,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, + std::size_t)) ReadToken = default_completion_token_t> + auto async_receive(const MutableBufferSequence& buffers, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers, flags))) + declval(), token, buffers, flags)) { return async_initiate( @@ -1160,19 +1134,15 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_receive_from(const MutableBufferSequence& buffers, + std::size_t)) ReadToken = default_completion_token_t> + auto async_receive_from(const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, buffers, - &sender_endpoint, socket_base::message_flags(0)))) + &sender_endpoint, socket_base::message_flags(0))) { return async_initiate( @@ -1227,19 +1197,15 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_receive_from(const MutableBufferSequence& buffers, + std::size_t)) ReadToken = default_completion_token_t> + auto async_receive_from(const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, &sender_endpoint, flags))) + buffers, &sender_endpoint, flags)) { return async_initiate( @@ -1249,9 +1215,9 @@ public: private: // Disallow copying and assignment. - basic_datagram_socket(const basic_datagram_socket&) BOOST_ASIO_DELETED; + basic_datagram_socket(const basic_datagram_socket&) = delete; basic_datagram_socket& operator=( - const basic_datagram_socket&) BOOST_ASIO_DELETED; + const basic_datagram_socket&) = delete; class initiate_async_send { @@ -1263,13 +1229,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler, + void operator()(WriteHandler&& handler, const ConstBufferSequence& buffers, socket_base::message_flags flags) const { @@ -1297,13 +1263,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler, + void operator()(WriteHandler&& handler, const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags) const { @@ -1331,13 +1297,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler, + void operator()(ReadHandler&& handler, const MutableBufferSequence& buffers, socket_base::message_flags flags) const { @@ -1365,13 +1331,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler, + void operator()(ReadHandler&& handler, const MutableBufferSequence& buffers, endpoint_type* sender_endpoint, socket_base::message_flags flags) const { diff --git a/include/boost/asio/basic_deadline_timer.hpp b/include/boost/asio/basic_deadline_timer.hpp index 47796ad4..0ef81efa 100644 --- a/include/boost/asio/basic_deadline_timer.hpp +++ b/include/boost/asio/basic_deadline_timer.hpp @@ -179,9 +179,9 @@ public: */ template explicit basic_deadline_timer(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { } @@ -217,9 +217,9 @@ public: */ template basic_deadline_timer(ExecutionContext& context, const time_type& expiry_time, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -261,9 +261,9 @@ public: template basic_deadline_timer(ExecutionContext& context, const duration_type& expiry_time, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -272,7 +272,6 @@ public: boost::asio::detail::throw_error(ec, "expires_from_now"); } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_deadline_timer from another. /** * This constructor moves a timer from one object to another. @@ -306,7 +305,6 @@ public: impl_ = std::move(other.impl_); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destroys the timer. /** @@ -318,7 +316,7 @@ public: } /// Get the executor associated with the object. - const executor_type& get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() noexcept { return impl_.get_executor(); } @@ -650,15 +648,12 @@ public: */ template < BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code)) - WaitToken BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)> - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WaitToken, - void (boost::system::error_code)) - async_wait( - BOOST_ASIO_MOVE_ARG(WaitToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + WaitToken = default_completion_token_t> + auto async_wait( + WaitToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token))) + declval(), token)) { return async_initiate( initiate_async_wait(this), token); @@ -666,9 +661,9 @@ public: private: // Disallow copying and assignment. - basic_deadline_timer(const basic_deadline_timer&) BOOST_ASIO_DELETED; + basic_deadline_timer(const basic_deadline_timer&) = delete; basic_deadline_timer& operator=( - const basic_deadline_timer&) BOOST_ASIO_DELETED; + const basic_deadline_timer&) = delete; class initiate_async_wait { @@ -680,13 +675,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) const + void operator()(WaitHandler&& handler) const { // If you get an error on the following line it means that your handler // does not meet the documented type requirements for a WaitHandler. diff --git a/include/boost/asio/basic_file.hpp b/include/boost/asio/basic_file.hpp index 6bac363c..8b7fcb6e 100644 --- a/include/boost/asio/basic_file.hpp +++ b/include/boost/asio/basic_file.hpp @@ -21,6 +21,7 @@ || defined(GENERATING_DOCUMENTATION) #include +#include #include #include #include @@ -39,10 +40,6 @@ # include #endif -#if defined(BOOST_ASIO_HAS_MOVE) -# include -#endif // defined(BOOST_ASIO_HAS_MOVE) - #include namespace boost { @@ -113,10 +110,10 @@ public: */ template explicit basic_file(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { } @@ -158,10 +155,10 @@ public: template explicit basic_file(ExecutionContext& context, const char* path, file_base::flags open_flags, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { boost::system::error_code ec; @@ -207,10 +204,10 @@ public: template explicit basic_file(ExecutionContext& context, const std::string& path, file_base::flags open_flags, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { boost::system::error_code ec; @@ -253,10 +250,10 @@ public: */ template basic_file(ExecutionContext& context, const native_handle_type& native_file, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { boost::system::error_code ec; @@ -265,7 +262,6 @@ public: boost::asio::detail::throw_error(ec, "assign"); } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_file from another. /** * This constructor moves a file from one object to another. @@ -276,7 +272,7 @@ public: * @note Following the move, the moved-from object is in the same state as if * constructed using the @c basic_file(const executor_type&) constructor. */ - basic_file(basic_file&& other) BOOST_ASIO_NOEXCEPT + basic_file(basic_file&& other) noexcept : impl_(std::move(other.impl_)) { } @@ -313,10 +309,10 @@ public: */ template basic_file(basic_file&& other, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(std::move(other.impl_)) { } @@ -332,19 +328,18 @@ public: * constructed using the @c basic_file(const executor_type&) constructor. */ template - typename constraint< + constraint_t< is_convertible::value, basic_file& - >::type operator=(basic_file&& other) + > operator=(basic_file&& other) { basic_file tmp(std::move(other)); impl_ = std::move(tmp.impl_); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get the executor associated with the object. - const executor_type& get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() noexcept { return impl_.get_executor(); } @@ -816,8 +811,8 @@ protected: private: // Disallow copying and assignment. - basic_file(const basic_file&) BOOST_ASIO_DELETED; - basic_file& operator=(const basic_file&) BOOST_ASIO_DELETED; + basic_file(const basic_file&) = delete; + basic_file& operator=(const basic_file&) = delete; }; } // namespace asio diff --git a/include/boost/asio/basic_io_object.hpp b/include/boost/asio/basic_io_object.hpp index 589b4435..1ec10b55 100644 --- a/include/boost/asio/basic_io_object.hpp +++ b/include/boost/asio/basic_io_object.hpp @@ -23,7 +23,6 @@ namespace boost { namespace asio { -#if defined(BOOST_ASIO_HAS_MOVE) namespace detail { // Type trait used to determine whether a service supports move. @@ -46,14 +45,13 @@ namespace detail static_cast(0))) == 1; }; } -#endif // defined(BOOST_ASIO_HAS_MOVE) /// Base class for all I/O objects. /** * @note All I/O objects are non-copyable. However, when using C++0x, certain * I/O objects do support move construction and move assignment. */ -#if !defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) +#if defined(GENERATING_DOCUMENTATION) template #else template class basic_io_object @@ -214,7 +211,7 @@ public: typedef boost::asio::io_context::executor_type executor_type; - executor_type get_executor() BOOST_ASIO_NOEXCEPT + executor_type get_executor() noexcept { return service_->get_io_context().get_executor(); } @@ -282,7 +279,6 @@ private: IoObjectService* service_; implementation_type implementation_; }; -#endif // defined(BOOST_ASIO_HAS_MOVE) } // namespace asio } // namespace boost diff --git a/include/boost/asio/basic_random_access_file.hpp b/include/boost/asio/basic_random_access_file.hpp index 464a66be..55129563 100644 --- a/include/boost/asio/basic_random_access_file.hpp +++ b/include/boost/asio/basic_random_access_file.hpp @@ -108,10 +108,10 @@ public: */ template explicit basic_random_access_file(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_file(context) { } @@ -154,10 +154,10 @@ public: template basic_random_access_file(ExecutionContext& context, const char* path, file_base::flags open_flags, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_file(context, path, open_flags) { } @@ -200,10 +200,10 @@ public: template basic_random_access_file(ExecutionContext& context, const std::string& path, file_base::flags open_flags, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_file(context, path, open_flags) { } @@ -242,15 +242,14 @@ public: template basic_random_access_file(ExecutionContext& context, const native_handle_type& native_file, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_file(context, native_file) { } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_random_access_file from another. /** * This constructor moves a random-access file from one object to another. @@ -262,7 +261,7 @@ public: * constructed using the @c basic_random_access_file(const executor_type&) * constructor. */ - basic_random_access_file(basic_random_access_file&& other) BOOST_ASIO_NOEXCEPT + basic_random_access_file(basic_random_access_file&& other) noexcept : basic_file(std::move(other)) { } @@ -299,10 +298,10 @@ public: */ template basic_random_access_file(basic_random_access_file&& other, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_file(std::move(other)) { } @@ -321,15 +320,14 @@ public: * constructor. */ template - typename constraint< + constraint_t< is_convertible::value, basic_random_access_file& - >::type operator=(basic_random_access_file&& other) + > operator=(basic_random_access_file&& other) { basic_file::operator=(std::move(other)); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destroys the file. /** @@ -460,18 +458,13 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_write_some_at(uint64_t offset, - const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) WriteToken = default_completion_token_t> + auto async_write_some_at(uint64_t offset, const ConstBufferSequence& buffers, + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, offset, buffers))) + declval(), token, offset, buffers)) { return async_initiate( @@ -601,18 +594,13 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_read_some_at(uint64_t offset, - const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) ReadToken = default_completion_token_t> + auto async_read_some_at(uint64_t offset, const MutableBufferSequence& buffers, + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, offset, buffers))) + declval(), token, offset, buffers)) { return async_initiate( @@ -621,9 +609,9 @@ public: private: // Disallow copying and assignment. - basic_random_access_file(const basic_random_access_file&) BOOST_ASIO_DELETED; + basic_random_access_file(const basic_random_access_file&) = delete; basic_random_access_file& operator=( - const basic_random_access_file&) BOOST_ASIO_DELETED; + const basic_random_access_file&) = delete; class initiate_async_write_some_at { @@ -635,13 +623,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler, + void operator()(WriteHandler&& handler, uint64_t offset, const ConstBufferSequence& buffers) const { // If you get an error on the following line it means that your handler @@ -668,13 +656,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler, + void operator()(ReadHandler&& handler, uint64_t offset, const MutableBufferSequence& buffers) const { // If you get an error on the following line it means that your handler diff --git a/include/boost/asio/basic_raw_socket.hpp b/include/boost/asio/basic_raw_socket.hpp index 92537100..724c2110 100644 --- a/include/boost/asio/basic_raw_socket.hpp +++ b/include/boost/asio/basic_raw_socket.hpp @@ -114,9 +114,9 @@ public: */ template explicit basic_raw_socket(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : basic_socket(context) { } @@ -151,10 +151,10 @@ public: */ template basic_raw_socket(ExecutionContext& context, const protocol_type& protocol, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_socket(context, protocol) { } @@ -197,9 +197,9 @@ public: */ template basic_raw_socket(ExecutionContext& context, const endpoint_type& endpoint, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : basic_socket(context, endpoint) { } @@ -242,14 +242,13 @@ public: template basic_raw_socket(ExecutionContext& context, const protocol_type& protocol, const native_handle_type& native_socket, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : basic_socket(context, protocol, native_socket) { } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_raw_socket from another. /** * This constructor moves a raw socket from one object to another. @@ -261,7 +260,7 @@ public: * constructed using the @c basic_raw_socket(const executor_type&) * constructor. */ - basic_raw_socket(basic_raw_socket&& other) BOOST_ASIO_NOEXCEPT + basic_raw_socket(basic_raw_socket&& other) noexcept : basic_socket(std::move(other)) { } @@ -297,10 +296,10 @@ public: */ template basic_raw_socket(basic_raw_socket&& other, - typename constraint< + constraint_t< is_convertible::value && is_convertible::value - >::type = 0) + > = 0) : basic_socket(std::move(other)) { } @@ -317,16 +316,15 @@ public: * constructor. */ template - typename constraint< + constraint_t< is_convertible::value && is_convertible::value, basic_raw_socket& - >::type operator=(basic_raw_socket&& other) + > operator=(basic_raw_socket&& other) { basic_socket::operator=(std::move(other)); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destroys the socket. /** @@ -472,18 +470,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_send(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) WriteToken = default_completion_token_t> + auto async_send(const ConstBufferSequence& buffers, + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, socket_base::message_flags(0)))) + buffers, socket_base::message_flags(0))) { return async_initiate( @@ -537,18 +531,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_send(const ConstBufferSequence& buffers, + std::size_t)) WriteToken = default_completion_token_t> + auto async_send(const ConstBufferSequence& buffers, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers, flags))) + declval(), token, buffers, flags)) { return async_initiate( @@ -698,19 +688,15 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_send_to(const ConstBufferSequence& buffers, + std::size_t)) WriteToken = default_completion_token_t> + auto async_send_to(const ConstBufferSequence& buffers, const endpoint_type& destination, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, buffers, - destination, socket_base::message_flags(0)))) + destination, socket_base::message_flags(0))) { return async_initiate( @@ -763,19 +749,15 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_send_to(const ConstBufferSequence& buffers, + std::size_t)) WriteToken = default_completion_token_t> + auto async_send_to(const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, destination, flags))) + buffers, destination, flags)) { return async_initiate( @@ -926,18 +908,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) ReadToken = default_completion_token_t> + auto async_receive(const MutableBufferSequence& buffers, + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, socket_base::message_flags(0)))) + buffers, socket_base::message_flags(0))) { return async_initiate( @@ -992,17 +970,14 @@ public: template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, + = default_completion_token_t> + auto async_receive(const MutableBufferSequence& buffers, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers, flags))) + declval(), token, buffers, flags)) { return async_initiate( @@ -1152,19 +1127,16 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_receive_from(const MutableBufferSequence& buffers, + std::size_t)) ReadToken = default_completion_token_t> + auto async_receive_from(const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + ReadToken&& token + = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, buffers, - &sender_endpoint, socket_base::message_flags(0)))) + &sender_endpoint, socket_base::message_flags(0))) { return async_initiate( @@ -1220,18 +1192,15 @@ public: template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_receive_from(const MutableBufferSequence& buffers, + = default_completion_token_t> + auto async_receive_from(const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, &sender_endpoint, flags))) + buffers, &sender_endpoint, flags)) { return async_initiate( @@ -1241,8 +1210,8 @@ public: private: // Disallow copying and assignment. - basic_raw_socket(const basic_raw_socket&) BOOST_ASIO_DELETED; - basic_raw_socket& operator=(const basic_raw_socket&) BOOST_ASIO_DELETED; + basic_raw_socket(const basic_raw_socket&) = delete; + basic_raw_socket& operator=(const basic_raw_socket&) = delete; class initiate_async_send { @@ -1254,13 +1223,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler, + void operator()(WriteHandler&& handler, const ConstBufferSequence& buffers, socket_base::message_flags flags) const { @@ -1288,13 +1257,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler, + void operator()(WriteHandler&& handler, const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags) const { @@ -1322,13 +1291,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler, + void operator()(ReadHandler&& handler, const MutableBufferSequence& buffers, socket_base::message_flags flags) const { @@ -1356,13 +1325,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler, + void operator()(ReadHandler&& handler, const MutableBufferSequence& buffers, endpoint_type* sender_endpoint, socket_base::message_flags flags) const { diff --git a/include/boost/asio/basic_readable_pipe.hpp b/include/boost/asio/basic_readable_pipe.hpp index 28404a94..ab737ba4 100644 --- a/include/boost/asio/basic_readable_pipe.hpp +++ b/include/boost/asio/basic_readable_pipe.hpp @@ -21,6 +21,7 @@ || defined(GENERATING_DOCUMENTATION) #include +#include #include #include #include @@ -38,10 +39,6 @@ # include #endif -#if defined(BOOST_ASIO_HAS_MOVE) -# include -#endif // defined(BOOST_ASIO_HAS_MOVE) - #include namespace boost { @@ -113,10 +110,10 @@ public: */ template explicit basic_readable_pipe(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { } @@ -160,9 +157,9 @@ public: template basic_readable_pipe(ExecutionContext& context, const native_handle_type& native_pipe, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -171,7 +168,6 @@ public: boost::asio::detail::throw_error(ec, "assign"); } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_readable_pipe from another. /** * This constructor moves a pipe from one object to another. @@ -222,10 +218,10 @@ public: */ template basic_readable_pipe(basic_readable_pipe&& other, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(std::move(other.impl_)) { } @@ -242,16 +238,15 @@ public: * constructor. */ template - typename constraint< + constraint_t< is_convertible::value, basic_readable_pipe& - >::type operator=(basic_readable_pipe&& other) + > operator=(basic_readable_pipe&& other) { basic_readable_pipe tmp(std::move(other)); impl_ = std::move(tmp.impl_); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destroys the pipe. /** @@ -264,7 +259,7 @@ public: } /// Get the executor associated with the object. - const executor_type& get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() noexcept { return impl_.get_executor(); } @@ -562,17 +557,13 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) ReadToken = default_completion_token_t> + auto async_read_some(const MutableBufferSequence& buffers, + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers))) + declval(), token, buffers)) { return async_initiate( @@ -581,8 +572,8 @@ public: private: // Disallow copying and assignment. - basic_readable_pipe(const basic_readable_pipe&) BOOST_ASIO_DELETED; - basic_readable_pipe& operator=(const basic_readable_pipe&) BOOST_ASIO_DELETED; + basic_readable_pipe(const basic_readable_pipe&) = delete; + basic_readable_pipe& operator=(const basic_readable_pipe&) = delete; class initiate_async_read_some { @@ -594,13 +585,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler, + void operator()(ReadHandler&& handler, const MutableBufferSequence& buffers) const { // If you get an error on the following line it means that your handler diff --git a/include/boost/asio/basic_seq_packet_socket.hpp b/include/boost/asio/basic_seq_packet_socket.hpp index 8ed9b1fd..f03f388b 100644 --- a/include/boost/asio/basic_seq_packet_socket.hpp +++ b/include/boost/asio/basic_seq_packet_socket.hpp @@ -112,9 +112,9 @@ public: */ template explicit basic_seq_packet_socket(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : basic_socket(context) { } @@ -155,10 +155,10 @@ public: template basic_seq_packet_socket(ExecutionContext& context, const protocol_type& protocol, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_socket(context, protocol) { } @@ -203,9 +203,9 @@ public: template basic_seq_packet_socket(ExecutionContext& context, const endpoint_type& endpoint, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : basic_socket(context, endpoint) { } @@ -248,14 +248,13 @@ public: template basic_seq_packet_socket(ExecutionContext& context, const protocol_type& protocol, const native_handle_type& native_socket, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : basic_socket(context, protocol, native_socket) { } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_seq_packet_socket from another. /** * This constructor moves a sequenced packet socket from one object to @@ -268,7 +267,7 @@ public: * constructed using the @c basic_seq_packet_socket(const executor_type&) * constructor. */ - basic_seq_packet_socket(basic_seq_packet_socket&& other) BOOST_ASIO_NOEXCEPT + basic_seq_packet_socket(basic_seq_packet_socket&& other) noexcept : basic_socket(std::move(other)) { } @@ -306,10 +305,10 @@ public: */ template basic_seq_packet_socket(basic_seq_packet_socket&& other, - typename constraint< + constraint_t< is_convertible::value && is_convertible::value - >::type = 0) + > = 0) : basic_socket(std::move(other)) { } @@ -328,16 +327,15 @@ public: * constructor. */ template - typename constraint< + constraint_t< is_convertible::value && is_convertible::value, basic_seq_packet_socket& - >::type operator=(basic_seq_packet_socket&& other) + > operator=(basic_seq_packet_socket&& other) { basic_socket::operator=(std::move(other)); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destroys the socket. /** @@ -460,17 +458,15 @@ public: template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_send(const ConstBufferSequence& buffers, + = default_completion_token_t> + auto async_send(const ConstBufferSequence& buffers, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + WriteToken&& token + = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers, flags))) + declval(), token, buffers, flags)) { return async_initiate( @@ -652,19 +648,15 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, + std::size_t)) ReadToken = default_completion_token_t> + auto async_receive(const MutableBufferSequence& buffers, socket_base::message_flags& out_flags, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, socket_base::message_flags(0), &out_flags))) + buffers, socket_base::message_flags(0), &out_flags)) { return async_initiate( @@ -732,20 +724,16 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, + std::size_t)) ReadToken = default_completion_token_t> + auto async_receive(const MutableBufferSequence& buffers, socket_base::message_flags in_flags, socket_base::message_flags& out_flags, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), - token, buffers, in_flags, &out_flags))) + token, buffers, in_flags, &out_flags)) { return async_initiate( @@ -755,9 +743,9 @@ public: private: // Disallow copying and assignment. - basic_seq_packet_socket(const basic_seq_packet_socket&) BOOST_ASIO_DELETED; + basic_seq_packet_socket(const basic_seq_packet_socket&) = delete; basic_seq_packet_socket& operator=( - const basic_seq_packet_socket&) BOOST_ASIO_DELETED; + const basic_seq_packet_socket&) = delete; class initiate_async_send { @@ -769,13 +757,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler, + void operator()(WriteHandler&& handler, const ConstBufferSequence& buffers, socket_base::message_flags flags) const { @@ -803,13 +791,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler, + void operator()(ReadHandler&& handler, const MutableBufferSequence& buffers, socket_base::message_flags in_flags, socket_base::message_flags* out_flags) const diff --git a/include/boost/asio/basic_serial_port.hpp b/include/boost/asio/basic_serial_port.hpp index 503406c7..835ed016 100644 --- a/include/boost/asio/basic_serial_port.hpp +++ b/include/boost/asio/basic_serial_port.hpp @@ -22,6 +22,7 @@ || defined(GENERATING_DOCUMENTATION) #include +#include #include #include #include @@ -38,10 +39,6 @@ # include #endif -#if defined(BOOST_ASIO_HAS_MOVE) -# include -#endif // defined(BOOST_ASIO_HAS_MOVE) - #include namespace boost { @@ -113,10 +110,10 @@ public: */ template explicit basic_serial_port(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { } @@ -155,9 +152,9 @@ public: */ template basic_serial_port(ExecutionContext& context, const char* device, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -199,9 +196,9 @@ public: */ template basic_serial_port(ExecutionContext& context, const std::string& device, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -248,9 +245,9 @@ public: template basic_serial_port(ExecutionContext& context, const native_handle_type& native_serial_port, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -259,7 +256,6 @@ public: boost::asio::detail::throw_error(ec, "assign"); } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_serial_port from another. /** * This constructor moves a serial port from one object to another. @@ -311,10 +307,10 @@ public: */ template basic_serial_port(basic_serial_port&& other, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(std::move(other.impl_)) { } @@ -332,16 +328,15 @@ public: * constructor. */ template - typename constraint< + constraint_t< is_convertible::value, basic_serial_port& - >::type operator=(basic_serial_port&& other) + > operator=(basic_serial_port&& other) { basic_serial_port tmp(std::move(other)); impl_ = std::move(tmp.impl_); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destroys the serial port. /** @@ -354,7 +349,7 @@ public: } /// Get the executor associated with the object. - const executor_type& get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() noexcept { return impl_.get_executor(); } @@ -761,17 +756,13 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) WriteToken = default_completion_token_t> + auto async_write_some(const ConstBufferSequence& buffers, + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers))) + declval(), token, buffers)) { return async_initiate( @@ -896,17 +887,13 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) ReadToken = default_completion_token_t> + auto async_read_some(const MutableBufferSequence& buffers, + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers))) + declval(), token, buffers)) { return async_initiate( @@ -915,8 +902,8 @@ public: private: // Disallow copying and assignment. - basic_serial_port(const basic_serial_port&) BOOST_ASIO_DELETED; - basic_serial_port& operator=(const basic_serial_port&) BOOST_ASIO_DELETED; + basic_serial_port(const basic_serial_port&) = delete; + basic_serial_port& operator=(const basic_serial_port&) = delete; class initiate_async_write_some { @@ -928,13 +915,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler, + void operator()(WriteHandler&& handler, const ConstBufferSequence& buffers) const { // If you get an error on the following line it means that your handler @@ -961,13 +948,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler, + void operator()(ReadHandler&& handler, const MutableBufferSequence& buffers) const { // If you get an error on the following line it means that your handler diff --git a/include/boost/asio/basic_signal_set.hpp b/include/boost/asio/basic_signal_set.hpp index c080bdff..4753f915 100644 --- a/include/boost/asio/basic_signal_set.hpp +++ b/include/boost/asio/basic_signal_set.hpp @@ -135,10 +135,10 @@ public: */ template explicit basic_signal_set(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { } @@ -181,10 +181,10 @@ public: */ template basic_signal_set(ExecutionContext& context, int signal_number_1, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { boost::system::error_code ec; @@ -240,10 +240,10 @@ public: template basic_signal_set(ExecutionContext& context, int signal_number_1, int signal_number_2, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { boost::system::error_code ec; @@ -309,10 +309,10 @@ public: template basic_signal_set(ExecutionContext& context, int signal_number_1, int signal_number_2, int signal_number_3, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { boost::system::error_code ec; @@ -335,7 +335,7 @@ public: } /// Get the executor associated with the object. - const executor_type& get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() noexcept { return impl_.get_executor(); } @@ -591,15 +591,12 @@ public: */ template < BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, int)) - SignalToken BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)> - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(SignalToken, - void (boost::system::error_code, int)) - async_wait( - BOOST_ASIO_MOVE_ARG(SignalToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + SignalToken = default_completion_token_t> + auto async_wait( + SignalToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token))) + declval(), token)) { return async_initiate( initiate_async_wait(this), token); @@ -607,8 +604,8 @@ public: private: // Disallow copying and assignment. - basic_signal_set(const basic_signal_set&) BOOST_ASIO_DELETED; - basic_signal_set& operator=(const basic_signal_set&) BOOST_ASIO_DELETED; + basic_signal_set(const basic_signal_set&) = delete; + basic_signal_set& operator=(const basic_signal_set&) = delete; class initiate_async_wait { @@ -620,13 +617,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(SignalHandler) handler) const + void operator()(SignalHandler&& handler) const { // If you get an error on the following line it means that your handler // does not meet the documented type requirements for a SignalHandler. diff --git a/include/boost/asio/basic_socket.hpp b/include/boost/asio/basic_socket.hpp index 1bb6d280..8db1e06b 100644 --- a/include/boost/asio/basic_socket.hpp +++ b/include/boost/asio/basic_socket.hpp @@ -15,6 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#include #include #include #include @@ -38,10 +39,6 @@ # include #endif -#if defined(BOOST_ASIO_HAS_MOVE) -# include -#endif // defined(BOOST_ASIO_HAS_MOVE) - #include namespace boost { @@ -135,9 +132,9 @@ public: */ template explicit basic_socket(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { } @@ -175,10 +172,10 @@ public: */ template basic_socket(ExecutionContext& context, const protocol_type& protocol, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { boost::system::error_code ec; @@ -230,9 +227,9 @@ public: */ template basic_socket(ExecutionContext& context, const endpoint_type& endpoint, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -283,9 +280,9 @@ public: template basic_socket(ExecutionContext& context, const protocol_type& protocol, const native_handle_type& native_socket, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -294,7 +291,6 @@ public: boost::asio::detail::throw_error(ec, "assign"); } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_socket from another. /** * This constructor moves a socket from one object to another. @@ -305,7 +301,7 @@ public: * @note Following the move, the moved-from object is in the same state as if * constructed using the @c basic_socket(const executor_type&) constructor. */ - basic_socket(basic_socket&& other) BOOST_ASIO_NOEXCEPT + basic_socket(basic_socket&& other) noexcept : impl_(std::move(other.impl_)) { } @@ -342,10 +338,10 @@ public: */ template basic_socket(basic_socket&& other, - typename constraint< + constraint_t< is_convertible::value && is_convertible::value - >::type = 0) + > = 0) : impl_(std::move(other.impl_)) { } @@ -361,20 +357,19 @@ public: * constructed using the @c basic_socket(const executor_type&) constructor. */ template - typename constraint< + constraint_t< is_convertible::value && is_convertible::value, basic_socket& - >::type operator=(basic_socket&& other) + > operator=(basic_socket&& other) { basic_socket tmp(std::move(other)); impl_ = std::move(tmp.impl_); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get the executor associated with the object. - const executor_type& get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() noexcept { return impl_.get_executor(); } @@ -968,16 +963,13 @@ public: */ template < BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code)) - ConnectToken BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)> - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ConnectToken, - void (boost::system::error_code)) - async_connect(const endpoint_type& peer_endpoint, - BOOST_ASIO_MOVE_ARG(ConnectToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + ConnectToken = default_completion_token_t> + auto async_connect(const endpoint_type& peer_endpoint, + ConnectToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, - peer_endpoint, declval()))) + declval(), token, + peer_endpoint, declval())) { boost::system::error_code open_ec; if (!is_open()) @@ -1822,15 +1814,12 @@ public: */ template < BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code)) - WaitToken BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)> - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WaitToken, - void (boost::system::error_code)) - async_wait(wait_type w, - BOOST_ASIO_MOVE_ARG(WaitToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + WaitToken = default_completion_token_t> + auto async_wait(wait_type w, + WaitToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, w))) + declval(), token, w)) { return async_initiate( initiate_async_wait(this), token, w); @@ -1862,8 +1851,8 @@ protected: private: // Disallow copying and assignment. - basic_socket(const basic_socket&) BOOST_ASIO_DELETED; - basic_socket& operator=(const basic_socket&) BOOST_ASIO_DELETED; + basic_socket(const basic_socket&) = delete; + basic_socket& operator=(const basic_socket&) = delete; class initiate_async_connect { @@ -1875,13 +1864,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(ConnectHandler) handler, + void operator()(ConnectHandler&& handler, const endpoint_type& peer_endpoint, const boost::system::error_code& open_ec) const { @@ -1893,7 +1882,7 @@ private: { boost::asio::post(self_->impl_.get_executor(), boost::asio::detail::bind_handler( - BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler), open_ec)); + static_cast(handler), open_ec)); } else { @@ -1918,13 +1907,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WaitHandler) handler, wait_type w) const + void operator()(WaitHandler&& handler, wait_type w) const { // If you get an error on the following line it means that your handler // does not meet the documented type requirements for a WaitHandler. diff --git a/include/boost/asio/basic_socket_acceptor.hpp b/include/boost/asio/basic_socket_acceptor.hpp index a9d1d25e..e06ed7fa 100644 --- a/include/boost/asio/basic_socket_acceptor.hpp +++ b/include/boost/asio/basic_socket_acceptor.hpp @@ -15,6 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#include #include #include #include @@ -37,10 +38,6 @@ # include #endif -#if defined(BOOST_ASIO_HAS_MOVE) -# include -#endif // defined(BOOST_ASIO_HAS_MOVE) - #include namespace boost { @@ -152,9 +149,9 @@ public: */ template explicit basic_socket_acceptor(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { } @@ -194,10 +191,10 @@ public: template basic_socket_acceptor(ExecutionContext& context, const protocol_type& protocol, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { boost::system::error_code ec; @@ -283,9 +280,9 @@ public: template basic_socket_acceptor(ExecutionContext& context, const endpoint_type& endpoint, bool reuse_addr = true, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -348,9 +345,9 @@ public: template basic_socket_acceptor(ExecutionContext& context, const protocol_type& protocol, const native_handle_type& native_acceptor, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -359,7 +356,6 @@ public: boost::asio::detail::throw_error(ec, "assign"); } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_socket_acceptor from another. /** * This constructor moves an acceptor from one object to another. @@ -371,7 +367,7 @@ public: * constructed using the @c basic_socket_acceptor(const executor_type&) * constructor. */ - basic_socket_acceptor(basic_socket_acceptor&& other) BOOST_ASIO_NOEXCEPT + basic_socket_acceptor(basic_socket_acceptor&& other) noexcept : impl_(std::move(other.impl_)) { } @@ -411,10 +407,10 @@ public: */ template basic_socket_acceptor(basic_socket_acceptor&& other, - typename constraint< + constraint_t< is_convertible::value && is_convertible::value - >::type = 0) + > = 0) : impl_(std::move(other.impl_)) { } @@ -432,17 +428,16 @@ public: * constructor. */ template - typename constraint< + constraint_t< is_convertible::value && is_convertible::value, basic_socket_acceptor& - >::type operator=(basic_socket_acceptor&& other) + > operator=(basic_socket_acceptor&& other) { basic_socket_acceptor tmp(std::move(other)); impl_ = std::move(tmp.impl_); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destroys the acceptor. /** @@ -455,7 +450,7 @@ public: } /// Get the executor associated with the object. - const executor_type& get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() noexcept { return impl_.get_executor(); } @@ -1255,15 +1250,12 @@ public: */ template < BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code)) - WaitToken BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)> - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WaitToken, - void (boost::system::error_code)) - async_wait(wait_type w, - BOOST_ASIO_MOVE_ARG(WaitToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + WaitToken = default_completion_token_t> + auto async_wait(wait_type w, + WaitToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, w))) + declval(), token, w)) { return async_initiate( initiate_async_wait(this), token, w); @@ -1290,9 +1282,9 @@ public: */ template void accept(basic_socket& peer, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) { boost::system::error_code ec; impl_.get_service().accept(impl_.get_implementation(), @@ -1326,9 +1318,9 @@ public: template BOOST_ASIO_SYNC_OP_VOID accept( basic_socket& peer, boost::system::error_code& ec, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) { impl_.get_service().accept(impl_.get_implementation(), peer, static_cast(0), ec); @@ -1392,19 +1384,16 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(AcceptToken, - void (boost::system::error_code)) - async_accept(basic_socket& peer, - BOOST_ASIO_MOVE_ARG(AcceptToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type), - typename constraint< + AcceptToken = default_completion_token_t> + auto async_accept(basic_socket& peer, + AcceptToken&& token = default_completion_token_t(), + constraint_t< is_convertible::value - >::type = 0) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + > = 0) + -> decltype( async_initiate( - declval(), token, - &peer, static_cast(0)))) + declval(), token, + &peer, static_cast(0))) { return async_initiate( initiate_async_accept(this), token, @@ -1525,23 +1514,19 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(AcceptToken, - void (boost::system::error_code)) - async_accept(basic_socket& peer, + AcceptToken = default_completion_token_t> + auto async_accept(basic_socket& peer, endpoint_type& peer_endpoint, - BOOST_ASIO_MOVE_ARG(AcceptToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + AcceptToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, &peer, &peer_endpoint))) + declval(), token, &peer, &peer_endpoint)) { return async_initiate( initiate_async_accept(this), token, &peer, &peer_endpoint); } #endif // !defined(BOOST_ASIO_NO_EXTENSIONS) -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Accept a new connection. /** * This function is used to accept a new connection from a peer. The function @@ -1671,22 +1656,17 @@ public: BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code, typename Protocol::socket::template rebind_executor< executor_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::other)) - async_accept( - BOOST_ASIO_MOVE_ARG(MoveAcceptToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + = default_completion_token_t> + auto async_accept( + MoveAcceptToken&& token = default_completion_token_t()) + -> decltype( async_initiate::other)>( declval(), token, - declval(), static_cast(0), + declval(), static_cast(0), static_cast::other*>(0)))) + rebind_executor::other*>(0))) { return async_initiate typename Protocol::socket::template rebind_executor::other accept(const Executor1& ex, - typename constraint< + constraint_t< is_executor::value || execution::is_executor::value - >::type = 0) + > = 0) { boost::system::error_code ec; typename Protocol::socket::template @@ -1763,9 +1743,9 @@ public: typename Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type>::other accept(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) { boost::system::error_code ec; typename Protocol::socket::template rebind_executor< @@ -1806,10 +1786,10 @@ public: template typename Protocol::socket::template rebind_executor::other accept(const Executor1& ex, boost::system::error_code& ec, - typename constraint< + constraint_t< is_executor::value || execution::is_executor::value - >::type = 0) + > = 0) { typename Protocol::socket::template rebind_executor::other peer(ex); @@ -1849,9 +1829,9 @@ public: typename Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type>::other accept(ExecutionContext& context, boost::system::error_code& ec, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) { typename Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type>::other peer(context); @@ -1925,22 +1905,17 @@ public: template ::value + constraint_t::value || execution::is_executor::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< - Executor1>::other)) - async_accept(const Executor1& ex, - BOOST_ASIO_MOVE_ARG(MoveAcceptToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type), - typename constraint< + Executor1>>::other)) MoveAcceptToken + = default_completion_token_t> + auto async_accept(const Executor1& ex, + MoveAcceptToken&& token = default_completion_token_t(), + constraint_t< is_executor::value || execution::is_executor::value - >::type = 0) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + > = 0) + -> decltype( async_initiate(), token, ex, static_cast(0), static_cast::other*>(0)))) + rebind_executor::other*>(0))) { return async_initiate::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< - typename ExecutionContext::executor_type>::other)) - async_accept(ExecutionContext& context, - BOOST_ASIO_MOVE_ARG(MoveAcceptToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type), - typename constraint< + = default_completion_token_t> + auto async_accept(ExecutionContext& context, + MoveAcceptToken&& token = default_completion_token_t(), + constraint_t< is_convertible::value - >::type = 0) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + > = 0) + -> decltype( async_initiate(), token, context.get_executor(), static_cast(0), static_cast::other*>(0)))) + typename ExecutionContext::executor_type>::other*>(0))) { return async_initiate::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::other)) - async_accept(endpoint_type& peer_endpoint, - BOOST_ASIO_MOVE_ARG(MoveAcceptToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + = default_completion_token_t> + auto async_accept(endpoint_type& peer_endpoint, + MoveAcceptToken&& token = default_completion_token_t()) + -> decltype( async_initiate::other)>( declval(), token, - declval(), &peer_endpoint, + declval(), &peer_endpoint, static_cast::other*>(0)))) + rebind_executor::other*>(0))) { return async_initiate typename Protocol::socket::template rebind_executor::other accept(const Executor1& ex, endpoint_type& peer_endpoint, - typename constraint< + constraint_t< is_executor::value || execution::is_executor::value - >::type = 0) + > = 0) { boost::system::error_code ec; typename Protocol::socket::template @@ -2306,9 +2271,9 @@ public: typename Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type>::other accept(ExecutionContext& context, endpoint_type& peer_endpoint, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) { boost::system::error_code ec; typename Protocol::socket::template rebind_executor< @@ -2356,10 +2321,10 @@ public: typename Protocol::socket::template rebind_executor::other accept(const executor_type& ex, endpoint_type& peer_endpoint, boost::system::error_code& ec, - typename constraint< + constraint_t< is_executor::value || execution::is_executor::value - >::type = 0) + > = 0) { typename Protocol::socket::template rebind_executor::other peer(ex); @@ -2406,9 +2371,9 @@ public: typename ExecutionContext::executor_type>::other accept(ExecutionContext& context, endpoint_type& peer_endpoint, boost::system::error_code& ec, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) { typename Protocol::socket::template rebind_executor< typename ExecutionContext::executor_type>::other peer(context); @@ -2489,29 +2454,24 @@ public: template ::value + constraint_t::value || execution::is_executor::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< - Executor1>::other)) - async_accept(const Executor1& ex, endpoint_type& peer_endpoint, - BOOST_ASIO_MOVE_ARG(MoveAcceptToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type), - typename constraint< + Executor1>>::other)) MoveAcceptToken + = default_completion_token_t> + auto async_accept(const Executor1& ex, endpoint_type& peer_endpoint, + MoveAcceptToken&& token = default_completion_token_t(), + constraint_t< is_executor::value || execution::is_executor::value - >::type = 0) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + > = 0) + -> decltype( async_initiate::other)>( declval(), token, ex, &peer_endpoint, static_cast::other*>(0)))) + rebind_executor::other*>(0))) { return async_initiate::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< - typename ExecutionContext::executor_type>::other)) - async_accept(ExecutionContext& context, - endpoint_type& peer_endpoint, - BOOST_ASIO_MOVE_ARG(MoveAcceptToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type), - typename constraint< + = default_completion_token_t> + auto async_accept(ExecutionContext& context, endpoint_type& peer_endpoint, + MoveAcceptToken&& token = default_completion_token_t(), + constraint_t< is_convertible::value - >::type = 0) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + > = 0) + -> decltype( async_initiate(), token, context.get_executor(), &peer_endpoint, static_cast::other*>(0)))) + typename ExecutionContext::executor_type>::other*>(0))) { return async_initiate::other*>(0)); } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) private: // Disallow copying and assignment. - basic_socket_acceptor(const basic_socket_acceptor&) BOOST_ASIO_DELETED; + basic_socket_acceptor(const basic_socket_acceptor&) = delete; basic_socket_acceptor& operator=( - const basic_socket_acceptor&) BOOST_ASIO_DELETED; + const basic_socket_acceptor&) = delete; class initiate_async_wait { @@ -2644,13 +2597,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WaitHandler) handler, wait_type w) const + void operator()(WaitHandler&& handler, wait_type w) const { // If you get an error on the following line it means that your handler // does not meet the documented type requirements for a WaitHandler. @@ -2676,13 +2629,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(AcceptHandler) handler, + void operator()(AcceptHandler&& handler, basic_socket* peer, endpoint_type* peer_endpoint) const { @@ -2710,13 +2663,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(MoveAcceptHandler) handler, + void operator()(MoveAcceptHandler&& handler, const Executor1& peer_ex, endpoint_type* peer_endpoint, Socket*) const { // If you get an error on the following line it means that your handler diff --git a/include/boost/asio/basic_socket_iostream.hpp b/include/boost/asio/basic_socket_iostream.hpp index a7eb6bec..d5d324d0 100644 --- a/include/boost/asio/basic_socket_iostream.hpp +++ b/include/boost/asio/basic_socket_iostream.hpp @@ -23,55 +23,6 @@ #include #include -#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -# include - -// A macro that should expand to: -// template -// explicit basic_socket_iostream(T1 x1, ..., Tn xn) -// : std::basic_iostream( -// &this->detail::socket_iostream_base< -// Protocol, Clock, WaitTraits>::streambuf_) -// { -// if (rdbuf()->connect(x1, ..., xn) == 0) -// this->setstate(std::ios_base::failbit); -// } -// This macro should only persist within this file. - -# define BOOST_ASIO_PRIVATE_CTR_DEF(n) \ - template \ - explicit basic_socket_iostream(BOOST_ASIO_VARIADIC_BYVAL_PARAMS(n)) \ - : std::basic_iostream( \ - &this->detail::socket_iostream_base< \ - Protocol, Clock, WaitTraits>::streambuf_) \ - { \ - this->setf(std::ios_base::unitbuf); \ - if (rdbuf()->connect(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)) == 0) \ - this->setstate(std::ios_base::failbit); \ - } \ - /**/ - -// A macro that should expand to: -// template -// void connect(T1 x1, ..., Tn xn) -// { -// if (rdbuf()->connect(x1, ..., xn) == 0) -// this->setstate(std::ios_base::failbit); -// } -// This macro should only persist within this file. - -# define BOOST_ASIO_PRIVATE_CONNECT_DEF(n) \ - template \ - void connect(BOOST_ASIO_VARIADIC_BYVAL_PARAMS(n)) \ - { \ - if (rdbuf()->connect(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n)) == 0) \ - this->setstate(std::ios_base::failbit); \ - } \ - /**/ - -#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - #include namespace boost { @@ -88,7 +39,6 @@ protected: { } -#if defined(BOOST_ASIO_HAS_MOVE) socket_iostream_base(socket_iostream_base&& other) : streambuf_(std::move(other.streambuf_)) { @@ -104,7 +54,6 @@ protected: streambuf_ = std::move(other.streambuf_); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) basic_socket_streambuf streambuf_; }; @@ -119,11 +68,11 @@ template > + typename WaitTraits = time_traits> #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typename Clock = chrono::steady_clock, - typename WaitTraits = wait_traits > + typename WaitTraits = wait_traits> #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) class basic_socket_iostream; @@ -134,7 +83,7 @@ class basic_socket_iostream; #if defined(GENERATING_DOCUMENTATION) template > + typename WaitTraits = wait_traits> #else // defined(GENERATING_DOCUMENTATION) template #endif // defined(GENERATING_DOCUMENTATION) @@ -194,7 +143,6 @@ public: this->setf(std::ios_base::unitbuf); } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Construct a basic_socket_iostream from the supplied socket. explicit basic_socket_iostream(basic_stream_socket s) : detail::socket_iostream_base< @@ -206,8 +154,6 @@ public: this->setf(std::ios_base::unitbuf); } -#if defined(BOOST_ASIO_HAS_STD_IOSTREAM_MOVE) \ - || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_socket_iostream from another. basic_socket_iostream(basic_socket_iostream&& other) : detail::socket_iostream_base< @@ -226,20 +172,13 @@ public: Protocol, Clock, WaitTraits>::operator=(std::move(other)); return *this; } -#endif // defined(BOOST_ASIO_HAS_STD_IOSTREAM_MOVE) - // || defined(GENERATING_DOCUMENTATION) -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) -#if defined(GENERATING_DOCUMENTATION) /// Establish a connection to an endpoint corresponding to a resolver query. /** * This constructor automatically establishes a connection based on the * supplied resolver query parameters. The arguments are used to construct * a resolver query object. */ - template - explicit basic_socket_iostream(T1 t1, ..., TN tn); -#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) template explicit basic_socket_iostream(T... x) : std::basic_iostream( @@ -250,29 +189,19 @@ public: if (rdbuf()->connect(x...) == 0) this->setstate(std::ios_base::failbit); } -#else - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CTR_DEF) -#endif -#if defined(GENERATING_DOCUMENTATION) /// Establish a connection to an endpoint corresponding to a resolver query. /** * This function automatically establishes a connection based on the supplied * resolver query parameters. The arguments are used to construct a resolver * query object. */ - template - void connect(T1 t1, ..., TN tn); -#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) template void connect(T... x) { if (rdbuf()->connect(x...) == 0) this->setstate(std::ios_base::failbit); } -#else - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CONNECT_DEF) -#endif /// Close the connection. void close() @@ -389,9 +318,9 @@ public: private: // Disallow copying and assignment. - basic_socket_iostream(const basic_socket_iostream&) BOOST_ASIO_DELETED; + basic_socket_iostream(const basic_socket_iostream&) = delete; basic_socket_iostream& operator=( - const basic_socket_iostream&) BOOST_ASIO_DELETED; + const basic_socket_iostream&) = delete; }; } // namespace asio @@ -399,11 +328,6 @@ private: #include -#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) -# undef BOOST_ASIO_PRIVATE_CTR_DEF -# undef BOOST_ASIO_PRIVATE_CONNECT_DEF -#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - #endif // !defined(BOOST_ASIO_NO_IOSTREAM) #endif // BOOST_ASIO_BASIC_SOCKET_IOSTREAM_HPP diff --git a/include/boost/asio/basic_socket_streambuf.hpp b/include/boost/asio/basic_socket_streambuf.hpp index 8b6aee09..23114a38 100644 --- a/include/boost/asio/basic_socket_streambuf.hpp +++ b/include/boost/asio/basic_socket_streambuf.hpp @@ -37,38 +37,6 @@ #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) -#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - -# include - -// A macro that should expand to: -// template -// basic_socket_streambuf* connect(T1 x1, ..., Tn xn) -// { -// init_buffers(); -// typedef typename Protocol::resolver resolver_type; -// resolver_type resolver(socket().get_executor()); -// connect_to_endpoints( -// resolver.resolve(x1, ..., xn, ec_)); -// return !ec_ ? this : 0; -// } -// This macro should only persist within this file. - -# define BOOST_ASIO_PRIVATE_CONNECT_DEF(n) \ - template \ - basic_socket_streambuf* connect(BOOST_ASIO_VARIADIC_BYVAL_PARAMS(n)) \ - { \ - init_buffers(); \ - typedef typename Protocol::resolver resolver_type; \ - resolver_type resolver(socket().get_executor()); \ - connect_to_endpoints( \ - resolver.resolve(BOOST_ASIO_VARIADIC_BYVAL_ARGS(n), ec_)); \ - return !ec_ ? this : 0; \ - } \ - /**/ - -#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - #include namespace boost { @@ -117,11 +85,11 @@ template > + typename WaitTraits = time_traits> #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) typename Clock = chrono::steady_clock, - typename WaitTraits = wait_traits > + typename WaitTraits = wait_traits> #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) // && defined(BOOST_ASIO_USE_BOOST_DATE_TIME_FOR_SOCKET_IOSTREAM) class basic_socket_streambuf; @@ -132,7 +100,7 @@ class basic_socket_streambuf; #if defined(GENERATING_DOCUMENTATION) template > + typename WaitTraits = wait_traits> #else // defined(GENERATING_DOCUMENTATION) template #endif // defined(GENERATING_DOCUMENTATION) @@ -198,7 +166,6 @@ public: init_buffers(); } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Construct a basic_socket_streambuf from the supplied socket. explicit basic_socket_streambuf(basic_stream_socket s) : detail::socket_streambuf_io_context(0), @@ -242,7 +209,6 @@ public: other.init_buffers(); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destructor flushes buffered data. virtual ~basic_socket_streambuf() @@ -266,7 +232,6 @@ public: return !ec_ ? this : 0; } -#if defined(GENERATING_DOCUMENTATION) /// Establish a connection. /** * This function automatically establishes a connection based on the supplied @@ -276,9 +241,6 @@ public: * @return \c this if a connection was successfully established, a null * pointer otherwise. */ - template - basic_socket_streambuf* connect(T1 t1, ..., TN tn); -#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) template basic_socket_streambuf* connect(T... x) { @@ -288,9 +250,6 @@ public: connect_to_endpoints(resolver.resolve(x..., ec_)); return !ec_ ? this : 0; } -#else - BOOST_ASIO_VARIADIC_GENERATE(BOOST_ASIO_PRIVATE_CONNECT_DEF) -#endif /// Close the connection. /** @@ -560,9 +519,9 @@ protected: private: // Disallow copying and assignment. - basic_socket_streambuf(const basic_socket_streambuf&) BOOST_ASIO_DELETED; + basic_socket_streambuf(const basic_socket_streambuf&) = delete; basic_socket_streambuf& operator=( - const basic_socket_streambuf&) BOOST_ASIO_DELETED; + const basic_socket_streambuf&) = delete; void init_buffers() { @@ -680,10 +639,6 @@ private: #include -#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) -# undef BOOST_ASIO_PRIVATE_CONNECT_DEF -#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - #endif // !defined(BOOST_ASIO_NO_IOSTREAM) #endif // BOOST_ASIO_BASIC_SOCKET_STREAMBUF_HPP diff --git a/include/boost/asio/basic_stream_file.hpp b/include/boost/asio/basic_stream_file.hpp index 727f85cb..66115a1c 100644 --- a/include/boost/asio/basic_stream_file.hpp +++ b/include/boost/asio/basic_stream_file.hpp @@ -107,10 +107,10 @@ public: */ template explicit basic_stream_file(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_file(context) { this->impl_.get_service().set_is_stream( @@ -162,10 +162,10 @@ public: template basic_stream_file(ExecutionContext& context, const char* path, file_base::flags open_flags, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_file(context) { boost::system::error_code ec; @@ -222,10 +222,10 @@ public: template basic_stream_file(ExecutionContext& context, const std::string& path, file_base::flags open_flags, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_file(context) { boost::system::error_code ec; @@ -273,17 +273,16 @@ public: template basic_stream_file(ExecutionContext& context, const native_handle_type& native_file, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_file(context, native_file) { this->impl_.get_service().set_is_stream( this->impl_.get_implementation(), true); } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_stream_file from another. /** * This constructor moves a stream file from one object to another. @@ -295,7 +294,7 @@ public: * constructed using the @c basic_stream_file(const executor_type&) * constructor. */ - basic_stream_file(basic_stream_file&& other) BOOST_ASIO_NOEXCEPT + basic_stream_file(basic_stream_file&& other) noexcept : basic_file(std::move(other)) { } @@ -331,10 +330,10 @@ public: */ template basic_stream_file(basic_stream_file&& other, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_file(std::move(other)) { } @@ -351,15 +350,14 @@ public: * constructor. */ template - typename constraint< + constraint_t< is_convertible::value, basic_stream_file& - >::type operator=(basic_stream_file&& other) + > operator=(basic_stream_file&& other) { basic_file::operator=(std::move(other)); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destroys the file. /** @@ -523,17 +521,13 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) WriteToken = default_completion_token_t> + auto async_write_some(const ConstBufferSequence& buffers, + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers))) + declval(), token, buffers)) { return async_initiate( @@ -656,17 +650,13 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) ReadToken = default_completion_token_t> + auto async_read_some(const MutableBufferSequence& buffers, + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers))) + declval(), token, buffers)) { return async_initiate( @@ -675,8 +665,8 @@ public: private: // Disallow copying and assignment. - basic_stream_file(const basic_stream_file&) BOOST_ASIO_DELETED; - basic_stream_file& operator=(const basic_stream_file&) BOOST_ASIO_DELETED; + basic_stream_file(const basic_stream_file&) = delete; + basic_stream_file& operator=(const basic_stream_file&) = delete; class initiate_async_write_some { @@ -688,13 +678,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler, + void operator()(WriteHandler&& handler, const ConstBufferSequence& buffers) const { // If you get an error on the following line it means that your handler @@ -721,13 +711,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler, + void operator()(ReadHandler&& handler, const MutableBufferSequence& buffers) const { // If you get an error on the following line it means that your handler diff --git a/include/boost/asio/basic_stream_socket.hpp b/include/boost/asio/basic_stream_socket.hpp index a877c4c4..441210d8 100644 --- a/include/boost/asio/basic_stream_socket.hpp +++ b/include/boost/asio/basic_stream_socket.hpp @@ -117,9 +117,9 @@ public: */ template explicit basic_stream_socket(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : basic_socket(context) { } @@ -156,10 +156,10 @@ public: */ template basic_stream_socket(ExecutionContext& context, const protocol_type& protocol, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : basic_socket(context, protocol) { } @@ -202,9 +202,9 @@ public: */ template basic_stream_socket(ExecutionContext& context, const endpoint_type& endpoint, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : basic_socket(context, endpoint) { } @@ -247,14 +247,13 @@ public: template basic_stream_socket(ExecutionContext& context, const protocol_type& protocol, const native_handle_type& native_socket, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : basic_socket(context, protocol, native_socket) { } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_stream_socket from another. /** * This constructor moves a stream socket from one object to another. @@ -266,7 +265,7 @@ public: * constructed using the @c basic_stream_socket(const executor_type&) * constructor. */ - basic_stream_socket(basic_stream_socket&& other) BOOST_ASIO_NOEXCEPT + basic_stream_socket(basic_stream_socket&& other) noexcept : basic_socket(std::move(other)) { } @@ -302,10 +301,10 @@ public: */ template basic_stream_socket(basic_stream_socket&& other, - typename constraint< + constraint_t< is_convertible::value && is_convertible::value - >::type = 0) + > = 0) : basic_socket(std::move(other)) { } @@ -322,16 +321,15 @@ public: * constructor. */ template - typename constraint< + constraint_t< is_convertible::value && is_convertible::value, basic_stream_socket& - >::type operator=(basic_stream_socket&& other) + > operator=(basic_stream_socket&& other) { basic_socket::operator=(std::move(other)); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destroys the socket. /** @@ -494,18 +492,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_send(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) WriteToken = default_completion_token_t> + auto async_send(const ConstBufferSequence& buffers, + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, socket_base::message_flags(0)))) + buffers, socket_base::message_flags(0))) { return async_initiate( @@ -568,18 +562,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_send(const ConstBufferSequence& buffers, + std::size_t)) WriteToken = default_completion_token_t> + auto async_send(const ConstBufferSequence& buffers, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers, flags))) + declval(), token, buffers, flags)) { return async_initiate( @@ -746,18 +736,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) ReadToken = default_completion_token_t> + auto async_receive(const MutableBufferSequence& buffers, + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, socket_base::message_flags(0)))) + buffers, socket_base::message_flags(0))) { return async_initiate( @@ -822,18 +808,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_receive(const MutableBufferSequence& buffers, + std::size_t)) ReadToken = default_completion_token_t> + auto async_receive(const MutableBufferSequence& buffers, socket_base::message_flags flags, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers, flags))) + declval(), token, buffers, flags)) { return async_initiate( @@ -954,18 +936,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) WriteToken = default_completion_token_t> + auto async_write_some(const ConstBufferSequence& buffers, + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, socket_base::message_flags(0)))) + buffers, socket_base::message_flags(0))) { return async_initiate( @@ -1090,18 +1068,14 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(ReadToken, - void (boost::system::error_code, std::size_t)) - async_read_some(const MutableBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(ReadToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) ReadToken = default_completion_token_t> + auto async_read_some(const MutableBufferSequence& buffers, + ReadToken&& token = default_completion_token_t()) + -> decltype( async_initiate( declval(), token, - buffers, socket_base::message_flags(0)))) + buffers, socket_base::message_flags(0))) { return async_initiate( @@ -1111,8 +1085,8 @@ public: private: // Disallow copying and assignment. - basic_stream_socket(const basic_stream_socket&) BOOST_ASIO_DELETED; - basic_stream_socket& operator=(const basic_stream_socket&) BOOST_ASIO_DELETED; + basic_stream_socket(const basic_stream_socket&) = delete; + basic_stream_socket& operator=(const basic_stream_socket&) = delete; class initiate_async_send { @@ -1124,13 +1098,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler, + void operator()(WriteHandler&& handler, const ConstBufferSequence& buffers, socket_base::message_flags flags) const { @@ -1158,13 +1132,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(ReadHandler) handler, + void operator()(ReadHandler&& handler, const MutableBufferSequence& buffers, socket_base::message_flags flags) const { diff --git a/include/boost/asio/basic_streambuf.hpp b/include/boost/asio/basic_streambuf.hpp index f28bb1ea..801c6a13 100644 --- a/include/boost/asio/basic_streambuf.hpp +++ b/include/boost/asio/basic_streambuf.hpp @@ -104,7 +104,7 @@ namespace asio { * @endcode */ #if defined(GENERATING_DOCUMENTATION) -template > +template > #else template #endif @@ -156,7 +156,7 @@ public: * } * @endcode */ - std::size_t size() const BOOST_ASIO_NOEXCEPT + std::size_t size() const noexcept { return pptr() - gptr(); } @@ -166,7 +166,7 @@ public: * @returns The allowed maximum of the sum of the sizes of the input sequence * and output sequence. */ - std::size_t max_size() const BOOST_ASIO_NOEXCEPT + std::size_t max_size() const noexcept { return max_size_; } @@ -176,7 +176,7 @@ public: * @returns The current total capacity of the streambuf, i.e. for both the * input sequence and output sequence. */ - std::size_t capacity() const BOOST_ASIO_NOEXCEPT + std::size_t capacity() const noexcept { return buffer_.capacity(); } @@ -190,7 +190,7 @@ public: * @note The returned object is invalidated by any @c basic_streambuf member * function that modifies the input sequence or output sequence. */ - const_buffers_type data() const BOOST_ASIO_NOEXCEPT + const_buffers_type data() const noexcept { return boost::asio::buffer(boost::asio::const_buffer(gptr(), (pptr() - gptr()) * sizeof(char_type))); @@ -362,7 +362,7 @@ private: /// Adapts basic_streambuf to the dynamic buffer sequence type requirements. #if defined(GENERATING_DOCUMENTATION) -template > +template > #else template #endif @@ -384,39 +384,37 @@ public: } /// Copy construct a basic_streambuf_ref. - basic_streambuf_ref(const basic_streambuf_ref& other) BOOST_ASIO_NOEXCEPT + basic_streambuf_ref(const basic_streambuf_ref& other) noexcept : sb_(other.sb_) { } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move construct a basic_streambuf_ref. - basic_streambuf_ref(basic_streambuf_ref&& other) BOOST_ASIO_NOEXCEPT + basic_streambuf_ref(basic_streambuf_ref&& other) noexcept : sb_(other.sb_) { } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get the size of the input sequence. - std::size_t size() const BOOST_ASIO_NOEXCEPT + std::size_t size() const noexcept { return sb_.size(); } /// Get the maximum size of the dynamic buffer. - std::size_t max_size() const BOOST_ASIO_NOEXCEPT + std::size_t max_size() const noexcept { return sb_.max_size(); } /// Get the current capacity of the dynamic buffer. - std::size_t capacity() const BOOST_ASIO_NOEXCEPT + std::size_t capacity() const noexcept { return sb_.capacity(); } /// Get a list of buffers that represents the input sequence. - const_buffers_type data() const BOOST_ASIO_NOEXCEPT + const_buffers_type data() const noexcept { return sb_.data(); } diff --git a/include/boost/asio/basic_streambuf_fwd.hpp b/include/boost/asio/basic_streambuf_fwd.hpp index 65b1cb7e..c4d6110b 100644 --- a/include/boost/asio/basic_streambuf_fwd.hpp +++ b/include/boost/asio/basic_streambuf_fwd.hpp @@ -24,10 +24,10 @@ namespace boost { namespace asio { -template > +template > class basic_streambuf; -template > +template > class basic_streambuf_ref; } // namespace asio diff --git a/include/boost/asio/basic_waitable_timer.hpp b/include/boost/asio/basic_waitable_timer.hpp index 23333de1..a2d590d4 100644 --- a/include/boost/asio/basic_waitable_timer.hpp +++ b/include/boost/asio/basic_waitable_timer.hpp @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -27,10 +28,6 @@ #include #include -#if defined(BOOST_ASIO_HAS_MOVE) -# include -#endif // defined(BOOST_ASIO_HAS_MOVE) - #include namespace boost { @@ -195,9 +192,9 @@ public: */ template explicit basic_waitable_timer(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { } @@ -234,9 +231,9 @@ public: template explicit basic_waitable_timer(ExecutionContext& context, const time_point& expiry_time, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -277,9 +274,9 @@ public: template explicit basic_waitable_timer(ExecutionContext& context, const duration& expiry_time, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -288,7 +285,6 @@ public: boost::asio::detail::throw_error(ec, "expires_after"); } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_waitable_timer from another. /** * This constructor moves a timer from one object to another. @@ -341,9 +337,9 @@ public: template basic_waitable_timer( basic_waitable_timer&& other, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(std::move(other.impl_)) { } @@ -361,16 +357,15 @@ public: * constructor. */ template - typename constraint< + constraint_t< is_convertible::value, basic_waitable_timer& - >::type operator=(basic_waitable_timer&& other) + > operator=(basic_waitable_timer&& other) { basic_waitable_timer tmp(std::move(other)); impl_ = std::move(tmp.impl_); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destroys the timer. /** @@ -382,7 +377,7 @@ public: } /// Get the executor associated with the object. - const executor_type& get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() noexcept { return impl_.get_executor(); } @@ -769,15 +764,12 @@ public: */ template < BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code)) - WaitToken BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)> - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX( - WaitToken, void (boost::system::error_code)) - async_wait( - BOOST_ASIO_MOVE_ARG(WaitToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + WaitToken = default_completion_token_t> + auto async_wait( + WaitToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token))) + declval(), token)) { return async_initiate( initiate_async_wait(this), token); @@ -785,9 +777,8 @@ public: private: // Disallow copying and assignment. - basic_waitable_timer(const basic_waitable_timer&) BOOST_ASIO_DELETED; - basic_waitable_timer& operator=( - const basic_waitable_timer&) BOOST_ASIO_DELETED; + basic_waitable_timer(const basic_waitable_timer&) = delete; + basic_waitable_timer& operator=(const basic_waitable_timer&) = delete; class initiate_async_wait { @@ -799,13 +790,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) const + void operator()(WaitHandler&& handler) const { // If you get an error on the following line it means that your handler // does not meet the documented type requirements for a WaitHandler. @@ -823,7 +814,7 @@ private: detail::io_object_impl< detail::deadline_timer_service< - detail::chrono_time_traits >, + detail::chrono_time_traits>, executor_type > impl_; }; diff --git a/include/boost/asio/basic_writable_pipe.hpp b/include/boost/asio/basic_writable_pipe.hpp index 3ae16b76..27f79035 100644 --- a/include/boost/asio/basic_writable_pipe.hpp +++ b/include/boost/asio/basic_writable_pipe.hpp @@ -21,6 +21,7 @@ || defined(GENERATING_DOCUMENTATION) #include +#include #include #include #include @@ -38,10 +39,6 @@ # include #endif -#if defined(BOOST_ASIO_HAS_MOVE) -# include -#endif // defined(BOOST_ASIO_HAS_MOVE) - #include namespace boost { @@ -113,10 +110,10 @@ public: */ template explicit basic_writable_pipe(ExecutionContext& context, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(0, 0, context) { } @@ -160,9 +157,9 @@ public: template basic_writable_pipe(ExecutionContext& context, const native_handle_type& native_pipe, - typename constraint< + constraint_t< is_convertible::value - >::type = 0) + > = 0) : impl_(0, 0, context) { boost::system::error_code ec; @@ -171,7 +168,6 @@ public: boost::asio::detail::throw_error(ec, "assign"); } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-construct a basic_writable_pipe from another. /** * This constructor moves a pipe from one object to another. @@ -222,10 +218,10 @@ public: */ template basic_writable_pipe(basic_writable_pipe&& other, - typename constraint< + constraint_t< is_convertible::value, defaulted_constraint - >::type = defaulted_constraint()) + > = defaulted_constraint()) : impl_(std::move(other.impl_)) { } @@ -242,16 +238,15 @@ public: * constructor. */ template - typename constraint< + constraint_t< is_convertible::value, basic_writable_pipe& - >::type operator=(basic_writable_pipe&& other) + > operator=(basic_writable_pipe&& other) { basic_writable_pipe tmp(std::move(other)); impl_ = std::move(tmp.impl_); return *this; } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Destroys the pipe. /** @@ -264,7 +259,7 @@ public: } /// Get the executor associated with the object. - const executor_type& get_executor() BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() noexcept { return impl_.get_executor(); } @@ -558,17 +553,13 @@ public: */ template - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_PREFIX(WriteToken, - void (boost::system::error_code, std::size_t)) - async_write_some(const ConstBufferSequence& buffers, - BOOST_ASIO_MOVE_ARG(WriteToken) token - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type)) - BOOST_ASIO_INITFN_AUTO_RESULT_TYPE_SUFFIX(( + std::size_t)) WriteToken = default_completion_token_t> + auto async_write_some(const ConstBufferSequence& buffers, + WriteToken&& token = default_completion_token_t()) + -> decltype( async_initiate( - declval(), token, buffers))) + declval(), token, buffers)) { return async_initiate( @@ -577,8 +568,8 @@ public: private: // Disallow copying and assignment. - basic_writable_pipe(const basic_writable_pipe&) BOOST_ASIO_DELETED; - basic_writable_pipe& operator=(const basic_writable_pipe&) BOOST_ASIO_DELETED; + basic_writable_pipe(const basic_writable_pipe&) = delete; + basic_writable_pipe& operator=(const basic_writable_pipe&) = delete; class initiate_async_write_some { @@ -590,13 +581,13 @@ private: { } - const executor_type& get_executor() const BOOST_ASIO_NOEXCEPT + const executor_type& get_executor() const noexcept { return self_->get_executor(); } template - void operator()(BOOST_ASIO_MOVE_ARG(WriteHandler) handler, + void operator()(WriteHandler&& handler, const ConstBufferSequence& buffers) const { // If you get an error on the following line it means that your handler diff --git a/include/boost/asio/bind_allocator.hpp b/include/boost/asio/bind_allocator.hpp index 8123f1fa..7cb4c75d 100644 --- a/include/boost/asio/bind_allocator.hpp +++ b/include/boost/asio/bind_allocator.hpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -38,8 +37,7 @@ protected: }; template -struct allocator_binder_result_type::type> +struct allocator_binder_result_type> { typedef typename T::result_type result_type; protected: @@ -100,8 +98,7 @@ template struct allocator_binder_argument_type {}; template -struct allocator_binder_argument_type::type> +struct allocator_binder_argument_type> { typedef typename T::argument_type argument_type; }; @@ -126,7 +123,7 @@ struct allocator_binder_argument_types {}; template struct allocator_binder_argument_types::type> + void_t> { typedef typename T::first_argument_type first_argument_type; typedef typename T::second_argument_type second_argument_type; @@ -146,21 +143,6 @@ struct allocator_binder_argument_type typedef A2 second_argument_type; }; -// Helper to enable SFINAE on zero-argument operator() below. - -template -struct allocator_binder_result_of0 -{ - typedef void type; -}; - -template -struct allocator_binder_result_of0::type>::type> -{ - typedef typename result_of::type type; -}; - } // namespace detail /// A call wrapper type to bind an allocator of type @c Allocator @@ -248,10 +230,9 @@ public: * @c U. */ template - allocator_binder(const allocator_type& s, - BOOST_ASIO_MOVE_ARG(U) u) + allocator_binder(const allocator_type& s, U&& u) : allocator_(s), - target_(BOOST_ASIO_MOVE_CAST(U)(u)) + target_(static_cast(u)) { } @@ -263,8 +244,7 @@ public: } /// Construct a copy, but specify a different allocator. - allocator_binder(const allocator_type& s, - const allocator_binder& other) + allocator_binder(const allocator_type& s, const allocator_binder& other) : allocator_(s), target_(other.get()) { @@ -277,8 +257,7 @@ public: * constructible from type @c U. */ template - allocator_binder( - const allocator_binder& other) + allocator_binder(const allocator_binder& other) : allocator_(other.get_allocator()), target_(other.get()) { @@ -298,13 +277,11 @@ public: { } -#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Move constructor. allocator_binder(allocator_binder&& other) - : allocator_(BOOST_ASIO_MOVE_CAST(allocator_type)( + : allocator_(static_cast( other.get_allocator())), - target_(BOOST_ASIO_MOVE_CAST(T)(other.get())) + target_(static_cast(other.get())) { } @@ -312,7 +289,7 @@ public: allocator_binder(const allocator_type& s, allocator_binder&& other) : allocator_(s), - target_(BOOST_ASIO_MOVE_CAST(T)(other.get())) + target_(static_cast(other.get())) { } @@ -320,9 +297,9 @@ public: template allocator_binder( allocator_binder&& other) - : allocator_(BOOST_ASIO_MOVE_CAST(OtherAllocator)( + : allocator_(static_cast( other.get_allocator())), - target_(BOOST_ASIO_MOVE_CAST(U)(other.get())) + target_(static_cast(other.get())) { } @@ -332,124 +309,47 @@ public: allocator_binder(const allocator_type& s, allocator_binder&& other) : allocator_(s), - target_(BOOST_ASIO_MOVE_CAST(U)(other.get())) + target_(static_cast(other.get())) { } -#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) - /// Destructor. ~allocator_binder() { } /// Obtain a reference to the target object. - target_type& get() BOOST_ASIO_NOEXCEPT + target_type& get() noexcept { return target_; } /// Obtain a reference to the target object. - const target_type& get() const BOOST_ASIO_NOEXCEPT + const target_type& get() const noexcept { return target_; } /// Obtain the associated allocator. - allocator_type get_allocator() const BOOST_ASIO_NOEXCEPT + allocator_type get_allocator() const noexcept { return allocator_; } -#if defined(GENERATING_DOCUMENTATION) - - template auto operator()(Args&& ...); - template auto operator()(Args&& ...) const; - -#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - /// Forwarding function call operator. template - typename result_of::type operator()( - BOOST_ASIO_MOVE_ARG(Args)... args) + result_of_t operator()(Args&&... args) { - return target_(BOOST_ASIO_MOVE_CAST(Args)(args)...); + return target_(static_cast(args)...); } /// Forwarding function call operator. template - typename result_of::type operator()( - BOOST_ASIO_MOVE_ARG(Args)... args) const + result_of_t operator()(Args&&... args) const { - return target_(BOOST_ASIO_MOVE_CAST(Args)(args)...); + return target_(static_cast(args)...); } -#elif defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS) && !defined(_MSC_VER) - - typename detail::allocator_binder_result_of0::type operator()() - { - return target_(); - } - - typename detail::allocator_binder_result_of0::type - operator()() const - { - return target_(); - } - -#define BOOST_ASIO_PRIVATE_BINDER_CALL_DEF(n) \ - template \ - typename result_of::type operator()( \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - return target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - \ - template \ - typename result_of::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::allocator_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 \ - result_type_or_void operator()( \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - return target_(BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - \ - template \ - 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: Allocator allocator_; T target_; @@ -458,20 +358,17 @@ private: /// Associate an object of type @c T with an allocator of type /// @c Allocator. template -BOOST_ASIO_NODISCARD inline allocator_binder::type, Allocator> -bind_allocator(const Allocator& s, BOOST_ASIO_MOVE_ARG(T) t) +BOOST_ASIO_NODISCARD inline allocator_binder, Allocator> +bind_allocator(const Allocator& s, T&& t) { - return allocator_binder< - typename decay::type, Allocator>( - s, BOOST_ASIO_MOVE_CAST(T)(t)); + return allocator_binder, Allocator>(s, static_cast(t)); } #if !defined(GENERATING_DOCUMENTATION) namespace detail { -template +template class allocator_binder_completion_handler_async_result { public: @@ -483,10 +380,8 @@ public: template class allocator_binder_completion_handler_async_result< - TargetAsyncResult, Allocator, - typename void_type< - typename TargetAsyncResult::completion_handler_type - >::type> + TargetAsyncResult, Allocator, + void_t> { public: typedef allocator_binder< @@ -515,10 +410,7 @@ struct allocator_binder_async_result_return_type template struct allocator_binder_async_result_return_type< - TargetAsyncResult, - typename void_type< - typename TargetAsyncResult::return_type - >::type> + TargetAsyncResult, void_type> { typedef typename TargetAsyncResult::return_type return_type; }; @@ -528,9 +420,9 @@ struct allocator_binder_async_result_return_type< template class async_result, Signature> : public detail::allocator_binder_completion_handler_async_result< - async_result, Allocator>, + async_result, Allocator>, public detail::allocator_binder_async_result_return_type< - async_result > + async_result> { public: explicit async_result(allocator_binder& b) @@ -543,199 +435,82 @@ public: struct init_wrapper { template - init_wrapper(const Allocator& allocator, BOOST_ASIO_MOVE_ARG(Init) init) + init_wrapper(const Allocator& allocator, Init&& init) : allocator_(allocator), - initiation_(BOOST_ASIO_MOVE_CAST(Init)(init)) + initiation_(static_cast(init)) { } -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template - void operator()( - BOOST_ASIO_MOVE_ARG(Handler) handler, - BOOST_ASIO_MOVE_ARG(Args)... args) - { - BOOST_ASIO_MOVE_CAST(Initiation)(initiation_)( - allocator_binder< - typename decay::type, Allocator>( - allocator_, BOOST_ASIO_MOVE_CAST(Handler)(handler)), - BOOST_ASIO_MOVE_CAST(Args)(args)...); - } - template - void operator()( - BOOST_ASIO_MOVE_ARG(Handler) handler, - BOOST_ASIO_MOVE_ARG(Args)... args) const + void operator()(Handler&& handler, Args&&... args) + { + static_cast(initiation_)( + allocator_binder, Allocator>( + allocator_, static_cast(handler)), + static_cast(args)...); + } + + template + void operator()(Handler&& handler, Args&&... args) const { initiation_( - allocator_binder< - typename decay::type, Allocator>( - allocator_, BOOST_ASIO_MOVE_CAST(Handler)(handler)), - BOOST_ASIO_MOVE_CAST(Args)(args)...); + allocator_binder, Allocator>( + allocator_, static_cast(handler)), + static_cast(args)...); } -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template - void operator()( - BOOST_ASIO_MOVE_ARG(Handler) handler) - { - BOOST_ASIO_MOVE_CAST(Initiation)(initiation_)( - allocator_binder< - typename decay::type, Allocator>( - allocator_, BOOST_ASIO_MOVE_CAST(Handler)(handler))); - } - - template - void operator()( - BOOST_ASIO_MOVE_ARG(Handler) handler) const - { - initiation_( - allocator_binder< - typename decay::type, Allocator>( - allocator_, BOOST_ASIO_MOVE_CAST(Handler)(handler))); - } - -#define BOOST_ASIO_PRIVATE_INIT_WRAPPER_DEF(n) \ - template \ - void operator()( \ - BOOST_ASIO_MOVE_ARG(Handler) handler, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) \ - { \ - BOOST_ASIO_MOVE_CAST(Initiation)(initiation_)( \ - allocator_binder< \ - typename decay::type, Allocator>( \ - allocator_, BOOST_ASIO_MOVE_CAST(Handler)(handler)), \ - BOOST_ASIO_VARIADIC_MOVE_ARGS(n)); \ - } \ - \ - template \ - void operator()( \ - BOOST_ASIO_MOVE_ARG(Handler) handler, \ - BOOST_ASIO_VARIADIC_MOVE_PARAMS(n)) const \ - { \ - initiation_( \ - allocator_binder< \ - typename decay::type, Allocator>( \ - allocator_, 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) - Allocator allocator_; Initiation initiation_; }; -#if defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - template - static BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(T, Signature, - (async_initiate( - declval::type> >(), - declval().get(), - declval()...))) - initiate( - BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_MOVE_ARG(RawCompletionToken) token, - BOOST_ASIO_MOVE_ARG(Args)... args) + static auto initiate(Initiation&& initiation, + RawCompletionToken&& token, Args&&... args) + -> decltype( + async_initiate( + declval>>(), + token.get(), static_cast(args)...)) { return async_initiate( - init_wrapper::type>( - token.get_allocator(), - BOOST_ASIO_MOVE_CAST(Initiation)(initiation)), - token.get(), BOOST_ASIO_MOVE_CAST(Args)(args)...); + init_wrapper>(token.get_allocator(), + static_cast(initiation)), + token.get(), static_cast(args)...); } -#else // defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) - - template - static BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(T, Signature, - (async_initiate( - declval::type> >(), - declval().get()))) - initiate( - BOOST_ASIO_MOVE_ARG(Initiation) initiation, - BOOST_ASIO_MOVE_ARG(RawCompletionToken) token) - { - return async_initiate( - init_wrapper::type>( - token.get_allocator(), - BOOST_ASIO_MOVE_CAST(Initiation)(initiation)), - token.get()); - } - -#define BOOST_ASIO_PRIVATE_INITIATE_DEF(n) \ - template \ - static BOOST_ASIO_INITFN_DEDUCED_RESULT_TYPE(T, Signature, \ - (async_initiate( \ - declval::type> >(), \ - declval().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( \ - init_wrapper::type>( \ - token.get_allocator(), \ - 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(const async_result&) = delete; + async_result& operator=(const async_result&) = delete; async_result target_; }; template