From 8d8615956fe9ecd26440f697cff8c78843d7d8dd Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 16:52:12 +1100 Subject: [PATCH 01/23] Add Executor template parameter to forward declarations. --- src/forward.tex | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/forward.tex b/src/forward.tex index b49596a..c76aa5d 100644 --- a/src/forward.tex +++ b/src/forward.tex @@ -22,25 +22,25 @@ class io_context; template struct wait_traits; - template> + template@\addedcode{, class Executor = executor}@> class basic_waitable_timer; using system_timer = basic_waitable_timer; using steady_timer = basic_waitable_timer; using high_resolution_timer = basic_waitable_timer; - template + template class basic_socket; - template + template class basic_datagram_socket; - template + template class basic_stream_socket; - template + template class basic_socket_acceptor; template> + class WaitTraits = wait_traits@\addedcode{, class Executor = executor}@> class basic_socket_streambuf; template> + class WaitTraits = wait_traits@\addedcode{, class Executor = executor}@> class basic_socket_iostream; namespace ip { @@ -64,7 +64,7 @@ class basic_resolver_entry; template class basic_resolver_results; - template + template class basic_resolver; class tcp; class udp; From a622bd29c7912dabd114535c6db5ebaf6b08ed1f Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 18:19:24 +1100 Subject: [PATCH 02/23] Custom executor support for basic_resolver. --- src/internetprotocol.tex | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/src/internetprotocol.tex b/src/internetprotocol.tex index a89fbd8..ee2da9f 100644 --- a/src/internetprotocol.tex +++ b/src/internetprotocol.tex @@ -180,7 +180,7 @@ class resolver_base; - template + template class basic_resolver; string host_name(); @@ -3060,26 +3060,33 @@ \rSec1[internet.resolver]{Class template \tcode{ip::basic_resolver}} \pnum -Objects of type \tcode{basic_resolver} are used to perform name resolution. Name resolution is the translation of a host name and service name into a sequence of endpoints, or the translation of an endpoint into its corresponding host name and service name. +Objects of type \tcode{basic_resolver} are used to perform name resolution. Name resolution is the translation of a host name and service name into a sequence of endpoints, or the translation of an endpoint into its corresponding host name and service name. \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { namespace ip { - template + template class basic_resolver : public resolver_base { public: // types: - using executor_type = io_context::executor_type; + using executor_type = @\removedcode{io_context::executor_type}\addedcode{Executor}@; using protocol_type = InternetProtocol; using endpoint_type = typename InternetProtocol::endpoint; using results_type = basic_resolver_results; + @\addedcode{template}@ + @\addedcode{struct rebind_executor}@ + @\addedcode{\{}@ + @\addedcode{ using other = basic_resolver;}@ + @\addedcode{\};}@ + // \ref{internet.resolver.cons}, construct / copy / destroy - explicit basic_resolver(io_context& ctx); + explicit basic_resolver(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); + @\addedcode{template explicit basic_resolver(ExecutionContext\& ctx);}@ basic_resolver(const basic_resolver&) = delete; basic_resolver(basic_resolver&& rhs) noexcept; @@ -3146,12 +3153,26 @@ \rSec2[internet.resolver.cons]{\tcode{ip::basic_resolver} constructors} \begin{itemdecl} -explicit basic_resolver(io_context& ctx); +explicit basic_resolver(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); \end{itemdecl} \begin{itemdescr} \pnum -\postconditions \tcode{get_executor() == ctx.get_executor()}. +\postconditions \tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\end{itemdescr} + +\begin{itemdecl} +@\addedcode{template explicit basic_resolver(ExecutionContext\& ctx);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\postconditions \tcode{get_executor() == ctx.get_executor()}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} \end{itemdescr} \begin{itemdecl} From 7d34f255dfed734e70708fe4e6ec6a62694e1400 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 18:56:43 +1100 Subject: [PATCH 03/23] Custom executor support for basic_waitable_timer. --- src/timers.tex | 81 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 12 deletions(-) diff --git a/src/timers.tex b/src/timers.tex index 0d15fe0..15bbf93 100644 --- a/src/timers.tex +++ b/src/timers.tex @@ -39,7 +39,7 @@ template struct wait_traits; - template> + template@\addedcode{, class Executor = executor}@> class basic_waitable_timer; using system_timer = basic_waitable_timer; @@ -155,23 +155,35 @@ \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template> + template@\addedcode{, class Executor = executor}@> class basic_waitable_timer { public: // types: - using executor_type = io_context::executor_type; + using executor_type = @\removedcode{io_context::executor_type}\addedcode{Executor}@; using clock_type = Clock; using duration = typename clock_type::duration; using time_point = typename clock_type::time_point; using traits_type = WaitTraits; + @\addedcode{template}@ + @\addedcode{struct rebind_executor}@ + @\addedcode{\{}@ + @\addedcode{ using other = basic_waitable_timer;}@ + @\addedcode{\};}@ + // \ref{timer.waitable.cons}, construct / copy / destroy - explicit basic_waitable_timer(io_context& ctx); - basic_waitable_timer(io_context& ctx, const time_point& t); - basic_waitable_timer(io_context& ctx, const duration& d); + explicit basic_waitable_timer(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); + @\addedcode{template}@ + @\addedcode{ explicit basic_waitable_timer(ExecutionContext\& ctx);}@ + basic_waitable_timer(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const time_point& t); + @\addedcode{template}@ + @\addedcode{ basic_waitable_timer(ExecutionContext\& ctx, const time_point\& t);}@ + basic_waitable_timer(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const duration& d); + @\addedcode{template}@ + @\addedcode{ basic_waitable_timer(ExecutionContext\& ctx, const duration\& d);}@ basic_waitable_timer(const basic_waitable_timer&) = delete; basic_waitable_timer(basic_waitable_timer&& rhs); @@ -209,16 +221,31 @@ \indexlibrary{\idxcode{basic_waitable_timer}!constructor}% \begin{itemdecl} -explicit basic_waitable_timer(io_context& ctx); +explicit basic_waitable_timer(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_waitable_timer(ctx, time_point())}. +\effects Equivalent to \tcode{basic_waitable_timer(\removed{ctx}\added{ex}, time_point())}. \end{itemdescr} \begin{itemdecl} -basic_waitable_timer(io_context& ctx, const time_point& t); +@\addedcode{template}@ +@\addedcode{ explicit basic_waitable_timer(ExecutionContext\& ctx);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor())}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + +\begin{itemdecl} +basic_waitable_timer(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const time_point& t); \end{itemdecl} \begin{itemdescr} @@ -226,14 +253,29 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == ctx.get_executor()}. +\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. \item \tcode{expiry() == t}. \end{itemize} \end{itemdescr} \begin{itemdecl} -basic_waitable_timer(io_context& ctx, const duration& d); +@\addedcode{template}@ +@\addedcode{ basic_waitable_timer(ExecutionContext\& ctx, const time_point\& t);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor(), t)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + +\begin{itemdecl} +basic_waitable_timer(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const duration& d); \end{itemdecl} \begin{itemdescr} @@ -241,7 +283,22 @@ \effects Sets the expiry time as if by calling \tcode{expires_after(d)}. \pnum -\postconditions \tcode{get_executor() == ctx.get_executor()}. +\postconditions \tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\end{itemdescr} + +\begin{itemdecl} +@\addedcode{template}@ +@\addedcode{ basic_waitable_timer(ExecutionContext\& ctx, const duration\& d);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor(), d)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} \end{itemdescr} \begin{itemdecl} From ca3b1fd4f94f8002564c105f88cf79b2bc70281a Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 19:28:28 +1100 Subject: [PATCH 04/23] Custom executor support for connect and async_connect. --- src/socketalgorithms.tex | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/socketalgorithms.tex b/src/socketalgorithms.tex index a32cd7f..731715a 100644 --- a/src/socketalgorithms.tex +++ b/src/socketalgorithms.tex @@ -6,11 +6,11 @@ \rSec1[socket.algo.connect]{Synchronous connect operations} \begin{itemdecl} -template - typename Protocol::endpoint connect(basic_socket& s, +template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints); -template - typename Protocol::endpoint connect(basic_socket& s, +template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints, error_code& ec); \end{itemdecl} @@ -21,12 +21,12 @@ \end{itemdescr} \begin{itemdecl} -template - typename Protocol::endpoint connect(basic_socket& s, +template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints, ConnectCondition c); -template - typename Protocol::endpoint connect(basic_socket& s, +template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints, ConnectCondition c, error_code& ec); \end{itemdecl} @@ -57,11 +57,11 @@ \end{itemdescr} \begin{itemdecl} -template - InputIterator connect(basic_socket& s, +template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last); -template - InputIterator connect(basic_socket& s, +template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last, error_code& ec); \end{itemdecl} @@ -72,12 +72,12 @@ \end{itemdescr} \begin{itemdecl} -template - InputIterator connect(basic_socket& s, +template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last, ConnectCondition c); -template - InputIterator connect(basic_socket& s, +template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last, ConnectCondition c, error_code& ec); \end{itemdecl} @@ -112,8 +112,8 @@ \rSec1[socket.algo.async.connect]{Asynchronous connect operations} \begin{itemdecl} -template - @\DEDUCED@ async_connect(basic_socket& s, +template + @\DEDUCED@ async_connect(basic_socket& s, const EndpointSequence& endpoints, CompletionToken&& token); \end{itemdecl} @@ -127,9 +127,9 @@ \end{itemdescr} \begin{itemdecl} -template - @\DEDUCED@ async_connect(basic_socket& s, + @\DEDUCED@ async_connect(basic_socket& s, const EndpointSequence& endpoints, ConnectCondition c, CompletionToken&& token); @@ -168,8 +168,8 @@ \end{itemdescr} \begin{itemdecl} -template - @\DEDUCED@ async_connect(basic_socket& s, +template + @\DEDUCED@ async_connect(basic_socket& s, InputIterator first, InputIterator last, CompletionToken&& token); \end{itemdecl} @@ -184,9 +184,9 @@ \end{itemdescr} \begin{itemdecl} -template - @\DEDUCED@ async_connect(basic_socket& s, + @\DEDUCED@ async_connect(basic_socket& s, InputIterator first, InputIterator last, ConnectCondition c, CompletionToken&& token); From c833bdef18976072eebf69776792b2e33e6159fd Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 19:58:26 +1100 Subject: [PATCH 05/23] Custom executor support for basic_socket_streambuf and basic_socket_iostream. --- src/socketstreams.tex | 48 ++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/src/socketstreams.tex b/src/socketstreams.tex index 987248a..74ce3c4 100644 --- a/src/socketstreams.tex +++ b/src/socketstreams.tex @@ -6,7 +6,7 @@ \rSec1[socket.streambuf]{Class template \tcode{basic_socket_streambuf}} \pnum -The class \tcode{basic_socket_streambuf} associates both the input sequence and the output sequence with a socket. The input and output sequences do not support seeking. \begin{note} The input and output sequences are independent as a stream socket provides full duplex I/O. \end{note} +The class \tcode{basic_socket_streambuf} associates both the input sequence and the output sequence with a socket. The input and output sequences do not support seeking. \begin{note} The input and output sequences are independent as a stream socket provides full duplex I/O. \end{note} \pnum \begin{note} This class is intended for sending and receiving bytes, not characters. Any conversion from characters to bytes, and vice versa, occurs elsewhere. \end{note} @@ -14,12 +14,13 @@ \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template + template class basic_socket_streambuf : public basic_streambuf { public: // types: + @\addedcode{using executor_type = Executor;}@ using protocol_type = Protocol; using endpoint_type = typename protocol_type::endpoint; using clock_type = Clock; @@ -30,7 +31,7 @@ // \ref{socket.streambuf.cons}, construct / copy / destroy basic_socket_streambuf(); - explicit basic_socket_streambuf(basic_stream_socket s); + explicit basic_socket_streambuf(basic_stream_socket s); basic_socket_streambuf(const basic_socket_streambuf&) = delete; basic_socket_streambuf(basic_socket_streambuf&& rhs); @@ -46,7 +47,7 @@ basic_socket_streambuf* close(); - basic_socket& socket(); + basic_socket& socket(); error_code error() const; time_point expiry() const; @@ -62,7 +63,7 @@ virtual streambuf* setbuf(char_type* s, streamsize n) override; private: - basic_stream_socket socket_; // \expos + basic_stream_socket socket_; // \expos error_code ec_; // \expos time_point expiry_; // \expos }; @@ -86,10 +87,14 @@ \pnum \postconditions \tcode{expiry() == time_point::max()} and \tcode{!error()}. + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_constructible::value} is \tcode{true}.} \end{itemdescr} \begin{itemdecl} -explicit basic_socket_streambuf(basic_stream_socket s); +explicit basic_socket_streambuf(basic_stream_socket s); \end{itemdecl} \begin{itemdescr} @@ -152,7 +157,7 @@ \begin{itemdescr} \pnum -\effects If a put area exists, calls \tcode{overflow(traits_type::eof())} to flush characters. \begin{note} The socket is closed by the \tcode{basic_stream_socket} destructor. \end{note} +\effects If a put area exists, calls \tcode{overflow(traits_type::eof())} to flush characters. \begin{note} The socket is closed by the \tcode{basic_stream_socket} destructor. \end{note} \end{itemdescr} \begin{itemdecl} @@ -210,7 +215,7 @@ \begin{itemdescr} \pnum -\effects If a put area exists, calls \tcode{overflow(traits_type::eof())} to flush characters. Regardless of whether the preceding call fails or throws an exception, the function closes the socket as if by \tcode{basic_socket::close(ec_)}. If any of the calls made by the function fail, \tcode{close} fails by returning a null pointer. If one of these calls throws an exception, the exception is caught and rethrown after closing the socket. +\effects If a put area exists, calls \tcode{overflow(traits_type::eof())} to flush characters. Regardless of whether the preceding call fails or throws an exception, the function closes the socket as if by \tcode{basic_socket::close(ec_)}. If any of the calls made by the function fail, \tcode{close} fails by returning a null pointer. If one of these calls throws an exception, the exception is caught and rethrown after closing the socket. \pnum \returns \tcode{this} on success, a null pointer otherwise. @@ -220,7 +225,7 @@ \end{itemdescr} \begin{itemdecl} -basic_socket& socket(); +basic_socket& socket(); \end{itemdecl} \begin{itemdescr} @@ -349,7 +354,7 @@ \rSec1[socket.iostream]{Class template \tcode{basic_socket_iostream}} \pnum -The class template \tcode{basic_socket_iostream} supports reading and writing on sockets. It uses a \tcode{basic_socket_streambuf} object to control the associated sequences. +The class template \tcode{basic_socket_iostream} supports reading and writing on sockets. It uses a \tcode{basic_socket_streambuf} object to control the associated sequences. \pnum \begin{note} This class is intended for sending and receiving bytes, not characters. Any conversion from characters to bytes, and vice versa, occurs elsewhere. \end{note} @@ -357,12 +362,13 @@ \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template + template class basic_socket_iostream : public basic_iostream { public: // types: + @\addedcode{using executor_type = Executor;}@ using protocol_type = Protocol; using endpoint_type = typename protocol_type::endpoint; using clock_type = Clock; @@ -373,7 +379,7 @@ // \ref{socket.iostream.cons}, construct / copy / destroy basic_socket_iostream(); - explicit basic_socket_iostream(basic_stream_socket s); + explicit basic_socket_iostream(basic_stream_socket s); basic_socket_iostream(const basic_socket_iostream&) = delete; basic_socket_iostream(basic_socket_iostream&& rhs); template @@ -388,9 +394,9 @@ void close(); - basic_socket_streambuf* rdbuf() const; + basic_socket_streambuf* rdbuf() const; - basic_socket& socket(); + basic_socket& socket(); error_code error() const; time_point expiry() const; @@ -398,7 +404,7 @@ void expires_after(const duration& d); private: - basic_socket_streambuf sb_; // \expos + basic_socket_streambuf sb_; // \expos }; } // inline namespace std::experimental::net::\namespacever @@ -417,10 +423,14 @@ \begin{itemdescr} \pnum \effects Initializes the base class as \tcode{basic_iostream(addressof(sb_))}, value-initializes \tcode{sb_}, and performs \tcode{setf(std::ios_base::unitbuf)}. + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_default_constructible>::value} is \tcode{true}.} \end{itemdescr} \begin{itemdecl} -explicit basic_socket_iostream(basic_stream_socket s); +explicit basic_socket_iostream(basic_stream_socket s); \end{itemdecl} \begin{itemdescr} @@ -487,19 +497,19 @@ \end{itemdescr} \begin{itemdecl} -basic_socket_streambuf* rdbuf() const; +basic_socket_streambuf* rdbuf() const; \end{itemdecl} \begin{itemdescr} \pnum -Let \tcode{SB} be the type \tcode{basic_socket_streambuf}. +Let \tcode{SB} be the type \tcode{basic_socket_streambuf}. \pnum \returns \tcode{const_cast(addressof(sb_))}. \end{itemdescr} \begin{itemdecl} -basic_socket& socket(); +basic_socket& socket(); \end{itemdecl} \begin{itemdescr} From 21a2734343558853da15f9207bf15db8673513a1 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 20:06:55 +1100 Subject: [PATCH 06/23] Add executor template parameters to socket synopsis. --- src/sockets.tex | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index 6fee3ac..964f635 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -24,84 +24,84 @@ class socket_base; - template + template class basic_socket; - template + template class basic_datagram_socket; - template + template class basic_stream_socket; - template + template class basic_socket_acceptor; // \ref{socket.iostreams}, Socket streams template> + class WaitTraits = wait_traits@\addedcode{, class Executor = executor}@> class basic_socket_streambuf; template> + class WaitTraits = wait_traits@\addedcode{, class Executor = executor}@> class basic_socket_iostream; // \ref{socket.algo.connect}, synchronous connect operations - template - typename Protocol::endpoint connect(basic_socket& s, + template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints); - template - typename Protocol::endpoint connect(basic_socket& s, + template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints, error_code& ec); - template - typename Protocol::endpoint connect(basic_socket& s, + template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints, ConnectCondition c); - template - typename Protocol::endpoint connect(basic_socket& s, + template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints, ConnectCondition c, error_code& ec); - template - InputIterator connect(basic_socket& s, + template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last); - template - InputIterator connect(basic_socket& s, + template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last, error_code& ec); - template - InputIterator connect(basic_socket& s, + template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last, ConnectCondition c); - template - InputIterator connect(basic_socket& s, + template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last, ConnectCondition c, error_code& ec); // \ref{socket.algo.async.connect}, asynchronous connect operations - template - @\DEDUCED@ async_connect(basic_socket& s, + template + @\DEDUCED@ async_connect(basic_socket& s, const EndpointSequence& endpoints, CompletionToken&& token); - template - @\DEDUCED@ async_connect(basic_socket& s, + @\DEDUCED@ async_connect(basic_socket& s, const EndpointSequence& endpoints, ConnectCondition c, CompletionToken&& token); - template - @\DEDUCED@ async_connect(basic_socket& s, + template + @\DEDUCED@ async_connect(basic_socket& s, InputIterator first, InputIterator last, CompletionToken&& token); - template - @\DEDUCED@ async_connect(basic_socket& s, + @\DEDUCED@ async_connect(basic_socket& s, InputIterator first, InputIterator last, ConnectCondition c, CompletionToken&& token); From 1a5c8ced7ea196e1139a3aff2e0fff580cd375b6 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 20:20:53 +1100 Subject: [PATCH 07/23] Custom executor support for socket_base. --- src/sockets.tex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index 964f635..5e4ee91 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -1053,13 +1053,13 @@ \item socket option classes \tcode{broadcast}, \tcode{debug}, \tcode{do_not_route}, \tcode{keep_alive}, \tcode{linger}, \tcode{out_of_band_inline}, \tcode{receive_buffer_size}, \tcode{receive_low_watermark}, \tcode{reuse_address}, \tcode{send_buffer_size}, and \tcode{send_low_watermark}; \item -an enumerated type, \tcode{shutdown_type}, for use with the \tcode{basic_socket} class's \tcode{shutdown} member function. +an enumerated type, \tcode{shutdown_type}, for use with the \tcode{basic_socket} class's \tcode{shutdown} member function. \item -an enumerated type, \tcode{wait_type}, for use with the \tcode{basic_socket} and \tcode{basic_socket_acceptor} classes' \tcode{wait} and \tcode{async_wait} member functions, +an enumerated type, \tcode{wait_type}, for use with the \tcode{basic_socket} and \tcode{basic_socket_acceptor} classes' \tcode{wait} and \tcode{async_wait} member functions, \item -a bitmask type, \tcode{message_flags}, for use with the \tcode{basic_stream_socket} class's \tcode{send}, \tcode{async_send}, \tcode{receive}, and \tcode{async_receive} member functions, and the \tcode{basic_datagram_socket} class's \tcode{send}, \tcode{async_send}, \tcode{send_to}, \tcode{async_send_to}, \tcode{receive}, \tcode{async_receive}, \tcode{receive_from}, and \tcode{async_receive_from} member functions. +a bitmask type, \tcode{message_flags}, for use with the \tcode{basic_stream_socket} class's \tcode{send}, \tcode{async_send}, \tcode{receive}, and \tcode{async_receive} member functions, and the \tcode{basic_datagram_socket} class's \tcode{send}, \tcode{async_send}, \tcode{send_to}, \tcode{async_send_to}, \tcode{receive}, \tcode{async_receive}, \tcode{receive_from}, and \tcode{async_receive_from} member functions. \item -a constant, \tcode{max_listen_connections}, for use with the \tcode{basic_socket_acceptor} class's \tcode{listen} member function. +a constant, \tcode{max_listen_connections}, for use with the \tcode{basic_socket_acceptor} class's \tcode{listen} member function. \end{itemize} \begin{libreqtab3} From e2a6b3476aba1571005eea59064de0edcf112735 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 20:43:14 +1100 Subject: [PATCH 08/23] Add custom executor support to basic_socket definition. --- src/sockets.tex | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index 5e4ee91..e1cd871 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -1395,22 +1395,28 @@ \rSec1[socket.basic]{Class template \tcode{basic_socket}} \pnum -Class template \tcode{basic_socket} is used as the base class for the \tcode{basic_datagram_socket} and \tcode{basic_stream_socket} class templates. It provides functionality that is common to both types of socket. +Class template \tcode{basic_socket} is used as the base class for the \tcode{basic_datagram_socket} and \tcode{basic_stream_socket} class templates. It provides functionality that is common to both types of socket. \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template + template class basic_socket : public socket_base { public: // types: - using executor_type = io_context::executor_type; + using executor_type = @\removedcode{io_context::executor_type}\addedcode{Executor}@; using native_handle_type = @\impdefx{type of \tcode{basic_socket::native_handle_type}}@; // \nativeref using protocol_type = Protocol; using endpoint_type = typename protocol_type::endpoint; + @\addedcode{template}@ + @\addedcode{struct rebind_executor}@ + @\addedcode{\{}@ + @\addedcode{ using other = basic_socket;}@ + @\addedcode{\};}@ + // \ref{socket.basic.ops}, basic_socket operations executor_type get_executor() noexcept; @@ -1494,22 +1500,31 @@ protected: // \ref{socket.basic.cons}, construct / copy / destroy - explicit basic_socket(io_context& ctx); - basic_socket(io_context& ctx, const protocol_type& protocol); - basic_socket(io_context& ctx, const endpoint_type& endpoint); - basic_socket(io_context& ctx, const protocol_type& protocol, + explicit basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); + @\addedcode{template}@ + @\addedcode{ explicit basic_socket(ExecutionContext\& ctx);}@ + basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); + @\addedcode{template}@ + @\addedcode{ basic_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ + basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint); + @\addedcode{template}@ + @\addedcode{ basic_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ + basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, const native_handle_type& native_socket); // \nativeref + @\addedcode{template}@ + @\addedcode{ basic_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ + @\addedcode{ const native_handle_type\& native_socket); // \nativeref}@ basic_socket(const basic_socket&) = delete; basic_socket(basic_socket&& rhs); - template - basic_socket(basic_socket&& rhs); + template + basic_socket(basic_socket&& rhs); ~basic_socket(); basic_socket& operator=(const basic_socket&) = delete; basic_socket& operator=(basic_socket&& rhs); - template - basic_socket& operator=(basic_socket&& rhs); + template + basic_socket& operator=(basic_socket&& rhs); private: protocol_type protocol_; // \expos From 10f1beb014ffc7a06245535cfcd80ec7e8df050e Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 21:25:49 +1100 Subject: [PATCH 09/23] Add custom executor support to basic_datagram_socket and basic_stream_socket definitions. --- src/sockets.tex | 80 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 24 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index e1cd871..eeb78cf 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -2220,39 +2220,55 @@ \rSec1[socket.dgram]{Class template \tcode{basic_datagram_socket}} \pnum -The class template \tcode{basic_datagram_socket} is used to send and receive discrete messages of fixed maximum length. +The class template \tcode{basic_datagram_socket} is used to send and receive discrete messages of fixed maximum length. \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template - class basic_datagram_socket : public basic_socket + template + class basic_datagram_socket : public basic_socket { public: // types: + @\addedcode{using executor_type = Executor;}@ using native_handle_type = @\impdefx{type of \tcode{basic_datagram_socket::native_handle_type}}@; // \nativeref using protocol_type = Protocol; using endpoint_type = typename protocol_type::endpoint; + @\addedcode{template}@ + @\addedcode{struct rebind_executor}@ + @\addedcode{\{}@ + @\addedcode{ using other = basic_datagram_socket;}@ + @\addedcode{\};}@ + // \ref{socket.dgram.cons}, construct / copy / destroy - explicit basic_datagram_socket(io_context& ctx); - basic_datagram_socket(io_context& ctx, const protocol_type& protocol); - basic_datagram_socket(io_context& ctx, const endpoint_type& endpoint); - basic_datagram_socket(io_context& ctx, const protocol_type& protocol, - const native_handle_type& native_socket); + explicit basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); + @\addedcode{template}@ + @\addedcode{ explicit basic_datagram_socket(ExecutionContext\& ctx);}@ + basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); + @\addedcode{template}@ + @\addedcode{ basic_datagram_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ + basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint); + @\addedcode{template}@ + @\addedcode{ basic_datagram_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ + basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, + const native_handle_type& native_socket); + @\addedcode{template}@ + @\addedcode{ basic_datagram_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ + @\addedcode{ const native_handle_type\& native_socket);}@ basic_datagram_socket(const basic_datagram_socket&) = delete; basic_datagram_socket(basic_datagram_socket&& rhs); - template - basic_datagram_socket(basic_datagram_socket&& rhs); + template + basic_datagram_socket(basic_datagram_socket&& rhs); ~basic_datagram_socket(); basic_datagram_socket& operator=(const basic_datagram_socket&) = delete; basic_datagram_socket& operator=(basic_datagram_socket&& rhs); - template - basic_datagram_socket& operator=(basic_datagram_socket&& rhs); + template + basic_datagram_socket& operator=(basic_datagram_socket&& rhs); // \ref{socket.dgram.op}, basic_datagram_socket operations @@ -2881,39 +2897,55 @@ \rSec1[socket.stream]{Class template \tcode{basic_stream_socket}} \pnum -The class template \tcode{basic_stream_socket} is used to exchange data with a peer over a sequenced, reliable, bidirectional, connection-mode byte stream. +The class template \tcode{basic_stream_socket} is used to exchange data with a peer over a sequenced, reliable, bidirectional, connection-mode byte stream. \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template - class basic_stream_socket : public basic_socket + template + class basic_stream_socket : public basic_socket { public: // types: + @\addedcode{using executor_type = Executor;}@ using native_handle_type = @\impdefx{type of \tcode{basic_stream_socket::native_handle_type}}@; // \nativeref using protocol_type = Protocol; using endpoint_type = typename protocol_type::endpoint; + @\addedcode{template}@ + @\addedcode{struct rebind_executor}@ + @\addedcode{\{}@ + @\addedcode{ using other = basic_stream_socket;}@ + @\addedcode{\};}@ + // \ref{socket.stream.cons}, construct / copy / destroy - explicit basic_stream_socket(io_context& ctx); - basic_stream_socket(io_context& ctx, const protocol_type& protocol); - basic_stream_socket(io_context& ctx, const endpoint_type& endpoint); - basic_stream_socket(io_context& ctx, const protocol_type& protocol, - const native_handle_type& native_socket); + explicit basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); + @\addedcode{template}@ + @\addedcode{ explicit basic_stream_socket(ExecutionContext\& ctx);}@ + basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); + @\addedcode{template}@ + @\addedcode{ basic_stream_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ + basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint); + @\addedcode{template}@ + @\addedcode{ basic_stream_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ + basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, + const native_handle_type& native_socket); + @\addedcode{template}@ + @\addedcode{ basic_stream_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ + @\addedcode{ const native_handle_type\& native_socket);}@ basic_stream_socket(const basic_stream_socket&) = delete; basic_stream_socket(basic_stream_socket&& rhs); - template - basic_stream_socket(basic_stream_socket&& rhs); + template + basic_stream_socket(basic_stream_socket&& rhs); ~basic_stream_socket(); basic_stream_socket& operator=(const basic_stream_socket&) = delete; basic_stream_socket& operator=(basic_stream_socket&& rhs); - template - basic_stream_socket& operator=(basic_stream_socket&& rhs); + template + basic_stream_socket& operator=(basic_stream_socket&& rhs); // \ref{socket.stream.ops}, basic_stream_socket operations From 5a8a04763e28d1d62943189ba3586c3ea515e51e Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 22:18:48 +1100 Subject: [PATCH 10/23] Add custom executor support to basic_socket_acceptor definition. --- src/sockets.tex | 106 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 78 insertions(+), 28 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index eeb78cf..cae219c 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -3383,42 +3383,58 @@ \rSec1[socket.acceptor]{Class template \tcode{basic_socket_acceptor}} \pnum -An object of class template \tcode{basic_socket_acceptor} is used to listen for, and queue, incoming socket connections. Socket objects that represent the incoming connections are dequeued by calling \tcode{accept} or \tcode{async_accept}. +An object of class template \tcode{basic_socket_acceptor} is used to listen for, and queue, incoming socket connections. Socket objects that represent the incoming connections are dequeued by calling \tcode{accept} or \tcode{async_accept}. \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template + template class basic_socket_acceptor : public socket_base { public: // types: - using executor_type = io_context::executor_type; + using executor_type = @\removedcode{io_context::executor_type}\addedcode{Executor}@; using native_handle_type = @\impdefx{type of \tcode{basic_socket_acceptor::native_handle_type}}@; // \nativeref using protocol_type = AcceptableProtocol; using endpoint_type = typename protocol_type::endpoint; - using socket_type = typename protocol_type::socket; + @\removedcode{using socket_type = typename protocol_type::socket;}@ + + @\addedcode{template}@ + @\addedcode{struct rebind_executor}@ + @\addedcode{\{}@ + @\addedcode{ using other = basic_socket_acceptor;}@ + @\addedcode{\};}@ // \ref{socket.acceptor.cons}, construct / copy / destroy - explicit basic_socket_acceptor(io_context& ctx); - basic_socket_acceptor(io_context& ctx, const protocol_type& protocol); - basic_socket_acceptor(io_context& ctx, const endpoint_type& endpoint, + explicit basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); + @\addedcode{template}@ + @\addedcode{ explicit basic_socket_acceptor(ExecutionContext\& ctx);}@ + basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); + @\addedcode{template}@ + @\addedcode{ basic_socket_acceptor(ExecutionContext\& ctx, const protocol_type\& protocol);}@ + basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint, bool reuse_addr = true); - basic_socket_acceptor(io_context& ctx, const protocol_type& protocol, - const native_handle_type& native_acceptor); + @\addedcode{template}@ + @\addedcode{ basic_socket_acceptor(ExecutionContext\& ctx, const endpoint_type\& endpoint,}@ + @\addedcode{ bool reuse_addr = true);}@ + basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, + const native_handle_type& native_socket); + @\addedcode{template}@ + @\addedcode{ basic_socket_acceptor(ExecutionContext\& ctx, const protocol_type\& protocol,}@ + @\addedcode{ const native_handle_type\& native_socket);}@ basic_socket_acceptor(const basic_socket_acceptor&) = delete; basic_socket_acceptor(basic_socket_acceptor&& rhs); - template - basic_socket_acceptor(basic_socket_acceptor&& rhs); + template + basic_socket_acceptor(basic_socket_acceptor&& rhs); ~basic_socket_acceptor(); basic_socket_acceptor& operator=(const basic_socket_acceptor&) = delete; basic_socket_acceptor& operator=(basic_socket_acceptor&& rhs); - template - basic_socket_acceptor& operator=(basic_socket_acceptor&& rhs); + template + basic_socket_acceptor& operator=(basic_socket_acceptor&& rhs); // \ref{socket.acceptor.ops}, basic_socket_acceptor operations @@ -3481,28 +3497,62 @@ void enable_connection_aborted(bool mode); bool enable_connection_aborted() const; - socket_type accept(); - socket_type accept(error_code& ec); - socket_type accept(io_context& ctx); - socket_type accept(io_context& ctx, error_code& ec); + @\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(); + @\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(error_code& ec); + @\removedcode{socket_type accept(io_context\& ctx);}@ + @\removedcode{socket_type accept(io_context\& ctx, error_code\& ec);}@ + @\addedcode{template}@ + @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ accept(const OtherExecutor\& ex);}@ + @\addedcode{template}@ + @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ accept(const OtherExecutor\& ex, error_code\& ec);}@ + @\addedcode{template}@ + @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ accept(ExecutionContext\& ctx);}@ + @\addedcode{template}@ + @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ accept(ExecutionContext\& ctx, error_code\& ec);}@ template @\DEDUCED@ async_accept(CompletionToken&& token); - template - @\DEDUCED@ async_accept(io_context& ctx, CompletionToken&& token); - - socket_type accept(endpoint_type& endpoint); - socket_type accept(endpoint_type& endpoint, error_code& ec); - socket_type accept(io_context& ctx, endpoint_type& endpoint); - socket_type accept(io_context& ctx, endpoint_type& endpoint, - error_code& ec); + @\removedcode{template}@ + @\removedcode{ \DEDUCED\ async_accept(io_context\& ctx, CompletionToken\&\& token);}@ + @\addedcode{template}@ + @\addedcode{ \DEDUCED\ async_accept(const OtherExecutor\& ex, CompletionToken\&\& token);}@ + @\addedcode{template}@ + @\addedcode{ \DEDUCED\ async_accept(ExecutionContext\& ctx, CompletionToken\&\& token);}@ + + @\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(endpoint_type& endpoint); + @\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(endpoint_type& endpoint, error_code& ec); + @\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint);}@ + @\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint,}@ + @\removedcode{ error_code\& ec);}@ + @\addedcode{template}@ + @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint);}@ + @\addedcode{template}@ + @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint, error_code\& ec);}@ + @\addedcode{template}@ + @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint);}@ + @\addedcode{template}@ + @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint, error_code\& ec);}@ template @\DEDUCED@ async_accept(endpoint_type& endpoint, CompletionToken&& token); - template - @\DEDUCED@ async_accept(io_context& ctx, endpoint_type& endpoint, - CompletionToken&& token); + @\removedcode{template}@ + @\removedcode{ \DEDUCED\ async_accept(io_context\& ctx, endpoint_type\& endpoint,}@ + @\removedcode{ CompletionToken\&\& token);}@ + @\addedcode{template}@ + @\addedcode{ \DEDUCED\ async_accept(const OtherExecutor\& ex, endpoint_type\& endpoint,}@ + @\addedcode{ CompletionToken\&\& token);}@ + @\addedcode{template}@ + @\addedcode{ \DEDUCED\ async_accept(ExecutionContext\& ctx, endpoint_type\& endpoint,}@ + @\addedcode{ CompletionToken\&\& token);}@ void wait(wait_type w); void wait(wait_type w, error_code& ec); From 17ce7b25d90059109cd827429598f3caf84cd949 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 22:54:39 +1100 Subject: [PATCH 11/23] Update basic_socket constructors and assignment to add custom executors. --- src/sockets.tex | 101 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 84 insertions(+), 17 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index cae219c..b677720 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -1512,7 +1512,7 @@ basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, const native_handle_type& native_socket); // \nativeref @\addedcode{template}@ - @\addedcode{ basic_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ + @\addedcode{ basic_socket(ExecutionContext\& ctx, const protocol_type\& protocol,}@ @\addedcode{ const native_handle_type\& native_socket); // \nativeref}@ basic_socket(const basic_socket&) = delete; basic_socket(basic_socket&& rhs); @@ -1543,7 +1543,7 @@ \rSec2[socket.basic.cons]{\tcode{basic_socket} constructors} \begin{itemdecl} -explicit basic_socket(io_context& ctx); +explicit basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); \end{itemdecl} \begin{itemdescr} @@ -1551,14 +1551,29 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == ctx.get_executor()}. +\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. \item \tcode{is_open() == false}. \end{itemize} \end{itemdescr} \begin{itemdecl} -basic_socket(io_context& ctx, const protocol_type& protocol); +@\addedcode{template}@ +@\addedcode{ explicit basic_socket(ExecutionContext\& ctx);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_socket(ctx.get_executor())}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + +\begin{itemdecl} +basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); \end{itemdecl} \begin{itemdescr} @@ -1569,7 +1584,7 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == ctx.get_executor()}. +\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. \item \tcode{is_open() == true}. \item @@ -1580,7 +1595,22 @@ \end{itemdescr} \begin{itemdecl} -basic_socket(io_context& ctx, const endpoint_type& endpoint); +@\addedcode{template}@ +@\addedcode{ explicit basic_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), protocol)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + +\begin{itemdecl} +basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint); \end{itemdecl} \begin{itemdescr} @@ -1596,7 +1626,7 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == ctx.get_executor()}. +\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. \item \tcode{is_open() == true}. \item @@ -1607,7 +1637,22 @@ \end{itemdescr} \begin{itemdecl} -basic_socket(io_context& ctx, const protocol_type& protocol, +@\addedcode{template}@ +@\addedcode{ explicit basic_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), endpoint)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + +\begin{itemdecl} +basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, const native_handle_type& native_socket); \end{itemdecl} @@ -1622,7 +1667,7 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == ctx.get_executor()}. +\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. \item \tcode{is_open() == true}. \item @@ -1632,13 +1677,29 @@ \end{itemize} \end{itemdescr} +\begin{itemdecl} +@\addedcode{template}@ +@\addedcode{ basic_socket(ExecutionContext\& ctx, const protocol_type\& protocol,}@ +@\addedcode{ const native_handle_type\& native_socket);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), protocol, native_socket)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + \begin{itemdecl} basic_socket(basic_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs an object of class \tcode{basic_socket} that refers to the state originally represented by \tcode{rhs}. +\effects Move constructs an object of class \tcode{basic_socket} that refers to the state originally represented by \tcode{rhs}. \pnum \postconditions @@ -1659,16 +1720,16 @@ \end{itemdescr} \begin{itemdecl} -template - basic_socket(basic_socket&& rhs); +template + basic_socket(basic_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\constraints \tcode{is_convertible_v} is \tcode{true}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \pnum -\effects Move constructs an object of class \tcode{basic_socket} that refers to the state originally represented by \tcode{rhs}. +\effects Move constructs an object of class \tcode{basic_socket} that refers to the state originally represented by \tcode{rhs}. \pnum \postconditions @@ -1686,6 +1747,9 @@ \item \tcode{rhs.is_open() == false}. \end{itemize} + +\pnum +\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \end{itemdescr} @@ -1733,13 +1797,13 @@ \end{itemdescr} \begin{itemdecl} -template - basic_socket& operator=(basic_socket&& rhs); +template + basic_socket& operator=(basic_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\constraints \tcode{is_convertible_v} is \tcode{true}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \pnum \effects If \tcode{is_open()} is \tcode{true}, cancels all outstanding asynchronous operations associated with this socket. Completion handlers for canceled operations are passed an error code \tcode{ec} such that \tcode{ec == errc::operation_canceled} yields \tcode{true}. Disables the linger socket option to prevent the assignment from blocking, and releases socket resources as if by POSIX \tcode{close(native_handle())}. Moves into \tcode{*this} the state originally represented by \tcode{rhs}. @@ -1761,6 +1825,9 @@ \pnum \returns \tcode{*this}. + +\pnum +\remarks This assignment operator shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \end{itemdescr} From 3fc1ee35f4104720fa6e63ae9ba2f7bcb491f21e Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 22:57:42 +1100 Subject: [PATCH 12/23] Fix constructor definitions in basic_datagram_socket and basic_stream_socket. --- src/sockets.tex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index b677720..4f775be 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -2321,10 +2321,10 @@ @\addedcode{template}@ @\addedcode{ basic_datagram_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, - const native_handle_type& native_socket); + const native_handle_type& native_socket); @\addedcode{template}@ - @\addedcode{ basic_datagram_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ - @\addedcode{ const native_handle_type\& native_socket);}@ + @\addedcode{ basic_datagram_socket(ExecutionContext\& ctx, const protocol_type\& protocol,}@ + @\addedcode{ const native_handle_type\& native_socket);}@ basic_datagram_socket(const basic_datagram_socket&) = delete; basic_datagram_socket(basic_datagram_socket&& rhs); template @@ -2998,10 +2998,10 @@ @\addedcode{template}@ @\addedcode{ basic_stream_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, - const native_handle_type& native_socket); + const native_handle_type& native_socket); @\addedcode{template}@ - @\addedcode{ basic_stream_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ - @\addedcode{ const native_handle_type\& native_socket);}@ + @\addedcode{ basic_stream_socket(ExecutionContext\& ctx, const protocol_type\& protocol,}@ + @\addedcode{ const native_handle_type\& native_socket);}@ basic_stream_socket(const basic_stream_socket&) = delete; basic_stream_socket(basic_stream_socket&& rhs); template From 63076d0bc66c88971ab7c9051178d1717d49f66a Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 23:26:25 +1100 Subject: [PATCH 13/23] Update basic_datagram_socket constructors and assignment to add custom executors. --- src/sockets.tex | 103 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 85 insertions(+), 18 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index 4f775be..b0353a4 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -2454,36 +2454,81 @@ When an operation has its effects specified as if by passing the result of \tcode{native_handle()} to a POSIX function, then the operation fails with error condition \tcode{errc::bad_file_descriptor} if \tcode{is_open() == false} at the point in the effects when the POSIX function is called. \pnum -If \tcode{native_handle_type} and \tcode{basic_socket::native_handle_type} +If \tcode{native_handle_type} and \tcode{basic_socket::native_handle_type} are both defined then they name the same type. \rSec2[socket.dgram.cons]{\tcode{basic_datagram_socket} constructors} \begin{itemdecl} -explicit basic_datagram_socket(io_context& ctx); +explicit basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx)}. +\effects Initializes the base class with \tcode{basic_socket(\removed{ctx}\added{ex})}. +\end{itemdescr} + +\begin{itemdecl} +@\addedcode{template}@ +@\addedcode{ explicit basic_datagram_socket(ExecutionContext\& ctx);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor())}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} \end{itemdescr} \begin{itemdecl} -basic_datagram_socket(io_context& ctx, const protocol_type& protocol); +basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx, protocol)}. +\effects Initializes the base class with \tcode{basic_socket(ctx, protocol)}. +\end{itemdescr} + +\begin{itemdecl} +@\addedcode{template}@ +@\addedcode{ explicit basic_datagram_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), protocol)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} \end{itemdescr} \begin{itemdecl} -basic_datagram_socket(io_context& ctx, const endpoint_type& endpoint); +basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx, endpoint)}. +\effects Initializes the base class with \tcode{basic_socket(ctx, endpoint)}. +\end{itemdescr} + +\begin{itemdecl} +@\addedcode{template}@ +@\addedcode{ explicit basic_datagram_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), endpoint)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} \end{itemdescr} \begin{itemdecl} @@ -2493,7 +2538,23 @@ \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx, protocol, native_socket)}. +\effects Initializes the base class with \tcode{basic_socket(ctx, protocol, native_socket)}. +\end{itemdescr} + +\begin{itemdecl} +@\addedcode{template}@ +@\addedcode{ basic_datagram_socket(ExecutionContext\& ctx, const protocol_type\& protocol,}@ +@\addedcode{ const native_handle_type\& native_socket);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), protocol, native_socket)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} \end{itemdescr} \begin{itemdecl} @@ -2502,20 +2563,23 @@ \begin{itemdescr} \pnum -\effects Move constructs an object of class \tcode{basic_datagram_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. +\effects Move constructs an object of class \tcode{basic_datagram_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. \end{itemdescr} \begin{itemdecl} -template - basic_datagram_socket(basic_datagram_socket&& rhs); +template + basic_datagram_socket(basic_datagram_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\constraints \tcode{is_convertible_v} is \tcode{true}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. + +\pnum +\effects Move constructs an object of class \tcode{basic_datagram_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. \pnum -\effects Move constructs an object of class \tcode{basic_datagram_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. +\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \end{itemdescr} @@ -2528,26 +2592,29 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. +\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. \pnum \returns \tcode{*this}. \end{itemdescr} \begin{itemdecl} -template - basic_datagram_socket& operator=(basic_datagram_socket&& rhs); +template + basic_datagram_socket& operator=(basic_datagram_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\constraints \tcode{is_convertible_v} is \tcode{true}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \pnum -\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. +\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. \pnum \returns \tcode{*this}. + +\pnum +\remarks This assignment operator not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \end{itemdescr} From 4065ebbe139b09492207dd1843b8cd572cb0daa4 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 23:38:08 +1100 Subject: [PATCH 14/23] Update basic_stream_socket constructors and assignment to add custom executors. --- src/sockets.tex | 107 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 87 insertions(+), 20 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index b0353a4..81cddf2 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -3163,47 +3163,108 @@ When an operation has its effects specified as if by passing the result of \tcode{native_handle()} to a POSIX function, then the operation fails with error condition \tcode{errc::bad_file_descriptor} if \tcode{is_open() == false} at the point in the effects when the POSIX function is called. \pnum -If \tcode{native_handle_type} and \tcode{basic_socket::native_handle_type} +If \tcode{native_handle_type} and \tcode{basic_socket::native_handle_type} are both defined then they name the same type. \rSec2[socket.stream.cons]{\tcode{basic_stream_socket} constructors} \begin{itemdecl} -explicit basic_stream_socket(io_context& ctx); +explicit basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx)}. +\effects Initializes the base class with \tcode{basic_socket(ctx)}. \end{itemdescr} \begin{itemdecl} -basic_stream_socket(io_context& ctx, const protocol_type& protocol); +@\addedcode{template}@ +@\addedcode{ explicit basic_stream_socket(ExecutionContext\& ctx);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor())}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + +\begin{itemdecl} +basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx, protocol)}. +\effects Initializes the base class with \tcode{basic_socket(ctx, protocol)}. \end{itemdescr} \begin{itemdecl} -basic_stream_socket(io_context& ctx, const endpoint_type& endpoint); +@\addedcode{template}@ +@\addedcode{ explicit basic_stream_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), protocol)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + +\begin{itemdecl} +basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx, endpoint)}. +\effects Initializes the base class with \tcode{basic_socket(ctx, endpoint)}. \end{itemdescr} \begin{itemdecl} -basic_stream_socket(io_context& ctx, const protocol_type& protocol, - const native_handle_type& native_socket); +@\addedcode{template}@ +@\addedcode{ explicit basic_stream_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), endpoint)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + +\begin{itemdecl} +basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, + const native_handle_type& native_socket); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx, protocol, native_socket)}. +\effects Initializes the base class with \tcode{basic_socket(ctx, protocol, native_socket)}. +\end{itemdescr} + +\begin{itemdecl} +@\addedcode{template}@ +@\addedcode{ basic_stream_socket(ExecutionContext\& ctx, const protocol_type\& protocol,}@ +@\addedcode{ const native_handle_type\& native_socket);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), protocol, native_socket)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} \end{itemdescr} \begin{itemdecl} @@ -3212,20 +3273,23 @@ \begin{itemdescr} \pnum -\effects Move constructs an object of class \tcode{basic_stream_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. +\effects Move constructs an object of class \tcode{basic_stream_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. \end{itemdescr} \begin{itemdecl} -template - basic_stream_socket(basic_stream_socket&& rhs); +template + basic_stream_socket(basic_stream_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\constraints \tcode{is_convertible_v} is \tcode{true}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. + +\pnum +\effects Move constructs an object of class \tcode{basic_stream_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. \pnum -\effects Move constructs an object of class \tcode{basic_stream_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. +\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \end{itemdescr} @@ -3238,26 +3302,29 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. +\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. \pnum \returns \tcode{*this}. \end{itemdescr} \begin{itemdecl} -template - basic_stream_socket& operator=(basic_stream_socket&& rhs); +template + basic_stream_socket& operator=(basic_stream_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\constraints \tcode{is_convertible_v} is \tcode{true}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \pnum -\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. +\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. \pnum \returns \tcode{*this}. + +\pnum +\remarks This assignment operator shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \end{itemdescr} From 1edccac1a4b3c8172423a7c3de5329c0a89b5bad Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Mon, 13 Jan 2020 23:50:59 +1100 Subject: [PATCH 15/23] Update basic_socket_acceptor constructors and assignment to add custom executors. --- src/sockets.tex | 100 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 84 insertions(+), 16 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index 81cddf2..424e613 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -3781,7 +3781,7 @@ \rSec2[socket.acceptor.cons]{\tcode{basic_socket_acceptor} constructors} \begin{itemdecl} -explicit basic_socket_acceptor(io_context& ctx); +explicit basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); \end{itemdecl} \begin{itemdescr} @@ -3789,14 +3789,29 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == ctx.get_executor()}. +\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. \item \tcode{is_open() == false}. \end{itemize} \end{itemdescr} \begin{itemdecl} -basic_socket_acceptor(io_context& ctx, const protocol_type& protocol); +@\addedcode{template}@ +@\addedcode{ explicit basic_socket_acceptor(ExecutionContext\& ctx);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor())}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + +\begin{itemdecl} +basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); \end{itemdecl} \begin{itemdescr} @@ -3807,7 +3822,7 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == ctx.get_executor()}. +\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. \item \tcode{is_open() == true}. \item @@ -3820,7 +3835,22 @@ \end{itemdescr} \begin{itemdecl} -basic_socket_acceptor(io_context& ctx, const endpoint_type& endpoint, +@\addedcode{template}@ +@\addedcode{ explicit basic_socket_acceptor(ExecutionContext\& ctx, const protocol_type\& protocol);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), protocol)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + +\begin{itemdecl} +basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint, bool reuse_addr = true); \end{itemdecl} @@ -3840,7 +3870,7 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == ctx.get_executor()}. +\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. \item \tcode{is_open() == true}. \item @@ -3853,7 +3883,23 @@ \end{itemdescr} \begin{itemdecl} -basic_socket_acceptor(io_context& ctx, const protocol_type& protocol, +@\addedcode{template}@ +@\addedcode{ explicit basic_socket_acceptor(ExecutionContext\& ctx, const endpoint_type\& endpoint,}@ +@\addedcode{ bool reuse_addr = true);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), endpoint, reuse_addr)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + +\begin{itemdecl} +basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, const native_handle_type& native_acceptor); \end{itemdecl} @@ -3868,7 +3914,7 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == ctx.get_executor()}. +\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. \item \tcode{is_open() == true}. \item @@ -3880,13 +3926,29 @@ \end{itemize} \end{itemdescr} +\begin{itemdecl} +@\addedcode{template}@ +@\addedcode{ basic_socket_acceptor(ExecutionContext\& ctx, const protocol_type\& protocol,}@ +@\addedcode{ const native_handle_type\& native_socket);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), protocol, native_socket)}.} + +\addedpnum +\added{\remarks This function shall not participate in overload resolution unless +\tcode{is_convertible::value} is \tcode{true} +and \tcode{is_constructible::value} is \tcode{true}.} +\end{itemdescr} + \begin{itemdecl} basic_socket_acceptor(basic_socket_acceptor&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\effects Move constructs an object of class \tcode{basic_socket_acceptor} that refers to the state originally represented by \tcode{rhs}. +\effects Move constructs an object of class \tcode{basic_socket_acceptor} that refers to the state originally represented by \tcode{rhs}. \pnum \postconditions @@ -3909,16 +3971,16 @@ \end{itemdescr} \begin{itemdecl} -template - basic_socket_acceptor(basic_socket_acceptor&& rhs); +template + basic_socket_acceptor(basic_socket_acceptor&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\constraints \tcode{is_convertible_v} is \tcode{true}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \pnum -\effects Move constructs an object of class \tcode{basic_socket_acceptor} that refers to the state originally represented by \tcode{rhs}. +\effects Move constructs an object of class \tcode{basic_socket_acceptor} that refers to the state originally represented by \tcode{rhs}. \pnum \postconditions @@ -3938,6 +4000,9 @@ \item \tcode{rhs.is_open() == false}. \end{itemize} + +\pnum +\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \end{itemdescr} @@ -3989,13 +4054,13 @@ \end{itemdescr} \begin{itemdecl} -template - basic_socket_acceptor& operator=(basic_socket_acceptor&& rhs); +template + basic_socket_acceptor& operator=(basic_socket_acceptor&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\constraints \tcode{is_convertible_v} is \tcode{true}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \pnum \effects If \tcode{is_open()} is \tcode{true}, cancels all outstanding asynchronous operations associated with this acceptor, and releases acceptor resources as if by POSIX \tcode{close(native_handle())}. Then moves into \tcode{*this} the state originally represented by \tcode{rhs}. Completion handlers for canceled operations are passed an error code \tcode{ec} such that \tcode{ec == errc::operation_canceled} yields \tcode{true}. @@ -4021,6 +4086,9 @@ \pnum \returns \tcode{*this}. + +\pnum +\remarks This assignment operator shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. \end{itemdescr} From ab3de91d7dafea76e20ab4edf18f8cafb47ca975 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Tue, 14 Jan 2020 00:24:56 +1100 Subject: [PATCH 16/23] Add custom executor wording for basic_socket_acceptor operations. --- src/sockets.tex | 130 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 106 insertions(+), 24 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index 424e613..d16a543 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -4450,18 +4450,24 @@ \end{itemdescr} \begin{itemdecl} -socket_type accept(); -socket_type accept(error_code& ec); +@\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(); +@\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(error_code& ec); \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{accept(get_executor().context(), ec)}. +\returns \tcode{accept(get_executor()\removed{.context()}, ec)}. \end{itemdescr} \begin{itemdecl} -socket_type accept(io_context& ctx); -socket_type accept(io_context& ctx, error_code& ec); +@\removedcode{socket_type accept(io_context\& ctx);}@ +@\removedcode{socket_type accept(io_context\& ctx, error_code\& ec);}@ +@\addedcode{template}@ +@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ accept(const OtherExecutor\& ex);}@ +@\addedcode{template}@ +@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ accept(const OtherExecutor\& ex, error_code\& ec);}@ \end{itemdecl} \begin{itemdescr} @@ -4473,7 +4479,22 @@ \pnum -\returns On success, \tcode{socket_type(ctx, protocol_, h)}. Otherwise \tcode{socket_type(ctx)}. +\removed{\returns On success, \tcode{socket_type(ctx, protocol_, h)}. Otherwise \tcode{socket_type(ctx)}.} +\added{\returns On success, \tcode{\{ex, protocol_, h\}}. Otherwise \tcode{\{ex\}}.} +\end{itemdescr} + +\begin{itemdecl} +@\addedcode{template}@ +@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ accept(ExecutionContext\& ctx);}@ +@\addedcode{template}@ +@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ accept(ExecutionContext\& ctx, error_code\& ec);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\returns \tcode{accept(ctx.get_executor(), ec)}.} \end{itemdescr} \begin{itemdecl} @@ -4485,41 +4506,66 @@ \pnum \returns \begin{codeblock} -async_accept(get_executor().context(), forward(token)) +async_accept(get_executor()@\removedcode{.context()}@, forward(token)) \end{codeblock} \end{itemdescr} \begin{itemdecl} -template - @\DEDUCED@ async_accept(io_context& ctx, CompletionToken&& token); +@\removedcode{template}@ +@\removedcode{ \DEDUCED\ async_accept(io_context\& ctx, CompletionToken\&\& token);}@ +@\addedcode{template}@ +@\addedcode{ \DEDUCED\ async_accept(const OtherExecutor\& ex, CompletionToken\&\& token);}@ \end{itemdecl} \begin{itemdescr} +\addedpnum +\added{Let \tcode{S} be the type \tcode{typename Protocol::socket::template rebind_executor::other}.} + \pnum -\completionsig \tcode{void(error_code ec, socket_type s)}. +\completionsig \tcode{void(error_code ec, \removed{socket_type}\added{S} s)}. \pnum \effects Initiates an asynchronous operation to extract a socket from the queue of pending connections of the acceptor, as if by POSIX: \begin{codeblock} native_handle_type h = accept(native_handle(), nullptr, 0); \end{codeblock} - On success, \tcode{s} is \tcode{socket_type(ctx, protocol_, h)}. Otherwise, \tcode{s} is \tcode{socket_type(ctx)}. +\removed{On success, \tcode{s} is \tcode{socket_type(ctx, protocol_, h)}. Otherwise, \tcode{s} is \tcode{socket_type(ctx)}.} +\added{On success, \tcode{s} is \tcode{S(ex, protocol_, h)}. Otherwise, \tcode{s} is \tcode{S(ex)}.} \end{itemdescr} \begin{itemdecl} -socket_type accept(endpoint_type& endpoint); -socket_type accept(endpoint_type& endpoint, error_code& ec); +@\addedcode{template}@ +@\addedcode{ \DEDUCED\ async_accept(ExecutionContext\& ctx, CompletionToken\&\& token);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\returns} +\begin{codeblock} +@\addedcode{async_accept(ctx.get_executor(), forward(token))}@ +\end{codeblock} +\end{itemdescr} + +\begin{itemdecl} +@\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(endpoint_type& endpoint); +@\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(endpoint_type& endpoint, error_code& ec); \end{itemdecl} \begin{itemdescr} \pnum -\returns \tcode{accept(get_executor().context(), endpoint, ec)}. +\returns \tcode{accept(get_executor()\removed{.context()}, endpoint, ec)}. \end{itemdescr} \begin{itemdecl} -socket_type accept(io_context& ctx, endpoint_type& endpoint); -socket_type accept(io_context& ctx, endpoint_type& endpoint, - error_code& ec); +@\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint);}@ +@\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint,}@ +@\removedcode{ error_code\& ec);}@ +@\addedcode{template}@ +@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint);}@ +@\addedcode{template}@ +@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint, error_code\& ec);}@ \end{itemdecl} \begin{itemdescr} @@ -4536,7 +4582,22 @@ \pnum -\returns On success, \tcode{socket_type(ctx, protocol_, h)}. Otherwise \tcode{socket_type(ctx)}. +\removed{\returns On success, \tcode{socket_type(ctx, protocol_, h)}. Otherwise \tcode{socket_type(ctx)}.} +\added{\returns On success, \tcode{\{ex, protocol_, h\}}. Otherwise \tcode{\{ex\}}.} +\end{itemdescr} + +\begin{itemdecl} +@\addedcode{template}@ +@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint);}@ +@\addedcode{template}@ +@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint, error_code\& ec);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\returns \tcode{accept(ctx.get_executor(), endpoint, ec)}.} \end{itemdescr} \begin{itemdecl} @@ -4549,19 +4610,25 @@ \pnum \returns \begin{codeblock} -async_accept(get_executor().context(), endpoint, forward(token)) +async_accept(get_executor()@\removedcode{.context()}@, endpoint, forward(token)) \end{codeblock} \end{itemdescr} \begin{itemdecl} -template - @\DEDUCED@ async_accept(io_context& ctx, endpoint_type& endpoint, - CompletionToken&& token); +@\removedcode{template}@ +@\removedcode{ \DEDUCED\ async_accept(io_context\& ctx, endpoint_type\& endpoint,}@ +@\removedcode{ CompletionToken\&\& token);}@ +@\addedcode{template}@ +@\addedcode{ \DEDUCED\ async_accept(const OtherExecutor\& ex, endpoint_type\& endpoint,}@ +@\addedcode{ CompletionToken\&\& token);}@ \end{itemdecl} \begin{itemdescr} +\addedpnum +\added{Let \tcode{S} be the type \tcode{typename Protocol::socket::template rebind_executor::other}.} + \pnum -\completionsig \tcode{void(error_code ec, socket_type s)}. +\completionsig \tcode{void(error_code ec, \removed{socket_type}\added{S} s)}. \pnum \effects Initiates an asynchronous operation to extract a socket from the queue of pending connections of the acceptor, as if by POSIX: @@ -4573,7 +4640,22 @@ if (h >= 0) endpoint.resize(endpoint_len); \end{codeblock} -On success, \tcode{s} is \tcode{socket_type(ctx, protocol_, h)}. Otherwise, \tcode{s} is \tcode{socket_type(ctx)}. +\removed{On success, \tcode{s} is \tcode{socket_type(ctx, protocol_, h)}. Otherwise, \tcode{s} is \tcode{socket_type(ctx)}.} +\added{On success, \tcode{s} is \tcode{S(ex, protocol_, h)}. Otherwise, \tcode{s} is \tcode{S(ex)}.} +\end{itemdescr} + +\begin{itemdecl} +@\addedcode{template}@ +@\addedcode{ \DEDUCED\ async_accept(ExecutionContext\& ctx, endpoint_type\& endpoint,}@ +@\addedcode{ CompletionToken\&\& token);}@ +\end{itemdecl} + +\begin{itemdescr} +\addedpnum +\added{\returns} +\begin{codeblock} +@\addedcode{async_accept(ctx.get_executor(), forward(token))}@ +\end{codeblock} \end{itemdescr} \begin{itemdecl} From f0c8f8b990789536e1f6b271e99ad382b7d4394e Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Thu, 20 Aug 2020 09:27:39 +1000 Subject: [PATCH 17/23] Reinstate basic_socket_acceptor::socket_type. --- src/sockets.tex | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index d16a543..79f11ba 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -3599,7 +3599,7 @@ using native_handle_type = @\impdefx{type of \tcode{basic_socket_acceptor::native_handle_type}}@; // \nativeref using protocol_type = AcceptableProtocol; using endpoint_type = typename protocol_type::endpoint; - @\removedcode{using socket_type = typename protocol_type::socket;}@ + using socket_type = typename protocol_type::socket; @\addedcode{template}@ @\addedcode{struct rebind_executor}@ @@ -3698,8 +3698,8 @@ void enable_connection_aborted(bool mode); bool enable_connection_aborted() const; - @\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(); - @\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(error_code& ec); + socket_type accept(); + socket_type accept(error_code& ec); @\removedcode{socket_type accept(io_context\& ctx);}@ @\removedcode{socket_type accept(io_context\& ctx, error_code\& ec);}@ @\addedcode{template}@ @@ -3724,8 +3724,8 @@ @\addedcode{template}@ @\addedcode{ \DEDUCED\ async_accept(ExecutionContext\& ctx, CompletionToken\&\& token);}@ - @\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(endpoint_type& endpoint); - @\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(endpoint_type& endpoint, error_code& ec); + socket_type accept(endpoint_type& endpoint); + socket_type accept(endpoint_type& endpoint, error_code& ec); @\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint);}@ @\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint,}@ @\removedcode{ error_code\& ec);}@ @@ -4450,8 +4450,8 @@ \end{itemdescr} \begin{itemdecl} -@\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(); -@\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(error_code& ec); +socket_type accept(); +socket_type accept(error_code& ec); \end{itemdecl} \begin{itemdescr} @@ -4479,8 +4479,7 @@ \pnum -\removed{\returns On success, \tcode{socket_type(ctx, protocol_, h)}. Otherwise \tcode{socket_type(ctx)}.} -\added{\returns On success, \tcode{\{ex, protocol_, h\}}. Otherwise \tcode{\{ex\}}.} +\returns On success, \tcode{socket_type(\removed{ctx}\added{ex}, protocol_, h)}. Otherwise \tcode{socket_type(\removed{ctx}\added{ex})}. \end{itemdescr} \begin{itemdecl} @@ -4547,8 +4546,8 @@ \end{itemdescr} \begin{itemdecl} -@\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(endpoint_type& endpoint); -@\removedcode{socket_type}\addedcode{typename Protocol::socket}@ accept(endpoint_type& endpoint, error_code& ec); +socket_type accept(endpoint_type& endpoint); +socket_type accept(endpoint_type& endpoint, error_code& ec); \end{itemdecl} \begin{itemdescr} @@ -4582,8 +4581,7 @@ \pnum -\removed{\returns On success, \tcode{socket_type(ctx, protocol_, h)}. Otherwise \tcode{socket_type(ctx)}.} -\added{\returns On success, \tcode{\{ex, protocol_, h\}}. Otherwise \tcode{\{ex\}}.} +\returns On success, \tcode{socket_type(\removed{ctx}\added{ex}, protocol_, h)}. Otherwise \tcode{socket_type(\removed{ctx}\added{ex})}. \end{itemdescr} \begin{itemdecl} From caf24d04db242e3ea6aa2307ffaff0fe27955ae7 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Thu, 20 Aug 2020 11:24:09 +1000 Subject: [PATCH 18/23] Add template type alias basic_socket_acceptor::rebind_socket_executor. --- src/sockets.tex | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index 79f11ba..528a206 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -3607,6 +3607,10 @@ @\addedcode{ using other = basic_socket_acceptor;}@ @\addedcode{\};}@ + @\addedcode{template}@ + @\addedcode{using rebind_socket_executor}@ + @\addedcode{ = typename AcceptableProtocol::socket::template rebind_executor::other;}@ + // \ref{socket.acceptor.cons}, construct / copy / destroy explicit basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); @@ -3703,16 +3707,16 @@ @\removedcode{socket_type accept(io_context\& ctx);}@ @\removedcode{socket_type accept(io_context\& ctx, error_code\& ec);}@ @\addedcode{template}@ - @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(const OtherExecutor\& ex);}@ @\addedcode{template}@ - @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(const OtherExecutor\& ex, error_code\& ec);}@ @\addedcode{template}@ - @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(ExecutionContext\& ctx);}@ @\addedcode{template}@ - @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(ExecutionContext\& ctx, error_code\& ec);}@ template @@ -3730,16 +3734,16 @@ @\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint,}@ @\removedcode{ error_code\& ec);}@ @\addedcode{template}@ - @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint);}@ @\addedcode{template}@ - @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint, error_code\& ec);}@ @\addedcode{template}@ - @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint);}@ @\addedcode{template}@ - @\addedcode{ typename Protocol::socket::template rebind_executor::other}@ + @\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint, error_code\& ec);}@ template @@ -4463,10 +4467,10 @@ @\removedcode{socket_type accept(io_context\& ctx);}@ @\removedcode{socket_type accept(io_context\& ctx, error_code\& ec);}@ @\addedcode{template}@ -@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(const OtherExecutor\& ex);}@ @\addedcode{template}@ -@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(const OtherExecutor\& ex, error_code\& ec);}@ \end{itemdecl} @@ -4484,10 +4488,10 @@ \begin{itemdecl} @\addedcode{template}@ -@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(ExecutionContext\& ctx);}@ @\addedcode{template}@ -@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(ExecutionContext\& ctx, error_code\& ec);}@ \end{itemdecl} @@ -4518,7 +4522,7 @@ \begin{itemdescr} \addedpnum -\added{Let \tcode{S} be the type \tcode{typename Protocol::socket::template rebind_executor::other}.} +\added{Let \tcode{S} be the type \tcode{rebind_socket_executor}.} \pnum \completionsig \tcode{void(error_code ec, \removed{socket_type}\added{S} s)}. @@ -4560,10 +4564,10 @@ @\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint,}@ @\removedcode{ error_code\& ec);}@ @\addedcode{template}@ -@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint);}@ @\addedcode{template}@ -@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint, error_code\& ec);}@ \end{itemdecl} @@ -4586,10 +4590,10 @@ \begin{itemdecl} @\addedcode{template}@ -@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint);}@ @\addedcode{template}@ -@\addedcode{ typename Protocol::socket::template rebind_executor::other}@ +@\addedcode{ rebind_socket_executor}@ @\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint, error_code\& ec);}@ \end{itemdecl} @@ -4623,7 +4627,7 @@ \begin{itemdescr} \addedpnum -\added{Let \tcode{S} be the type \tcode{typename Protocol::socket::template rebind_executor::other}.} +\added{Let \tcode{S} be the type \tcode{rebind_socket_executor}.} \pnum \completionsig \tcode{void(error_code ec, \removed{socket_type}\added{S} s)}. From 161464fd10af0cd73efde0696a1b837c97a12b5c Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Thu, 20 Aug 2020 11:28:37 +1000 Subject: [PATCH 19/23] Change rebind_executor to be a template type alias. --- src/internetprotocol.tex | 6 ++---- src/sockets.tex | 26 +++++++++----------------- src/timers.tex | 6 ++---- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/internetprotocol.tex b/src/internetprotocol.tex index ee2da9f..2484fc3 100644 --- a/src/internetprotocol.tex +++ b/src/internetprotocol.tex @@ -3078,10 +3078,8 @@ using results_type = basic_resolver_results; @\addedcode{template}@ - @\addedcode{struct rebind_executor}@ - @\addedcode{\{}@ - @\addedcode{ using other = basic_resolver;}@ - @\addedcode{\};}@ + @\addedcode{using rebind_executor =}@ + @\addedcode{ basic_resolver;}@ // \ref{internet.resolver.cons}, construct / copy / destroy diff --git a/src/sockets.tex b/src/sockets.tex index 528a206..5113f03 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -1412,10 +1412,8 @@ using endpoint_type = typename protocol_type::endpoint; @\addedcode{template}@ - @\addedcode{struct rebind_executor}@ - @\addedcode{\{}@ - @\addedcode{ using other = basic_socket;}@ - @\addedcode{\};}@ + @\addedcode{using rebind_executor =}@ + @\addedcode{ basic_socket;}@ // \ref{socket.basic.ops}, basic_socket operations @@ -2304,10 +2302,8 @@ using endpoint_type = typename protocol_type::endpoint; @\addedcode{template}@ - @\addedcode{struct rebind_executor}@ - @\addedcode{\{}@ - @\addedcode{ using other = basic_datagram_socket;}@ - @\addedcode{\};}@ + @\addedcode{using rebind_executor =}@ + @\addedcode{ basic_datagram_socket;}@ // \ref{socket.dgram.cons}, construct / copy / destroy @@ -3048,10 +3044,8 @@ using endpoint_type = typename protocol_type::endpoint; @\addedcode{template}@ - @\addedcode{struct rebind_executor}@ - @\addedcode{\{}@ - @\addedcode{ using other = basic_stream_socket;}@ - @\addedcode{\};}@ + @\addedcode{using rebind_executor =}@ + @\addedcode{ basic_stream_socket;}@ // \ref{socket.stream.cons}, construct / copy / destroy @@ -3602,14 +3596,12 @@ using socket_type = typename protocol_type::socket; @\addedcode{template}@ - @\addedcode{struct rebind_executor}@ - @\addedcode{\{}@ - @\addedcode{ using other = basic_socket_acceptor;}@ - @\addedcode{\};}@ + @\addedcode{using rebind_executor =}@ + @\addedcode{ basic_socket_acceptor;}@ @\addedcode{template}@ @\addedcode{using rebind_socket_executor}@ - @\addedcode{ = typename AcceptableProtocol::socket::template rebind_executor::other;}@ + @\addedcode{ = typename AcceptableProtocol::socket::template rebind_executor;}@ // \ref{socket.acceptor.cons}, construct / copy / destroy diff --git a/src/timers.tex b/src/timers.tex index 15bbf93..d2df811 100644 --- a/src/timers.tex +++ b/src/timers.tex @@ -168,10 +168,8 @@ using traits_type = WaitTraits; @\addedcode{template}@ - @\addedcode{struct rebind_executor}@ - @\addedcode{\{}@ - @\addedcode{ using other = basic_waitable_timer;}@ - @\addedcode{\};}@ + @\addedcode{using rebind_executor =}@ + @\addedcode{ basic_waitable_timer;}@ // \ref{timer.waitable.cons}, construct / copy / destroy From fb9a803deb7f874c4aceca8f32fd4bd0bfbf7493 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Wed, 14 Oct 2020 20:57:04 +1100 Subject: [PATCH 20/23] Add AcceptableProtocol::socket_for. Rename rebind_socket_executor to socket_type_for. --- src/sockets.tex | 51 +++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/sockets.tex b/src/sockets.tex index 5113f03..6442354 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -385,6 +385,8 @@ \pnum A type \tcode{X} meets the \defnnewoldconcept{AcceptableProtocol} requirements if it meets the requirements of \newoldconcept{Protocol}~(\ref{socket.reqmts.protocol}) as well as the additional requirements listed below. +\added{In the table below, \tcode{E} is a type that satisfies the Executor requirements~(\ref{async.reqmts.executor}).} + \begin{libreqtab3} {\newoldconcept{AcceptableProtocol} requirements} {tab:socket.reqmts.acceptableprotocol.requirements} @@ -404,6 +406,10 @@ A type that meets the requirements of \oldconcept{Destructible} (\CppXref{destructible}) and \oldconcept{MoveConstructible} (\CppXref{moveconstructible}), and that is publicly and unambiguously derived from \tcode{basic_socket}. & \\ +\added{\tcode{X::socket_for}} & +\added{A type that satisfies the requirements of \tcode{Destructible} (\CppXref{destructible}) and \tcode{MoveConstructible} (\CppXref{moveconstructible}), and that is publicly and unambiguously derived from \tcode{basic_socket}.} & + \\ + \end{libreqtab3} @@ -3594,15 +3600,14 @@ using protocol_type = AcceptableProtocol; using endpoint_type = typename protocol_type::endpoint; using socket_type = typename protocol_type::socket; + @\addedcode{template}@ + @\addedcode{using socket_type_for}@ + @\addedcode{ = typename protocol_type::socket_for;}@ @\addedcode{template}@ @\addedcode{using rebind_executor =}@ @\addedcode{ basic_socket_acceptor;}@ - @\addedcode{template}@ - @\addedcode{using rebind_socket_executor}@ - @\addedcode{ = typename AcceptableProtocol::socket::template rebind_executor;}@ - // \ref{socket.acceptor.cons}, construct / copy / destroy explicit basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); @@ -3699,16 +3704,16 @@ @\removedcode{socket_type accept(io_context\& ctx);}@ @\removedcode{socket_type accept(io_context\& ctx, error_code\& ec);}@ @\addedcode{template}@ - @\addedcode{ rebind_socket_executor}@ + @\addedcode{ socket_type_for}@ @\addedcode{ accept(const OtherExecutor\& ex);}@ @\addedcode{template}@ - @\addedcode{ rebind_socket_executor}@ + @\addedcode{ socket_type_for}@ @\addedcode{ accept(const OtherExecutor\& ex, error_code\& ec);}@ @\addedcode{template}@ - @\addedcode{ rebind_socket_executor}@ + @\addedcode{ socket_type_for}@ @\addedcode{ accept(ExecutionContext\& ctx);}@ @\addedcode{template}@ - @\addedcode{ rebind_socket_executor}@ + @\addedcode{ socket_type_for}@ @\addedcode{ accept(ExecutionContext\& ctx, error_code\& ec);}@ template @@ -3726,16 +3731,16 @@ @\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint,}@ @\removedcode{ error_code\& ec);}@ @\addedcode{template}@ - @\addedcode{ rebind_socket_executor}@ + @\addedcode{ socket_type_for}@ @\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint);}@ @\addedcode{template}@ - @\addedcode{ rebind_socket_executor}@ + @\addedcode{ socket_type_for}@ @\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint, error_code\& ec);}@ @\addedcode{template}@ - @\addedcode{ rebind_socket_executor}@ + @\addedcode{ socket_type_for}@ @\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint);}@ @\addedcode{template}@ - @\addedcode{ rebind_socket_executor}@ + @\addedcode{ socket_type_for}@ @\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint, error_code\& ec);}@ template @@ -4459,10 +4464,10 @@ @\removedcode{socket_type accept(io_context\& ctx);}@ @\removedcode{socket_type accept(io_context\& ctx, error_code\& ec);}@ @\addedcode{template}@ -@\addedcode{ rebind_socket_executor}@ +@\addedcode{ socket_type_for}@ @\addedcode{ accept(const OtherExecutor\& ex);}@ @\addedcode{template}@ -@\addedcode{ rebind_socket_executor}@ +@\addedcode{ socket_type_for}@ @\addedcode{ accept(const OtherExecutor\& ex, error_code\& ec);}@ \end{itemdecl} @@ -4475,15 +4480,15 @@ \pnum -\returns On success, \tcode{socket_type(\removed{ctx}\added{ex}, protocol_, h)}. Otherwise \tcode{socket_type(\removed{ctx}\added{ex})}. +\returns On success, \tcode{socket_type\added{_for}(\removed{ctx}\added{ex}, protocol_, h)}. Otherwise \tcode{socket_type\added{_for}(\removed{ctx}\added{ex})}. \end{itemdescr} \begin{itemdecl} @\addedcode{template}@ -@\addedcode{ rebind_socket_executor}@ +@\addedcode{ socket_type_for}@ @\addedcode{ accept(ExecutionContext\& ctx);}@ @\addedcode{template}@ -@\addedcode{ rebind_socket_executor}@ +@\addedcode{ socket_type_for}@ @\addedcode{ accept(ExecutionContext\& ctx, error_code\& ec);}@ \end{itemdecl} @@ -4514,7 +4519,7 @@ \begin{itemdescr} \addedpnum -\added{Let \tcode{S} be the type \tcode{rebind_socket_executor}.} +\added{Let \tcode{S} be the type \tcode{socket_type_for}.} \pnum \completionsig \tcode{void(error_code ec, \removed{socket_type}\added{S} s)}. @@ -4556,10 +4561,10 @@ @\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint,}@ @\removedcode{ error_code\& ec);}@ @\addedcode{template}@ -@\addedcode{ rebind_socket_executor}@ +@\addedcode{ socket_type_for}@ @\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint);}@ @\addedcode{template}@ -@\addedcode{ rebind_socket_executor}@ +@\addedcode{ socket_type_for}@ @\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint, error_code\& ec);}@ \end{itemdecl} @@ -4582,10 +4587,10 @@ \begin{itemdecl} @\addedcode{template}@ -@\addedcode{ rebind_socket_executor}@ +@\addedcode{ socket_type_for}@ @\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint);}@ @\addedcode{template}@ -@\addedcode{ rebind_socket_executor}@ +@\addedcode{ socket_type_for}@ @\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint, error_code\& ec);}@ \end{itemdecl} @@ -4619,7 +4624,7 @@ \begin{itemdescr} \addedpnum -\added{Let \tcode{S} be the type \tcode{rebind_socket_executor}.} +\added{Let \tcode{S} be the type \tcode{socket_type_for}.} \pnum \completionsig \tcode{void(error_code ec, \removed{socket_type}\added{S} s)}. From fa0008638d271ecc97aafbc05168dfcfe46c878c Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Wed, 3 Feb 2021 22:37:20 +1100 Subject: [PATCH 21/23] Add socket_for type alias to ip::tcp and ip::udp. --- src/internetprotocol.tex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/internetprotocol.tex b/src/internetprotocol.tex index 2484fc3..a8fa237 100644 --- a/src/internetprotocol.tex +++ b/src/internetprotocol.tex @@ -3525,6 +3525,8 @@ using endpoint = basic_endpoint; using resolver = basic_resolver; using socket = basic_stream_socket; + @\addedcode{template}@ + @\addedcode{ using socket_for = basic_stream_socket}@ using acceptor = basic_socket_acceptor; using iostream = basic_socket_iostream; class no_delay; @@ -3633,6 +3635,8 @@ using endpoint = basic_endpoint; using resolver = basic_resolver; using socket = basic_datagram_socket; + @\addedcode{template}@ + @\addedcode{ using socket_for = basic_datagram_socket}@ // static members: static constexpr udp v4() noexcept; From ac31799931b27194132bbd9ab94979c92aa263ed Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Sat, 18 Sep 2021 11:35:32 +1000 Subject: [PATCH 22/23] Remove diff markup. --- src/forward.tex | 16 +- src/internetprotocol.tex | 40 +- src/socketalgorithms.tex | 48 +-- src/sockets.tex | 864 +++++++++++++++++++-------------------- src/socketstreams.tex | 50 +-- src/timers.tex | 84 ++-- 6 files changed, 540 insertions(+), 562 deletions(-) diff --git a/src/forward.tex b/src/forward.tex index c76aa5d..78b9745 100644 --- a/src/forward.tex +++ b/src/forward.tex @@ -22,25 +22,25 @@ class io_context; template struct wait_traits; - template@\addedcode{, class Executor = executor}@> + template, class Executor = executor> class basic_waitable_timer; using system_timer = basic_waitable_timer; using steady_timer = basic_waitable_timer; using high_resolution_timer = basic_waitable_timer; - template + template class basic_socket; - template + template class basic_datagram_socket; - template + template class basic_stream_socket; - template + template class basic_socket_acceptor; template@\addedcode{, class Executor = executor}@> + class WaitTraits = wait_traits, class Executor = executor> class basic_socket_streambuf; template@\addedcode{, class Executor = executor}@> + class WaitTraits = wait_traits, class Executor = executor> class basic_socket_iostream; namespace ip { @@ -64,7 +64,7 @@ class basic_resolver_entry; template class basic_resolver_results; - template + template class basic_resolver; class tcp; class udp; diff --git a/src/internetprotocol.tex b/src/internetprotocol.tex index a8fa237..61b15d4 100644 --- a/src/internetprotocol.tex +++ b/src/internetprotocol.tex @@ -180,7 +180,7 @@ class resolver_base; - template + template class basic_resolver; string host_name(); @@ -3066,25 +3066,25 @@ namespace std::experimental::net::inline @\namespacever@ { namespace ip { - template + template class basic_resolver : public resolver_base { public: // types: - using executor_type = @\removedcode{io_context::executor_type}\addedcode{Executor}@; + using executor_type = Executor; using protocol_type = InternetProtocol; using endpoint_type = typename InternetProtocol::endpoint; using results_type = basic_resolver_results; - @\addedcode{template}@ - @\addedcode{using rebind_executor =}@ - @\addedcode{ basic_resolver;}@ + template + using rebind_executor = + basic_resolver; // \ref{internet.resolver.cons}, construct / copy / destroy - explicit basic_resolver(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); - @\addedcode{template explicit basic_resolver(ExecutionContext\& ctx);}@ + explicit basic_resolver(const executor_type& ex); + template explicit basic_resolver(ExecutionContext& ctx); basic_resolver(const basic_resolver&) = delete; basic_resolver(basic_resolver&& rhs) noexcept; @@ -3151,26 +3151,26 @@ \rSec2[internet.resolver.cons]{\tcode{ip::basic_resolver} constructors} \begin{itemdecl} -explicit basic_resolver(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); +explicit basic_resolver(const executor_type& ex); \end{itemdecl} \begin{itemdescr} \pnum -\postconditions \tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\postconditions \tcode{get_executor() == ex}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template explicit basic_resolver(ExecutionContext\& ctx);}@ +template explicit basic_resolver(ExecutionContext\& ctx); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\postconditions \tcode{get_executor() == ctx.get_executor()}.} +\pnum +\postconditions \tcode{get_executor() == ctx.get_executor()}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} @@ -3525,8 +3525,8 @@ using endpoint = basic_endpoint; using resolver = basic_resolver; using socket = basic_stream_socket; - @\addedcode{template}@ - @\addedcode{ using socket_for = basic_stream_socket}@ + template + using socket_for = basic_stream_socket using acceptor = basic_socket_acceptor; using iostream = basic_socket_iostream; class no_delay; @@ -3635,8 +3635,8 @@ using endpoint = basic_endpoint; using resolver = basic_resolver; using socket = basic_datagram_socket; - @\addedcode{template}@ - @\addedcode{ using socket_for = basic_datagram_socket}@ + template + using socket_for = basic_datagram_socket // static members: static constexpr udp v4() noexcept; diff --git a/src/socketalgorithms.tex b/src/socketalgorithms.tex index 731715a..904eeed 100644 --- a/src/socketalgorithms.tex +++ b/src/socketalgorithms.tex @@ -6,11 +6,11 @@ \rSec1[socket.algo.connect]{Synchronous connect operations} \begin{itemdecl} -template - typename Protocol::endpoint connect(basic_socket& s, +template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints); -template - typename Protocol::endpoint connect(basic_socket& s, +template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints, error_code& ec); \end{itemdecl} @@ -21,12 +21,12 @@ \end{itemdescr} \begin{itemdecl} -template - typename Protocol::endpoint connect(basic_socket& s, +template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints, ConnectCondition c); -template - typename Protocol::endpoint connect(basic_socket& s, +template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints, ConnectCondition c, error_code& ec); \end{itemdecl} @@ -57,11 +57,11 @@ \end{itemdescr} \begin{itemdecl} -template - InputIterator connect(basic_socket& s, +template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last); -template - InputIterator connect(basic_socket& s, +template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last, error_code& ec); \end{itemdecl} @@ -72,12 +72,12 @@ \end{itemdescr} \begin{itemdecl} -template - InputIterator connect(basic_socket& s, +template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last, ConnectCondition c); -template - InputIterator connect(basic_socket& s, +template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last, ConnectCondition c, error_code& ec); \end{itemdecl} @@ -112,8 +112,8 @@ \rSec1[socket.algo.async.connect]{Asynchronous connect operations} \begin{itemdecl} -template - @\DEDUCED@ async_connect(basic_socket& s, +template + @\DEDUCED@ async_connect(basic_socket& s, const EndpointSequence& endpoints, CompletionToken&& token); \end{itemdecl} @@ -127,9 +127,9 @@ \end{itemdescr} \begin{itemdecl} -template - @\DEDUCED@ async_connect(basic_socket& s, + @\DEDUCED@ async_connect(basic_socket& s, const EndpointSequence& endpoints, ConnectCondition c, CompletionToken&& token); @@ -168,8 +168,8 @@ \end{itemdescr} \begin{itemdecl} -template - @\DEDUCED@ async_connect(basic_socket& s, +template + @\DEDUCED@ async_connect(basic_socket& s, InputIterator first, InputIterator last, CompletionToken&& token); \end{itemdecl} @@ -184,9 +184,9 @@ \end{itemdescr} \begin{itemdecl} -template - @\DEDUCED@ async_connect(basic_socket& s, + @\DEDUCED@ async_connect(basic_socket& s, InputIterator first, InputIterator last, ConnectCondition c, CompletionToken&& token); diff --git a/src/sockets.tex b/src/sockets.tex index 6442354..76b3efc 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -24,84 +24,84 @@ class socket_base; - template + template class basic_socket; - template + template class basic_datagram_socket; - template + template class basic_stream_socket; - template + template class basic_socket_acceptor; // \ref{socket.iostreams}, Socket streams template@\addedcode{, class Executor = executor}@> + class WaitTraits = wait_traits, class Executor = executor> class basic_socket_streambuf; template@\addedcode{, class Executor = executor}@> + class WaitTraits = wait_traits, class Executor = executor> class basic_socket_iostream; // \ref{socket.algo.connect}, synchronous connect operations - template - typename Protocol::endpoint connect(basic_socket& s, + template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints); - template - typename Protocol::endpoint connect(basic_socket& s, + template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints, error_code& ec); - template - typename Protocol::endpoint connect(basic_socket& s, + template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints, ConnectCondition c); - template - typename Protocol::endpoint connect(basic_socket& s, + template + typename Protocol::endpoint connect(basic_socket& s, const EndpointSequence& endpoints, ConnectCondition c, error_code& ec); - template - InputIterator connect(basic_socket& s, + template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last); - template - InputIterator connect(basic_socket& s, + template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last, error_code& ec); - template - InputIterator connect(basic_socket& s, + template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last, ConnectCondition c); - template - InputIterator connect(basic_socket& s, + template + InputIterator connect(basic_socket& s, InputIterator first, InputIterator last, ConnectCondition c, error_code& ec); // \ref{socket.algo.async.connect}, asynchronous connect operations - template - @\DEDUCED@ async_connect(basic_socket& s, + template + @\DEDUCED@ async_connect(basic_socket& s, const EndpointSequence& endpoints, CompletionToken&& token); - template - @\DEDUCED@ async_connect(basic_socket& s, + @\DEDUCED@ async_connect(basic_socket& s, const EndpointSequence& endpoints, ConnectCondition c, CompletionToken&& token); - template - @\DEDUCED@ async_connect(basic_socket& s, + template + @\DEDUCED@ async_connect(basic_socket& s, InputIterator first, InputIterator last, CompletionToken&& token); - template - @\DEDUCED@ async_connect(basic_socket& s, + @\DEDUCED@ async_connect(basic_socket& s, InputIterator first, InputIterator last, ConnectCondition c, CompletionToken&& token); @@ -385,7 +385,7 @@ \pnum A type \tcode{X} meets the \defnnewoldconcept{AcceptableProtocol} requirements if it meets the requirements of \newoldconcept{Protocol}~(\ref{socket.reqmts.protocol}) as well as the additional requirements listed below. -\added{In the table below, \tcode{E} is a type that satisfies the Executor requirements~(\ref{async.reqmts.executor}).} +In the table below, \tcode{E} is a type that satisfies the Executor requirements~(\ref{async.reqmts.executor}). \begin{libreqtab3} {\newoldconcept{AcceptableProtocol} requirements} @@ -406,8 +406,8 @@ A type that meets the requirements of \oldconcept{Destructible} (\CppXref{destructible}) and \oldconcept{MoveConstructible} (\CppXref{moveconstructible}), and that is publicly and unambiguously derived from \tcode{basic_socket}. & \\ -\added{\tcode{X::socket_for}} & -\added{A type that satisfies the requirements of \tcode{Destructible} (\CppXref{destructible}) and \tcode{MoveConstructible} (\CppXref{moveconstructible}), and that is publicly and unambiguously derived from \tcode{basic_socket}.} & +\tcode{X::socket_for} & +A type that satisfies the requirements of \tcode{Destructible} (\CppXref{destructible}) and \tcode{MoveConstructible} (\CppXref{moveconstructible}), and that is publicly and unambiguously derived from \tcode{basic_socket}. & \\ \end{libreqtab3} @@ -1059,13 +1059,13 @@ \item socket option classes \tcode{broadcast}, \tcode{debug}, \tcode{do_not_route}, \tcode{keep_alive}, \tcode{linger}, \tcode{out_of_band_inline}, \tcode{receive_buffer_size}, \tcode{receive_low_watermark}, \tcode{reuse_address}, \tcode{send_buffer_size}, and \tcode{send_low_watermark}; \item -an enumerated type, \tcode{shutdown_type}, for use with the \tcode{basic_socket} class's \tcode{shutdown} member function. +an enumerated type, \tcode{shutdown_type}, for use with the \tcode{basic_socket} class's \tcode{shutdown} member function. \item -an enumerated type, \tcode{wait_type}, for use with the \tcode{basic_socket} and \tcode{basic_socket_acceptor} classes' \tcode{wait} and \tcode{async_wait} member functions, +an enumerated type, \tcode{wait_type}, for use with the \tcode{basic_socket} and \tcode{basic_socket_acceptor} classes' \tcode{wait} and \tcode{async_wait} member functions, \item -a bitmask type, \tcode{message_flags}, for use with the \tcode{basic_stream_socket} class's \tcode{send}, \tcode{async_send}, \tcode{receive}, and \tcode{async_receive} member functions, and the \tcode{basic_datagram_socket} class's \tcode{send}, \tcode{async_send}, \tcode{send_to}, \tcode{async_send_to}, \tcode{receive}, \tcode{async_receive}, \tcode{receive_from}, and \tcode{async_receive_from} member functions. +a bitmask type, \tcode{message_flags}, for use with the \tcode{basic_stream_socket} class's \tcode{send}, \tcode{async_send}, \tcode{receive}, and \tcode{async_receive} member functions, and the \tcode{basic_datagram_socket} class's \tcode{send}, \tcode{async_send}, \tcode{send_to}, \tcode{async_send_to}, \tcode{receive}, \tcode{async_receive}, \tcode{receive_from}, and \tcode{async_receive_from} member functions. \item -a constant, \tcode{max_listen_connections}, for use with the \tcode{basic_socket_acceptor} class's \tcode{listen} member function. +a constant, \tcode{max_listen_connections}, for use with the \tcode{basic_socket_acceptor} class's \tcode{listen} member function. \end{itemize} \begin{libreqtab3} @@ -1401,25 +1401,25 @@ \rSec1[socket.basic]{Class template \tcode{basic_socket}} \pnum -Class template \tcode{basic_socket} is used as the base class for the \tcode{basic_datagram_socket} and \tcode{basic_stream_socket} class templates. It provides functionality that is common to both types of socket. +Class template \tcode{basic_socket} is used as the base class for the \tcode{basic_datagram_socket} and \tcode{basic_stream_socket} class templates. It provides functionality that is common to both types of socket. \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template + template class basic_socket : public socket_base { public: // types: - using executor_type = @\removedcode{io_context::executor_type}\addedcode{Executor}@; + using executor_type = Executor; using native_handle_type = @\impdefx{type of \tcode{basic_socket::native_handle_type}}@; // \nativeref using protocol_type = Protocol; using endpoint_type = typename protocol_type::endpoint; - @\addedcode{template}@ - @\addedcode{using rebind_executor =}@ - @\addedcode{ basic_socket;}@ + template + using rebind_executor = + basic_socket; // \ref{socket.basic.ops}, basic_socket operations @@ -1504,31 +1504,31 @@ protected: // \ref{socket.basic.cons}, construct / copy / destroy - explicit basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); - @\addedcode{template}@ - @\addedcode{ explicit basic_socket(ExecutionContext\& ctx);}@ - basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); - @\addedcode{template}@ - @\addedcode{ basic_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ - basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint); - @\addedcode{template}@ - @\addedcode{ basic_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ - basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, + explicit basic_socket(const executor_type& ex); + template + explicit basic_socket(ExecutionContext& ctx); + basic_socket(const executor_type& ex, const protocol_type& protocol); + template + basic_socket(ExecutionContext& ctx, const protocol_type& protocol); + basic_socket(const executor_type& ex, const endpoint_type& endpoint); + template + basic_socket(ExecutionContext& ctx, const endpoint_type& endpoint); + basic_socket(const executor_type& ex, const protocol_type& protocol, const native_handle_type& native_socket); // \nativeref - @\addedcode{template}@ - @\addedcode{ basic_socket(ExecutionContext\& ctx, const protocol_type\& protocol,}@ - @\addedcode{ const native_handle_type\& native_socket); // \nativeref}@ + template + basic_socket(ExecutionContext& ctx, const protocol_type& protocol, + const native_handle_type& native_socket); // \nativeref basic_socket(const basic_socket&) = delete; basic_socket(basic_socket&& rhs); - template - basic_socket(basic_socket&& rhs); + template + basic_socket(basic_socket&& rhs); ~basic_socket(); basic_socket& operator=(const basic_socket&) = delete; basic_socket& operator=(basic_socket&& rhs); - template - basic_socket& operator=(basic_socket&& rhs); + template + basic_socket& operator=(basic_socket&& rhs); private: protocol_type protocol_; // \expos @@ -1547,7 +1547,7 @@ \rSec2[socket.basic.cons]{\tcode{basic_socket} constructors} \begin{itemdecl} -explicit basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); +explicit basic_socket(const executor_type& ex); \end{itemdecl} \begin{itemdescr} @@ -1555,29 +1555,29 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\tcode{get_executor() == ex}. \item \tcode{is_open() == false}. \end{itemize} \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_socket(ExecutionContext\& ctx);}@ +template + explicit basic_socket(ExecutionContext& ctx); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_socket(ctx.get_executor())}.} +\pnum +\effects Equivalent to \tcode{basic_socket(ctx.get_executor())}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); +basic_socket(const executor_type& ex, const protocol_type& protocol); \end{itemdecl} \begin{itemdescr} @@ -1588,7 +1588,7 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\tcode{get_executor() == ex}. \item \tcode{is_open() == true}. \item @@ -1599,22 +1599,22 @@ \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ +template + explicit basic_socket(ExecutionContext& ctx, const protocol_type& protocol); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), protocol)}.} +\pnum +\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), protocol)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint); +basic_socket(const executor_type& ex, const endpoint_type& endpoint); \end{itemdecl} \begin{itemdescr} @@ -1630,7 +1630,7 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\tcode{get_executor() == ex}. \item \tcode{is_open() == true}. \item @@ -1641,22 +1641,22 @@ \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ +template + explicit basic_socket(ExecutionContext& ctx, const endpoint_type& endpoint); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), endpoint)}.} +\pnum +\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), endpoint)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, +basic_socket(const executor_type& ex, const protocol_type& protocol, const native_handle_type& native_socket); \end{itemdecl} @@ -1671,7 +1671,7 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\tcode{get_executor() == ex}. \item \tcode{is_open() == true}. \item @@ -1682,19 +1682,19 @@ \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ basic_socket(ExecutionContext\& ctx, const protocol_type\& protocol,}@ -@\addedcode{ const native_handle_type\& native_socket);}@ +template + basic_socket(ExecutionContext& ctx, const protocol_type& protocol, + const native_handle_type& native_socket); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), protocol, native_socket)}.} +\pnum +\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), protocol, native_socket)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} @@ -1703,7 +1703,7 @@ \begin{itemdescr} \pnum -\effects Move constructs an object of class \tcode{basic_socket} that refers to the state originally represented by \tcode{rhs}. +\effects Move constructs an object of class \tcode{basic_socket} that refers to the state originally represented by \tcode{rhs}. \pnum \postconditions @@ -1724,16 +1724,16 @@ \end{itemdescr} \begin{itemdecl} -template - basic_socket(basic_socket&& rhs); +template + basic_socket(basic_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \pnum -\effects Move constructs an object of class \tcode{basic_socket} that refers to the state originally represented by \tcode{rhs}. +\effects Move constructs an object of class \tcode{basic_socket} that refers to the state originally represented by \tcode{rhs}. \pnum \postconditions @@ -1753,7 +1753,7 @@ \end{itemize} \pnum -\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -1801,13 +1801,13 @@ \end{itemdescr} \begin{itemdecl} -template - basic_socket& operator=(basic_socket&& rhs); +template + basic_socket& operator=(basic_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \pnum \effects If \tcode{is_open()} is \tcode{true}, cancels all outstanding asynchronous operations associated with this socket. Completion handlers for canceled operations are passed an error code \tcode{ec} such that \tcode{ec == errc::operation_canceled} yields \tcode{true}. Disables the linger socket option to prevent the assignment from blocking, and releases socket resources as if by POSIX \tcode{close(native_handle())}. Moves into \tcode{*this} the state originally represented by \tcode{rhs}. @@ -1831,7 +1831,7 @@ \returns \tcode{*this}. \pnum -\remarks This assignment operator shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\remarks This assignment operator shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -2291,53 +2291,53 @@ \rSec1[socket.dgram]{Class template \tcode{basic_datagram_socket}} \pnum -The class template \tcode{basic_datagram_socket} is used to send and receive discrete messages of fixed maximum length. +The class template \tcode{basic_datagram_socket} is used to send and receive discrete messages of fixed maximum length. \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template - class basic_datagram_socket : public basic_socket + template + class basic_datagram_socket : public basic_socket { public: // types: - @\addedcode{using executor_type = Executor;}@ + using executor_type = Executor; using native_handle_type = @\impdefx{type of \tcode{basic_datagram_socket::native_handle_type}}@; // \nativeref using protocol_type = Protocol; using endpoint_type = typename protocol_type::endpoint; - @\addedcode{template}@ - @\addedcode{using rebind_executor =}@ - @\addedcode{ basic_datagram_socket;}@ + template + using rebind_executor = + basic_datagram_socket; // \ref{socket.dgram.cons}, construct / copy / destroy - explicit basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); - @\addedcode{template}@ - @\addedcode{ explicit basic_datagram_socket(ExecutionContext\& ctx);}@ - basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); - @\addedcode{template}@ - @\addedcode{ basic_datagram_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ - basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint); - @\addedcode{template}@ - @\addedcode{ basic_datagram_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ - basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, + explicit basic_datagram_socket(const executor_type& ex); + template + explicit basic_datagram_socket(ExecutionContext& ctx); + basic_datagram_socket(const executor_type& ex, const protocol_type& protocol); + template + basic_datagram_socket(ExecutionContext& ctx, const protocol_type& protocol); + basic_datagram_socket(const executor_type& ex, const endpoint_type& endpoint); + template + basic_datagram_socket(ExecutionContext& ctx, const endpoint_type& endpoint); + basic_datagram_socket(const executor_type& ex, const protocol_type& protocol, const native_handle_type& native_socket); - @\addedcode{template}@ - @\addedcode{ basic_datagram_socket(ExecutionContext\& ctx, const protocol_type\& protocol,}@ - @\addedcode{ const native_handle_type\& native_socket);}@ + template + basic_datagram_socket(ExecutionContext& ctx, const protocol_type& protocol, + const native_handle_type& native_socket); basic_datagram_socket(const basic_datagram_socket&) = delete; basic_datagram_socket(basic_datagram_socket&& rhs); - template - basic_datagram_socket(basic_datagram_socket&& rhs); + template + basic_datagram_socket(basic_datagram_socket&& rhs); ~basic_datagram_socket(); basic_datagram_socket& operator=(const basic_datagram_socket&) = delete; basic_datagram_socket& operator=(basic_datagram_socket&& rhs); - template - basic_datagram_socket& operator=(basic_datagram_socket&& rhs); + template + basic_datagram_socket& operator=(basic_datagram_socket&& rhs); // \ref{socket.dgram.op}, basic_datagram_socket operations @@ -2456,81 +2456,81 @@ When an operation has its effects specified as if by passing the result of \tcode{native_handle()} to a POSIX function, then the operation fails with error condition \tcode{errc::bad_file_descriptor} if \tcode{is_open() == false} at the point in the effects when the POSIX function is called. \pnum -If \tcode{native_handle_type} and \tcode{basic_socket::native_handle_type} +If \tcode{native_handle_type} and \tcode{basic_socket::native_handle_type} are both defined then they name the same type. \rSec2[socket.dgram.cons]{\tcode{basic_datagram_socket} constructors} \begin{itemdecl} -explicit basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); +explicit basic_datagram_socket(const executor_type& ex); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(\removed{ctx}\added{ex})}. +\effects Initializes the base class with \tcode{basic_socket(ex)}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_datagram_socket(ExecutionContext\& ctx);}@ +template + explicit basic_datagram_socket(ExecutionContext& ctx); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor())}.} +\pnum +\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor())}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); +basic_datagram_socket(const executor_type& ex, const protocol_type& protocol); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx, protocol)}. +\effects Initializes the base class with \tcode{basic_socket(ctx, protocol)}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_datagram_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ +template + explicit basic_datagram_socket(ExecutionContext& ctx, const protocol_type& protocol); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), protocol)}.} +\pnum +\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), protocol)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_datagram_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint); +basic_datagram_socket(const executor_type& ex, const endpoint_type& endpoint); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx, endpoint)}. +\effects Initializes the base class with \tcode{basic_socket(ctx, endpoint)}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_datagram_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ +template + explicit basic_datagram_socket(ExecutionContext& ctx, const endpoint_type& endpoint); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), endpoint)}.} +\pnum +\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), endpoint)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} @@ -2540,23 +2540,23 @@ \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx, protocol, native_socket)}. +\effects Initializes the base class with \tcode{basic_socket(ctx, protocol, native_socket)}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ basic_datagram_socket(ExecutionContext\& ctx, const protocol_type\& protocol,}@ -@\addedcode{ const native_handle_type\& native_socket);}@ +template + basic_datagram_socket(ExecutionContext& ctx, const protocol_type& protocol, + const native_handle_type& native_socket); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), protocol, native_socket)}.} +\pnum +\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), protocol, native_socket)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} @@ -2565,23 +2565,23 @@ \begin{itemdescr} \pnum -\effects Move constructs an object of class \tcode{basic_datagram_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. +\effects Move constructs an object of class \tcode{basic_datagram_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. \end{itemdescr} \begin{itemdecl} -template - basic_datagram_socket(basic_datagram_socket&& rhs); +template + basic_datagram_socket(basic_datagram_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \pnum -\effects Move constructs an object of class \tcode{basic_datagram_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. +\effects Move constructs an object of class \tcode{basic_datagram_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. \pnum -\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -2594,29 +2594,29 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. +\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. \pnum \returns \tcode{*this}. \end{itemdescr} \begin{itemdecl} -template - basic_datagram_socket& operator=(basic_datagram_socket&& rhs); +template + basic_datagram_socket& operator=(basic_datagram_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \pnum -\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. +\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. \pnum \returns \tcode{*this}. \pnum -\remarks This assignment operator not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\remarks This assignment operator not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -3033,53 +3033,53 @@ \rSec1[socket.stream]{Class template \tcode{basic_stream_socket}} \pnum -The class template \tcode{basic_stream_socket} is used to exchange data with a peer over a sequenced, reliable, bidirectional, connection-mode byte stream. +The class template \tcode{basic_stream_socket} is used to exchange data with a peer over a sequenced, reliable, bidirectional, connection-mode byte stream. \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template - class basic_stream_socket : public basic_socket + template + class basic_stream_socket : public basic_socket { public: // types: - @\addedcode{using executor_type = Executor;}@ + using executor_type = Executor; using native_handle_type = @\impdefx{type of \tcode{basic_stream_socket::native_handle_type}}@; // \nativeref using protocol_type = Protocol; using endpoint_type = typename protocol_type::endpoint; - @\addedcode{template}@ - @\addedcode{using rebind_executor =}@ - @\addedcode{ basic_stream_socket;}@ + template + using rebind_executor = + basic_stream_socket; // \ref{socket.stream.cons}, construct / copy / destroy - explicit basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); - @\addedcode{template}@ - @\addedcode{ explicit basic_stream_socket(ExecutionContext\& ctx);}@ - basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); - @\addedcode{template}@ - @\addedcode{ basic_stream_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ - basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint); - @\addedcode{template}@ - @\addedcode{ basic_stream_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ - basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, + explicit basic_stream_socket(const executor_type& ex); + template + explicit basic_stream_socket(ExecutionContext& ctx); + basic_stream_socket(const executor_type& ex, const protocol_type& protocol); + template + basic_stream_socket(ExecutionContext& ctx, const protocol_type& protocol); + basic_stream_socket(const executor_type& ex, const endpoint_type& endpoint); + template + basic_stream_socket(ExecutionContext& ctx, const endpoint_type& endpoint); + basic_stream_socket(const executor_type& ex, const protocol_type& protocol, const native_handle_type& native_socket); - @\addedcode{template}@ - @\addedcode{ basic_stream_socket(ExecutionContext\& ctx, const protocol_type\& protocol,}@ - @\addedcode{ const native_handle_type\& native_socket);}@ + template + basic_stream_socket(ExecutionContext& ctx, const protocol_type& protocol, + const native_handle_type& native_socket); basic_stream_socket(const basic_stream_socket&) = delete; basic_stream_socket(basic_stream_socket&& rhs); - template - basic_stream_socket(basic_stream_socket&& rhs); + template + basic_stream_socket(basic_stream_socket&& rhs); ~basic_stream_socket(); basic_stream_socket& operator=(const basic_stream_socket&) = delete; basic_stream_socket& operator=(basic_stream_socket&& rhs); - template - basic_stream_socket& operator=(basic_stream_socket&& rhs); + template + basic_stream_socket& operator=(basic_stream_socket&& rhs); // \ref{socket.stream.ops}, basic_stream_socket operations @@ -3163,108 +3163,108 @@ When an operation has its effects specified as if by passing the result of \tcode{native_handle()} to a POSIX function, then the operation fails with error condition \tcode{errc::bad_file_descriptor} if \tcode{is_open() == false} at the point in the effects when the POSIX function is called. \pnum -If \tcode{native_handle_type} and \tcode{basic_socket::native_handle_type} +If \tcode{native_handle_type} and \tcode{basic_socket::native_handle_type} are both defined then they name the same type. \rSec2[socket.stream.cons]{\tcode{basic_stream_socket} constructors} \begin{itemdecl} -explicit basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); +explicit basic_stream_socket(const executor_type& ex); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx)}. +\effects Initializes the base class with \tcode{basic_socket(ctx)}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_stream_socket(ExecutionContext\& ctx);}@ +template + explicit basic_stream_socket(ExecutionContext& ctx); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor())}.} +\pnum +\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor())}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); +basic_stream_socket(const executor_type& ex, const protocol_type& protocol); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx, protocol)}. +\effects Initializes the base class with \tcode{basic_socket(ctx, protocol)}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_stream_socket(ExecutionContext\& ctx, const protocol_type\& protocol);}@ +template + explicit basic_stream_socket(ExecutionContext& ctx, const protocol_type& protocol); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), protocol)}.} +\pnum +\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), protocol)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint); +basic_stream_socket(const executor_type& ex, const endpoint_type& endpoint); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx, endpoint)}. +\effects Initializes the base class with \tcode{basic_socket(ctx, endpoint)}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_stream_socket(ExecutionContext\& ctx, const endpoint_type\& endpoint);}@ +template + explicit basic_stream_socket(ExecutionContext& ctx, const endpoint_type& endpoint); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), endpoint)}.} +\pnum +\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), endpoint)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_stream_socket(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, +basic_stream_socket(const executor_type& ex, const protocol_type& protocol, const native_handle_type& native_socket); \end{itemdecl} \begin{itemdescr} \pnum -\effects Initializes the base class with \tcode{basic_socket(ctx, protocol, native_socket)}. +\effects Initializes the base class with \tcode{basic_socket(ctx, protocol, native_socket)}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ basic_stream_socket(ExecutionContext\& ctx, const protocol_type\& protocol,}@ -@\addedcode{ const native_handle_type\& native_socket);}@ +template + basic_stream_socket(ExecutionContext& ctx, const protocol_type& protocol, + const native_handle_type& native_socket); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), protocol, native_socket)}.} +\pnum +\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), protocol, native_socket)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} @@ -3273,23 +3273,23 @@ \begin{itemdescr} \pnum -\effects Move constructs an object of class \tcode{basic_stream_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. +\effects Move constructs an object of class \tcode{basic_stream_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. \end{itemdescr} \begin{itemdecl} -template - basic_stream_socket(basic_stream_socket&& rhs); +template + basic_stream_socket(basic_stream_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \pnum -\effects Move constructs an object of class \tcode{basic_stream_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. +\effects Move constructs an object of class \tcode{basic_stream_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. \pnum -\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -3302,29 +3302,29 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. +\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. \pnum \returns \tcode{*this}. \end{itemdescr} \begin{itemdecl} -template - basic_stream_socket& operator=(basic_stream_socket&& rhs); +template + basic_stream_socket& operator=(basic_stream_socket&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \pnum -\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. +\effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. \pnum \returns \tcode{*this}. \pnum -\remarks This assignment operator shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\remarks This assignment operator shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -3584,59 +3584,59 @@ \rSec1[socket.acceptor]{Class template \tcode{basic_socket_acceptor}} \pnum -An object of class template \tcode{basic_socket_acceptor} is used to listen for, and queue, incoming socket connections. Socket objects that represent the incoming connections are dequeued by calling \tcode{accept} or \tcode{async_accept}. +An object of class template \tcode{basic_socket_acceptor} is used to listen for, and queue, incoming socket connections. Socket objects that represent the incoming connections are dequeued by calling \tcode{accept} or \tcode{async_accept}. \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template + template class basic_socket_acceptor : public socket_base { public: // types: - using executor_type = @\removedcode{io_context::executor_type}\addedcode{Executor}@; + using executor_type = Executor; using native_handle_type = @\impdefx{type of \tcode{basic_socket_acceptor::native_handle_type}}@; // \nativeref using protocol_type = AcceptableProtocol; using endpoint_type = typename protocol_type::endpoint; using socket_type = typename protocol_type::socket; - @\addedcode{template}@ - @\addedcode{using socket_type_for}@ - @\addedcode{ = typename protocol_type::socket_for;}@ + template + using socket_type_for + = typename protocol_type::socket_for; - @\addedcode{template}@ - @\addedcode{using rebind_executor =}@ - @\addedcode{ basic_socket_acceptor;}@ + template + using rebind_executor = + basic_socket_acceptor; // \ref{socket.acceptor.cons}, construct / copy / destroy - explicit basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); - @\addedcode{template}@ - @\addedcode{ explicit basic_socket_acceptor(ExecutionContext\& ctx);}@ - basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); - @\addedcode{template}@ - @\addedcode{ basic_socket_acceptor(ExecutionContext\& ctx, const protocol_type\& protocol);}@ - basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint, + explicit basic_socket_acceptor(const executor_type& ex); + template + explicit basic_socket_acceptor(ExecutionContext& ctx); + basic_socket_acceptor(const executor_type& ex, const protocol_type& protocol); + template + basic_socket_acceptor(ExecutionContext& ctx, const protocol_type& protocol); + basic_socket_acceptor(const executor_type& ex, const endpoint_type& endpoint, bool reuse_addr = true); - @\addedcode{template}@ - @\addedcode{ basic_socket_acceptor(ExecutionContext\& ctx, const endpoint_type\& endpoint,}@ - @\addedcode{ bool reuse_addr = true);}@ - basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, + template + basic_socket_acceptor(ExecutionContext& ctx, const endpoint_type& endpoint, + bool reuse_addr = true); + basic_socket_acceptor(const executor_type& ex, const protocol_type& protocol, const native_handle_type& native_socket); - @\addedcode{template}@ - @\addedcode{ basic_socket_acceptor(ExecutionContext\& ctx, const protocol_type\& protocol,}@ - @\addedcode{ const native_handle_type\& native_socket);}@ + template + basic_socket_acceptor(ExecutionContext& ctx, const protocol_type& protocol, + const native_handle_type& native_socket); basic_socket_acceptor(const basic_socket_acceptor&) = delete; basic_socket_acceptor(basic_socket_acceptor&& rhs); - template - basic_socket_acceptor(basic_socket_acceptor&& rhs); + template + basic_socket_acceptor(basic_socket_acceptor&& rhs); ~basic_socket_acceptor(); basic_socket_acceptor& operator=(const basic_socket_acceptor&) = delete; basic_socket_acceptor& operator=(basic_socket_acceptor&& rhs); - template - basic_socket_acceptor& operator=(basic_socket_acceptor&& rhs); + template + basic_socket_acceptor& operator=(basic_socket_acceptor&& rhs); // \ref{socket.acceptor.ops}, basic_socket_acceptor operations @@ -3701,60 +3701,50 @@ socket_type accept(); socket_type accept(error_code& ec); - @\removedcode{socket_type accept(io_context\& ctx);}@ - @\removedcode{socket_type accept(io_context\& ctx, error_code\& ec);}@ - @\addedcode{template}@ - @\addedcode{ socket_type_for}@ - @\addedcode{ accept(const OtherExecutor\& ex);}@ - @\addedcode{template}@ - @\addedcode{ socket_type_for}@ - @\addedcode{ accept(const OtherExecutor\& ex, error_code\& ec);}@ - @\addedcode{template}@ - @\addedcode{ socket_type_for}@ - @\addedcode{ accept(ExecutionContext\& ctx);}@ - @\addedcode{template}@ - @\addedcode{ socket_type_for}@ - @\addedcode{ accept(ExecutionContext\& ctx, error_code\& ec);}@ + template + socket_type_for + accept(const OtherExecutor& ex); + template + socket_type_for + accept(const OtherExecutor& ex, error_code& ec); + template + socket_type_for + accept(ExecutionContext& ctx); + template + socket_type_for + accept(ExecutionContext& ctx, error_code& ec); template @\DEDUCED@ async_accept(CompletionToken&& token); - @\removedcode{template}@ - @\removedcode{ \DEDUCED\ async_accept(io_context\& ctx, CompletionToken\&\& token);}@ - @\addedcode{template}@ - @\addedcode{ \DEDUCED\ async_accept(const OtherExecutor\& ex, CompletionToken\&\& token);}@ - @\addedcode{template}@ - @\addedcode{ \DEDUCED\ async_accept(ExecutionContext\& ctx, CompletionToken\&\& token);}@ + template + \DEDUCED\ async_accept(const OtherExecutor& ex, CompletionToken&& token); + template + \DEDUCED\ async_accept(ExecutionContext& ctx, CompletionToken&& token); socket_type accept(endpoint_type& endpoint); socket_type accept(endpoint_type& endpoint, error_code& ec); - @\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint);}@ - @\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint,}@ - @\removedcode{ error_code\& ec);}@ - @\addedcode{template}@ - @\addedcode{ socket_type_for}@ - @\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint);}@ - @\addedcode{template}@ - @\addedcode{ socket_type_for}@ - @\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint, error_code\& ec);}@ - @\addedcode{template}@ - @\addedcode{ socket_type_for}@ - @\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint);}@ - @\addedcode{template}@ - @\addedcode{ socket_type_for}@ - @\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint, error_code\& ec);}@ + template + socket_type_for + accept(const OtherExecutor& ex, endpoint_type& endpoint); + template + socket_type_for + accept(const OtherExecutor& ex, endpoint_type& endpoint, error_code& ec); + template + socket_type_for + accept(ExecutionContext& ctx, endpoint_type& endpoint); + template + socket_type_for + accept(ExecutionContext& ctx, endpoint_type& endpoint, error_code& ec); template @\DEDUCED@ async_accept(endpoint_type& endpoint, CompletionToken&& token); - @\removedcode{template}@ - @\removedcode{ \DEDUCED\ async_accept(io_context\& ctx, endpoint_type\& endpoint,}@ - @\removedcode{ CompletionToken\&\& token);}@ - @\addedcode{template}@ - @\addedcode{ \DEDUCED\ async_accept(const OtherExecutor\& ex, endpoint_type\& endpoint,}@ - @\addedcode{ CompletionToken\&\& token);}@ - @\addedcode{template}@ - @\addedcode{ \DEDUCED\ async_accept(ExecutionContext\& ctx, endpoint_type\& endpoint,}@ - @\addedcode{ CompletionToken\&\& token);}@ + template + \DEDUCED\ async_accept(const OtherExecutor& ex, endpoint_type& endpoint, + CompletionToken&& token); + template + \DEDUCED\ async_accept(ExecutionContext& ctx, endpoint_type& endpoint, + CompletionToken&& token); void wait(wait_type w); void wait(wait_type w, error_code& ec); @@ -3782,7 +3772,7 @@ \rSec2[socket.acceptor.cons]{\tcode{basic_socket_acceptor} constructors} \begin{itemdecl} -explicit basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); +explicit basic_socket_acceptor(const executor_type& ex); \end{itemdecl} \begin{itemdescr} @@ -3790,29 +3780,29 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\tcode{get_executor() == ex}. \item \tcode{is_open() == false}. \end{itemize} \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_socket_acceptor(ExecutionContext\& ctx);}@ +template + explicit basic_socket_acceptor(ExecutionContext& ctx); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor())}.} +\pnum +\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor())}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol); +basic_socket_acceptor(const executor_type& ex, const protocol_type& protocol); \end{itemdecl} \begin{itemdescr} @@ -3823,7 +3813,7 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\tcode{get_executor() == ex}. \item \tcode{is_open() == true}. \item @@ -3836,22 +3826,22 @@ \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_socket_acceptor(ExecutionContext\& ctx, const protocol_type\& protocol);}@ +template + explicit basic_socket_acceptor(ExecutionContext& ctx, const protocol_type& protocol); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), protocol)}.} +\pnum +\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), protocol)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const endpoint_type& endpoint, +basic_socket_acceptor(const executor_type& ex, const endpoint_type& endpoint, bool reuse_addr = true); \end{itemdecl} @@ -3871,7 +3861,7 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\tcode{get_executor() == ex}. \item \tcode{is_open() == true}. \item @@ -3884,23 +3874,23 @@ \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_socket_acceptor(ExecutionContext\& ctx, const endpoint_type\& endpoint,}@ -@\addedcode{ bool reuse_addr = true);}@ +template + explicit basic_socket_acceptor(ExecutionContext& ctx, const endpoint_type& endpoint, + bool reuse_addr = true); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), endpoint, reuse_addr)}.} +\pnum +\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), endpoint, reuse_addr)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_socket_acceptor(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const protocol_type& protocol, +basic_socket_acceptor(const executor_type& ex, const protocol_type& protocol, const native_handle_type& native_acceptor); \end{itemdecl} @@ -3915,7 +3905,7 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\tcode{get_executor() == ex}. \item \tcode{is_open() == true}. \item @@ -3928,19 +3918,19 @@ \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ basic_socket_acceptor(ExecutionContext\& ctx, const protocol_type\& protocol,}@ -@\addedcode{ const native_handle_type\& native_socket);}@ +template + basic_socket_acceptor(ExecutionContext& ctx, const protocol_type& protocol, + const native_handle_type& native_socket); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), protocol, native_socket)}.} +\pnum +\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), protocol, native_socket)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} @@ -3949,7 +3939,7 @@ \begin{itemdescr} \pnum -\effects Move constructs an object of class \tcode{basic_socket_acceptor} that refers to the state originally represented by \tcode{rhs}. +\effects Move constructs an object of class \tcode{basic_socket_acceptor} that refers to the state originally represented by \tcode{rhs}. \pnum \postconditions @@ -3972,16 +3962,16 @@ \end{itemdescr} \begin{itemdecl} -template - basic_socket_acceptor(basic_socket_acceptor&& rhs); +template + basic_socket_acceptor(basic_socket_acceptor&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \pnum -\effects Move constructs an object of class \tcode{basic_socket_acceptor} that refers to the state originally represented by \tcode{rhs}. +\effects Move constructs an object of class \tcode{basic_socket_acceptor} that refers to the state originally represented by \tcode{rhs}. \pnum \postconditions @@ -4003,7 +3993,7 @@ \end{itemize} \pnum -\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -4055,13 +4045,13 @@ \end{itemdescr} \begin{itemdecl} -template - basic_socket_acceptor& operator=(basic_socket_acceptor&& rhs); +template + basic_socket_acceptor& operator=(basic_socket_acceptor&& rhs); \end{itemdecl} \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \pnum \effects If \tcode{is_open()} is \tcode{true}, cancels all outstanding asynchronous operations associated with this acceptor, and releases acceptor resources as if by POSIX \tcode{close(native_handle())}. Then moves into \tcode{*this} the state originally represented by \tcode{rhs}. Completion handlers for canceled operations are passed an error code \tcode{ec} such that \tcode{ec == errc::operation_canceled} yields \tcode{true}. @@ -4089,7 +4079,7 @@ \returns \tcode{*this}. \pnum -\remarks This assignment operator shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol}\added{ and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}}. +\remarks This assignment operator shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -4457,18 +4447,16 @@ \begin{itemdescr} \pnum -\returns \tcode{accept(get_executor()\removed{.context()}, ec)}. +\returns \tcode{accept(get_executor(), ec)}. \end{itemdescr} \begin{itemdecl} -@\removedcode{socket_type accept(io_context\& ctx);}@ -@\removedcode{socket_type accept(io_context\& ctx, error_code\& ec);}@ -@\addedcode{template}@ -@\addedcode{ socket_type_for}@ -@\addedcode{ accept(const OtherExecutor\& ex);}@ -@\addedcode{template}@ -@\addedcode{ socket_type_for}@ -@\addedcode{ accept(const OtherExecutor\& ex, error_code\& ec);}@ +template + socket_type_for + accept(const OtherExecutor& ex); +template + socket_type_for + accept(const OtherExecutor& ex, error_code& ec); \end{itemdecl} \begin{itemdescr} @@ -4480,21 +4468,21 @@ \pnum -\returns On success, \tcode{socket_type\added{_for}(\removed{ctx}\added{ex}, protocol_, h)}. Otherwise \tcode{socket_type\added{_for}(\removed{ctx}\added{ex})}. +\returns On success, \tcode{socket_type_for(ex, protocol_, h)}. Otherwise \tcode{socket_type_for(ex)}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ socket_type_for}@ -@\addedcode{ accept(ExecutionContext\& ctx);}@ -@\addedcode{template}@ -@\addedcode{ socket_type_for}@ -@\addedcode{ accept(ExecutionContext\& ctx, error_code\& ec);}@ +template + socket_type_for + accept(ExecutionContext& ctx); +template + socket_type_for + accept(ExecutionContext& ctx, error_code& ec); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\returns \tcode{accept(ctx.get_executor(), ec)}.} +\pnum +\returns \tcode{accept(ctx.get_executor(), ec)}. \end{itemdescr} \begin{itemdecl} @@ -4506,43 +4494,40 @@ \pnum \returns \begin{codeblock} -async_accept(get_executor()@\removedcode{.context()}@, forward(token)) +async_accept(get_executor(), forward(token)) \end{codeblock} \end{itemdescr} \begin{itemdecl} -@\removedcode{template}@ -@\removedcode{ \DEDUCED\ async_accept(io_context\& ctx, CompletionToken\&\& token);}@ -@\addedcode{template}@ -@\addedcode{ \DEDUCED\ async_accept(const OtherExecutor\& ex, CompletionToken\&\& token);}@ +template + \DEDUCED\ async_accept(const OtherExecutor& ex, CompletionToken&& token); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{Let \tcode{S} be the type \tcode{socket_type_for}.} +\pnum +Let \tcode{S} be the type \tcode{socket_type_for}. \pnum -\completionsig \tcode{void(error_code ec, \removed{socket_type}\added{S} s)}. +\completionsig \tcode{void(error_code ec, S s)}. \pnum \effects Initiates an asynchronous operation to extract a socket from the queue of pending connections of the acceptor, as if by POSIX: \begin{codeblock} native_handle_type h = accept(native_handle(), nullptr, 0); \end{codeblock} -\removed{On success, \tcode{s} is \tcode{socket_type(ctx, protocol_, h)}. Otherwise, \tcode{s} is \tcode{socket_type(ctx)}.} -\added{On success, \tcode{s} is \tcode{S(ex, protocol_, h)}. Otherwise, \tcode{s} is \tcode{S(ex)}.} +On success, \tcode{s} is \tcode{S(ex, protocol_, h)}. Otherwise, \tcode{s} is \tcode{S(ex)}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ \DEDUCED\ async_accept(ExecutionContext\& ctx, CompletionToken\&\& token);}@ +template + \DEDUCED\ async_accept(ExecutionContext& ctx, CompletionToken&& token); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\returns} +\pnum +\returns \begin{codeblock} -@\addedcode{async_accept(ctx.get_executor(), forward(token))}@ +async_accept(ctx.get_executor(), forward(token)) \end{codeblock} \end{itemdescr} @@ -4553,19 +4538,16 @@ \begin{itemdescr} \pnum -\returns \tcode{accept(get_executor()\removed{.context()}, endpoint, ec)}. +\returns \tcode{accept(get_executor(), endpoint, ec)}. \end{itemdescr} \begin{itemdecl} -@\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint);}@ -@\removedcode{socket_type accept(io_context\& ctx, endpoint_type\& endpoint,}@ -@\removedcode{ error_code\& ec);}@ -@\addedcode{template}@ -@\addedcode{ socket_type_for}@ -@\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint);}@ -@\addedcode{template}@ -@\addedcode{ socket_type_for}@ -@\addedcode{ accept(const OtherExecutor\& ex, endpoint_type\& endpoint, error_code\& ec);}@ +template + socket_type_for + accept(const OtherExecutor& ex, endpoint_type& endpoint); +template + socket_type_for + accept(const OtherExecutor& ex, endpoint_type& endpoint, error_code& ec); \end{itemdecl} \begin{itemdescr} @@ -4582,21 +4564,21 @@ \pnum -\returns On success, \tcode{socket_type(\removed{ctx}\added{ex}, protocol_, h)}. Otherwise \tcode{socket_type(\removed{ctx}\added{ex})}. +\returns On success, \tcode{socket_type(ex, protocol_, h)}. Otherwise \tcode{socket_type(ex)}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ socket_type_for}@ -@\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint);}@ -@\addedcode{template}@ -@\addedcode{ socket_type_for}@ -@\addedcode{ accept(ExecutionContext\& ctx, endpoint_type\& endpoint, error_code\& ec);}@ +template + socket_type_for + accept(ExecutionContext& ctx, endpoint_type& endpoint); +template + socket_type_for + accept(ExecutionContext& ctx, endpoint_type& endpoint, error_code& ec); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\returns \tcode{accept(ctx.get_executor(), endpoint, ec)}.} +\pnum +\returns \tcode{accept(ctx.get_executor(), endpoint, ec)}. \end{itemdescr} \begin{itemdecl} @@ -4609,25 +4591,22 @@ \pnum \returns \begin{codeblock} -async_accept(get_executor()@\removedcode{.context()}@, endpoint, forward(token)) +async_accept(get_executor(), endpoint, forward(token)) \end{codeblock} \end{itemdescr} \begin{itemdecl} -@\removedcode{template}@ -@\removedcode{ \DEDUCED\ async_accept(io_context\& ctx, endpoint_type\& endpoint,}@ -@\removedcode{ CompletionToken\&\& token);}@ -@\addedcode{template}@ -@\addedcode{ \DEDUCED\ async_accept(const OtherExecutor\& ex, endpoint_type\& endpoint,}@ -@\addedcode{ CompletionToken\&\& token);}@ +template + \DEDUCED\ async_accept(const OtherExecutor& ex, endpoint_type& endpoint, + CompletionToken&& token); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{Let \tcode{S} be the type \tcode{socket_type_for}.} +\pnum +Let \tcode{S} be the type \tcode{socket_type_for}. \pnum -\completionsig \tcode{void(error_code ec, \removed{socket_type}\added{S} s)}. +\completionsig \tcode{void(error_code ec, S s)}. \pnum \effects Initiates an asynchronous operation to extract a socket from the queue of pending connections of the acceptor, as if by POSIX: @@ -4639,21 +4618,20 @@ if (h >= 0) endpoint.resize(endpoint_len); \end{codeblock} -\removed{On success, \tcode{s} is \tcode{socket_type(ctx, protocol_, h)}. Otherwise, \tcode{s} is \tcode{socket_type(ctx)}.} -\added{On success, \tcode{s} is \tcode{S(ex, protocol_, h)}. Otherwise, \tcode{s} is \tcode{S(ex)}.} +On success, \tcode{s} is \tcode{S(ex, protocol_, h)}. Otherwise, \tcode{s} is \tcode{S(ex)}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ \DEDUCED\ async_accept(ExecutionContext\& ctx, endpoint_type\& endpoint,}@ -@\addedcode{ CompletionToken\&\& token);}@ +template + \DEDUCED\ async_accept(ExecutionContext& ctx, endpoint_type& endpoint, + CompletionToken&& token); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\returns} +\pnum +\returns \begin{codeblock} -@\addedcode{async_accept(ctx.get_executor(), forward(token))}@ +async_accept(ctx.get_executor(), forward(token)) \end{codeblock} \end{itemdescr} diff --git a/src/socketstreams.tex b/src/socketstreams.tex index 74ce3c4..de3742e 100644 --- a/src/socketstreams.tex +++ b/src/socketstreams.tex @@ -14,13 +14,13 @@ \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template + template class basic_socket_streambuf : public basic_streambuf { public: // types: - @\addedcode{using executor_type = Executor;}@ + using executor_type = Executor; using protocol_type = Protocol; using endpoint_type = typename protocol_type::endpoint; using clock_type = Clock; @@ -31,7 +31,7 @@ // \ref{socket.streambuf.cons}, construct / copy / destroy basic_socket_streambuf(); - explicit basic_socket_streambuf(basic_stream_socket s); + explicit basic_socket_streambuf(basic_stream_socket s); basic_socket_streambuf(const basic_socket_streambuf&) = delete; basic_socket_streambuf(basic_socket_streambuf&& rhs); @@ -47,7 +47,7 @@ basic_socket_streambuf* close(); - basic_socket& socket(); + basic_socket& socket(); error_code error() const; time_point expiry() const; @@ -63,7 +63,7 @@ virtual streambuf* setbuf(char_type* s, streamsize n) override; private: - basic_stream_socket socket_; // \expos + basic_stream_socket socket_; // \expos error_code ec_; // \expos time_point expiry_; // \expos }; @@ -88,13 +88,13 @@ \pnum \postconditions \tcode{expiry() == time_point::max()} and \tcode{!error()}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless -\tcode{is_constructible::value} is \tcode{true}.} +\pnum +\remarks This function shall not participate in overload resolution unless +\tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -explicit basic_socket_streambuf(basic_stream_socket s); +explicit basic_socket_streambuf(basic_stream_socket s); \end{itemdecl} \begin{itemdescr} @@ -157,7 +157,7 @@ \begin{itemdescr} \pnum -\effects If a put area exists, calls \tcode{overflow(traits_type::eof())} to flush characters. \begin{note} The socket is closed by the \tcode{basic_stream_socket} destructor. \end{note} +\effects If a put area exists, calls \tcode{overflow(traits_type::eof())} to flush characters. \begin{note} The socket is closed by the \tcode{basic_stream_socket} destructor. \end{note} \end{itemdescr} \begin{itemdecl} @@ -215,7 +215,7 @@ \begin{itemdescr} \pnum -\effects If a put area exists, calls \tcode{overflow(traits_type::eof())} to flush characters. Regardless of whether the preceding call fails or throws an exception, the function closes the socket as if by \tcode{basic_socket::close(ec_)}. If any of the calls made by the function fail, \tcode{close} fails by returning a null pointer. If one of these calls throws an exception, the exception is caught and rethrown after closing the socket. +\effects If a put area exists, calls \tcode{overflow(traits_type::eof())} to flush characters. Regardless of whether the preceding call fails or throws an exception, the function closes the socket as if by \tcode{basic_socket::close(ec_)}. If any of the calls made by the function fail, \tcode{close} fails by returning a null pointer. If one of these calls throws an exception, the exception is caught and rethrown after closing the socket. \pnum \returns \tcode{this} on success, a null pointer otherwise. @@ -225,7 +225,7 @@ \end{itemdescr} \begin{itemdecl} -basic_socket& socket(); +basic_socket& socket(); \end{itemdecl} \begin{itemdescr} @@ -362,13 +362,13 @@ \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template + template class basic_socket_iostream : public basic_iostream { public: // types: - @\addedcode{using executor_type = Executor;}@ + using executor_type = Executor; using protocol_type = Protocol; using endpoint_type = typename protocol_type::endpoint; using clock_type = Clock; @@ -379,7 +379,7 @@ // \ref{socket.iostream.cons}, construct / copy / destroy basic_socket_iostream(); - explicit basic_socket_iostream(basic_stream_socket s); + explicit basic_socket_iostream(basic_stream_socket s); basic_socket_iostream(const basic_socket_iostream&) = delete; basic_socket_iostream(basic_socket_iostream&& rhs); template @@ -394,9 +394,9 @@ void close(); - basic_socket_streambuf* rdbuf() const; + basic_socket_streambuf* rdbuf() const; - basic_socket& socket(); + basic_socket& socket(); error_code error() const; time_point expiry() const; @@ -404,7 +404,7 @@ void expires_after(const duration& d); private: - basic_socket_streambuf sb_; // \expos + basic_socket_streambuf sb_; // \expos }; } // inline namespace std::experimental::net::\namespacever @@ -424,13 +424,13 @@ \pnum \effects Initializes the base class as \tcode{basic_iostream(addressof(sb_))}, value-initializes \tcode{sb_}, and performs \tcode{setf(std::ios_base::unitbuf)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless -\tcode{is_default_constructible>::value} is \tcode{true}.} +\pnum +\remarks This function shall not participate in overload resolution unless +\tcode{is_default_constructible>::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -explicit basic_socket_iostream(basic_stream_socket s); +explicit basic_socket_iostream(basic_stream_socket s); \end{itemdecl} \begin{itemdescr} @@ -497,19 +497,19 @@ \end{itemdescr} \begin{itemdecl} -basic_socket_streambuf* rdbuf() const; +basic_socket_streambuf* rdbuf() const; \end{itemdecl} \begin{itemdescr} \pnum -Let \tcode{SB} be the type \tcode{basic_socket_streambuf}. +Let \tcode{SB} be the type \tcode{basic_socket_streambuf}. \pnum \returns \tcode{const_cast(addressof(sb_))}. \end{itemdescr} \begin{itemdecl} -basic_socket& socket(); +basic_socket& socket(); \end{itemdecl} \begin{itemdescr} diff --git a/src/timers.tex b/src/timers.tex index d2df811..ad4e246 100644 --- a/src/timers.tex +++ b/src/timers.tex @@ -39,7 +39,7 @@ template struct wait_traits; - template@\addedcode{, class Executor = executor}@> + template, class Executor = executor> class basic_waitable_timer; using system_timer = basic_waitable_timer; @@ -155,33 +155,33 @@ \begin{codeblock} namespace std::experimental::net::inline @\namespacever@ { - template@\addedcode{, class Executor = executor}@> + template, class Executor = executor> class basic_waitable_timer { public: // types: - using executor_type = @\removedcode{io_context::executor_type}\addedcode{Executor}@; + using executor_type = Executor; using clock_type = Clock; using duration = typename clock_type::duration; using time_point = typename clock_type::time_point; using traits_type = WaitTraits; - @\addedcode{template}@ - @\addedcode{using rebind_executor =}@ - @\addedcode{ basic_waitable_timer;}@ + template + using rebind_executor = + basic_waitable_timer; // \ref{timer.waitable.cons}, construct / copy / destroy - explicit basic_waitable_timer(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); - @\addedcode{template}@ - @\addedcode{ explicit basic_waitable_timer(ExecutionContext\& ctx);}@ - basic_waitable_timer(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const time_point& t); - @\addedcode{template}@ - @\addedcode{ basic_waitable_timer(ExecutionContext\& ctx, const time_point\& t);}@ - basic_waitable_timer(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const duration& d); - @\addedcode{template}@ - @\addedcode{ basic_waitable_timer(ExecutionContext\& ctx, const duration\& d);}@ + explicit basic_waitable_timer(const executor_type& ex); + template + explicit basic_waitable_timer(ExecutionContext& ctx); + basic_waitable_timer(const executor_type& ex, const time_point& t); + template + basic_waitable_timer(ExecutionContext& ctx, const time_point& t); + basic_waitable_timer(const executor_type& ex, const duration& d); + template + basic_waitable_timer(ExecutionContext& ctx, const duration& d); basic_waitable_timer(const basic_waitable_timer&) = delete; basic_waitable_timer(basic_waitable_timer&& rhs); @@ -219,31 +219,31 @@ \indexlibrary{\idxcode{basic_waitable_timer}!constructor}% \begin{itemdecl} -explicit basic_waitable_timer(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@); +explicit basic_waitable_timer(const executor_type& ex); \end{itemdecl} \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_waitable_timer(\removed{ctx}\added{ex}, time_point())}. +\effects Equivalent to \tcode{basic_waitable_timer(ex, time_point())}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ explicit basic_waitable_timer(ExecutionContext\& ctx);}@ +template + explicit basic_waitable_timer(ExecutionContext& ctx); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor())}.} +\pnum +\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor())}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_waitable_timer(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const time_point& t); +basic_waitable_timer(const executor_type& ex, const time_point& t); \end{itemdecl} \begin{itemdescr} @@ -251,29 +251,29 @@ \postconditions \begin{itemize} \item -\tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\tcode{get_executor() == ex}. \item \tcode{expiry() == t}. \end{itemize} \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ basic_waitable_timer(ExecutionContext\& ctx, const time_point\& t);}@ +template + basic_waitable_timer(ExecutionContext& ctx, const time_point& t); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor(), t)}.} +\pnum +\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor(), t)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} -basic_waitable_timer(@\removedcode{io_context\& ctx}\addedcode{const executor_type\& ex}@, const duration& d); +basic_waitable_timer(const executor_type& ex, const duration& d); \end{itemdecl} \begin{itemdescr} @@ -281,22 +281,22 @@ \effects Sets the expiry time as if by calling \tcode{expires_after(d)}. \pnum -\postconditions \tcode{get_executor() == \removed{ctx.get_executor()}\added{ex}}. +\postconditions \tcode{get_executor() == ex}. \end{itemdescr} \begin{itemdecl} -@\addedcode{template}@ -@\addedcode{ basic_waitable_timer(ExecutionContext\& ctx, const duration\& d);}@ +template + basic_waitable_timer(ExecutionContext& ctx, const duration& d); \end{itemdecl} \begin{itemdescr} -\addedpnum -\added{\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor(), d)}.} +\pnum +\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor(), d)}. -\addedpnum -\added{\remarks This function shall not participate in overload resolution unless +\pnum +\remarks This function shall not participate in overload resolution unless \tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}.} +and \tcode{is_constructible::value} is \tcode{true}. \end{itemdescr} \begin{itemdecl} From 8e0a4d26d56dcced8486921de7ae7dd4deee6675 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Sat, 18 Sep 2021 12:00:09 +1000 Subject: [PATCH 23/23] Use constraints. --- src/internetprotocol.tex | 8 +- src/sockets.tex | 165 +++++++++++++++++---------------------- src/socketstreams.tex | 14 ++-- src/timers.tex | 24 +++--- 4 files changed, 95 insertions(+), 116 deletions(-) diff --git a/src/internetprotocol.tex b/src/internetprotocol.tex index 61b15d4..5615186 100644 --- a/src/internetprotocol.tex +++ b/src/internetprotocol.tex @@ -3165,12 +3165,12 @@ \begin{itemdescr} \pnum -\postconditions \tcode{get_executor() == ctx.get_executor()}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\postconditions \tcode{get_executor() == ctx.get_executor()}. \end{itemdescr} \begin{itemdecl} diff --git a/src/sockets.tex b/src/sockets.tex index 76b3efc..5315172 100644 --- a/src/sockets.tex +++ b/src/sockets.tex @@ -1568,12 +1568,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_socket(ctx.get_executor())}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_socket(ctx.get_executor())}. \end{itemdescr} \begin{itemdecl} @@ -1605,12 +1605,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), protocol)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), protocol)}. \end{itemdescr} \begin{itemdecl} @@ -1647,12 +1647,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), endpoint)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), endpoint)}. \end{itemdescr} \begin{itemdecl} @@ -1689,12 +1689,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), protocol, native_socket)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_socket(ctx.get_executor(), protocol, native_socket)}. \end{itemdescr} \begin{itemdecl} @@ -1730,7 +1730,7 @@ \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. +\constraints \tcode{is_convertible_v} is \tcode{true} and \tcode{is_convertible_v} is \tcode{true}. \pnum \effects Move constructs an object of class \tcode{basic_socket} that refers to the state originally represented by \tcode{rhs}. @@ -1751,9 +1751,6 @@ \item \tcode{rhs.is_open() == false}. \end{itemize} - -\pnum -\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -1807,7 +1804,7 @@ \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. +\constraints \tcode{is_convertible_v} is \tcode{true} and \tcode{is_convertible_v} is \tcode{true}. \pnum \effects If \tcode{is_open()} is \tcode{true}, cancels all outstanding asynchronous operations associated with this socket. Completion handlers for canceled operations are passed an error code \tcode{ec} such that \tcode{ec == errc::operation_canceled} yields \tcode{true}. Disables the linger socket option to prevent the assignment from blocking, and releases socket resources as if by POSIX \tcode{close(native_handle())}. Moves into \tcode{*this} the state originally represented by \tcode{rhs}. @@ -1829,9 +1826,6 @@ \pnum \returns \tcode{*this}. - -\pnum -\remarks This assignment operator shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -2477,12 +2471,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor())}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor())}. \end{itemdescr} \begin{itemdecl} @@ -2501,12 +2495,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), protocol)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), protocol)}. \end{itemdescr} \begin{itemdecl} @@ -2525,12 +2519,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), endpoint)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), endpoint)}. \end{itemdescr} \begin{itemdecl} @@ -2551,12 +2545,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), protocol, native_socket)}. - +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. + +\effects Equivalent to \tcode{basic_datagram_socket(ctx.get_executor(), protocol, native_socket)}. \end{itemdescr} \begin{itemdecl} @@ -2575,13 +2569,10 @@ \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. +\constraints \tcode{is_convertible_v} is \tcode{true} and \tcode{is_convertible_v} is \tcode{true}. \pnum \effects Move constructs an object of class \tcode{basic_datagram_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. - -\pnum -\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -3185,12 +3176,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor())}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor())}. \end{itemdescr} \begin{itemdecl} @@ -3209,12 +3200,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), protocol)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), protocol)}. \end{itemdescr} \begin{itemdecl} @@ -3233,12 +3224,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), endpoint)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), endpoint)}. \end{itemdescr} \begin{itemdecl} @@ -3259,12 +3250,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), protocol, native_socket)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_stream_socket(ctx.get_executor(), protocol, native_socket)}. \end{itemdescr} \begin{itemdecl} @@ -3283,13 +3274,10 @@ \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. +\constraints \tcode{is_convertible_v} is \tcode{true} and \tcode{is_convertible_v} is \tcode{true}. \pnum \effects Move constructs an object of class \tcode{basic_stream_socket}, initializing the base class with \tcode{basic_socket(std::move(rhs))}. - -\pnum -\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -3315,16 +3303,13 @@ \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. +\constraints \tcode{is_convertible_v} is \tcode{true} and \tcode{is_convertible_v} is \tcode{true}. \pnum \effects Equivalent to \tcode{basic_socket::operator=(std::move(rhs))}. \pnum \returns \tcode{*this}. - -\pnum -\remarks This assignment operator shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -3793,12 +3778,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor())}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor())}. \end{itemdescr} \begin{itemdecl} @@ -3832,12 +3817,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), protocol)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), protocol)}. \end{itemdescr} \begin{itemdecl} @@ -3881,12 +3866,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), endpoint, reuse_addr)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), endpoint, reuse_addr)}. \end{itemdescr} \begin{itemdecl} @@ -3925,12 +3910,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), protocol, native_socket)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_socket_acceptor(ctx.get_executor(), protocol, native_socket)}. \end{itemdescr} \begin{itemdecl} @@ -3968,7 +3953,7 @@ \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. +\constraints \tcode{is_convertible_v} is \tcode{true} and \tcode{is_convertible_v} is \tcode{true}. \pnum \effects Move constructs an object of class \tcode{basic_socket_acceptor} that refers to the state originally represented by \tcode{rhs}. @@ -3991,9 +3976,6 @@ \item \tcode{rhs.is_open() == false}. \end{itemize} - -\pnum -\remarks This constructor shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} @@ -4051,7 +4033,7 @@ \begin{itemdescr} \pnum -\requires \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. +\constraints \tcode{is_convertible_v} is \tcode{true} and \tcode{is_convertible_v} is \tcode{true}. \pnum \effects If \tcode{is_open()} is \tcode{true}, cancels all outstanding asynchronous operations associated with this acceptor, and releases acceptor resources as if by POSIX \tcode{close(native_handle())}. Then moves into \tcode{*this} the state originally represented by \tcode{rhs}. Completion handlers for canceled operations are passed an error code \tcode{ec} such that \tcode{ec == errc::operation_canceled} yields \tcode{true}. @@ -4077,9 +4059,6 @@ \pnum \returns \tcode{*this}. - -\pnum -\remarks This assignment operator shall not participate in overload resolution unless \tcode{OtherProtocol} is implicitly convertible to \tcode{Protocol} and \tcode{OtherExecutor} is implicitly convertible to \tcode{Executor}. \end{itemdescr} diff --git a/src/socketstreams.tex b/src/socketstreams.tex index de3742e..a3c34f4 100644 --- a/src/socketstreams.tex +++ b/src/socketstreams.tex @@ -83,14 +83,14 @@ \begin{itemdescr} \pnum -\effects Initializes \tcode{socket_} with \tcode{ctx}, where \tcode{ctx} is an unspecified object of class \tcode{io_context}. +\constraints +\tcode{is_constructible_v} is \tcode{true}. \pnum -\postconditions \tcode{expiry() == time_point::max()} and \tcode{!error()}. +\effects Initializes \tcode{socket_} with \tcode{ctx}, where \tcode{ctx} is an unspecified object of class \tcode{io_context}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_constructible::value} is \tcode{true}. +\postconditions \tcode{expiry() == time_point::max()} and \tcode{!error()}. \end{itemdescr} \begin{itemdecl} @@ -422,11 +422,11 @@ \begin{itemdescr} \pnum -\effects Initializes the base class as \tcode{basic_iostream(addressof(sb_))}, value-initializes \tcode{sb_}, and performs \tcode{setf(std::ios_base::unitbuf)}. +\constraints +\tcode{is_default_constructible_v>} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_default_constructible>::value} is \tcode{true}. +\effects Initializes the base class as \tcode{basic_iostream(addressof(sb_))}, value-initializes \tcode{sb_}, and performs \tcode{setf(std::ios_base::unitbuf)}. \end{itemdescr} \begin{itemdecl} diff --git a/src/timers.tex b/src/timers.tex index ad4e246..d3087b4 100644 --- a/src/timers.tex +++ b/src/timers.tex @@ -234,12 +234,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor())}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor())}. \end{itemdescr} \begin{itemdecl} @@ -264,12 +264,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor(), t)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor(), t)}. \end{itemdescr} \begin{itemdecl} @@ -291,12 +291,12 @@ \begin{itemdescr} \pnum -\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor(), d)}. +\constraints +\tcode{is_convertible_v} is \tcode{true} +and \tcode{is_constructible_v} is \tcode{true}. \pnum -\remarks This function shall not participate in overload resolution unless -\tcode{is_convertible::value} is \tcode{true} -and \tcode{is_constructible::value} is \tcode{true}. +\effects Equivalent to \tcode{basic_waitable_timer(ctx.get_executor(), d)}. \end{itemdescr} \begin{itemdecl}