This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.
net::basic_socket_iostream
should use addressof
Section: 19.2.1 [networking.ts::socket.iostream.cons] Status: C++23 Submitter: Jonathan Wakely Opened: 2020-05-14 Last modified: 2023-11-22
Priority: 0
View all other issues in [networking.ts::socket.iostream.cons].
View all issues with C++23 status.
Discussion:
Addresses: networking.ts
19.2.1 [networking.ts::socket.iostream.cons] uses &sb_
which could find something bad via ADL.
[2020-07-17; Moved to Ready in telecon]
Jens suggested we should have blanket wording saying that when the library
uses the &
operator, it means std::addressof
.
[2020-11-09 Approved In November virtual meeting. Status changed: Ready → WP.]
Proposed resolution:
This wording is relative to N4771.
Modify 19.2.1 [networking.ts::socket.iostream.cons] as indicated:
basic_socket_iostream();-1- Effects: Initializes the base class as
basic_iostream<char>(
, value-initializes&addressof(sb_))sb_
, and performssetf(std::ios_base::unitbuf)
.explicit basic_socket_iostream(basic_stream_socket<protocol_type> s);-2- Effects: Initializes the base class as
basic_iostream<char>(
, initializes&addressof(sb_))sb_
withstd::move(s)
, and performssetf(std::ios_base::unitbuf)
.basic_socket_iostream(basic_socket_iostream&& rhs);-3- Effects: Move constructs from the rvalue
rhs
. This is accomplished by move constructing the base class, and the containedbasic_socket_streambuf
. Nextbasic_iostream<char>::set_rdbuf(
is called to install the contained&addressof(sb_))basic_socket_streambuf
.template<class... Args> explicit basic_socket_iostream(Args&&... args);-4- Effects: Initializes the base class as
basic_iostream<char>(
, value-initializes&addressof(sb_))sb_
, and performssetf(std::ios_base::unitbuf)
. Then callsrdbuf()->connect(forward<Args>(args)...)
. If that function returns a null pointer, callssetstate(failbit)
.