Title
[networking.ts] (async_)read and (async_)write don't support DynamicBuffer lvalues
Status
new
Section
[buffer.stream]
Submitter
Christopher Kohlhoff

Created on 2018-02-27.00:00:00, last changed 2019-01-20.16:20:00.

Messages

Date: 2019-01-20.16:20:00

Proposed resolution:

This wording is relative to N4711.

  1. Edit [buffer.read] as indicated:

    -14- Remarks: This function shall not participate in overload resolution unless is_dynamic_buffer_v<decay_t<DynamicBuffer>> is true.

  2. Edit [buffer.async.read] as indicated:

    -16- Remarks: This function shall not participate in overload resolution unless is_dynamic_buffer_v<decay_t<DynamicBuffer>> is true.

  3. Edit [buffer.write] as indicated:

    -14- Remarks: This function shall not participate in overload resolution unless is_dynamic_buffer_v<decay_t<DynamicBuffer>> is true.

  4. Edit [buffer.async.write] as indicated:

    -16- Remarks: This function shall not participate in overload resolution unless is_dynamic_buffer_v<decay_t<DynamicBuffer>> is true.

Date: 2019-01-20.00:00:00

[ 2019-01-20 Reflector prioritization ]

Set Priority to 3

Date: 2018-02-27.00:00:00
Addresses: networking.ts

Suppose that we have a user-defined class dyn_buf that satisfies the DynamicBuffer requirements ([buffer.reqmts.dynamicbuffer]), and is additionally copy-constructible. The following snippet compiles, as expected:

dyn_buf b;
net::read_until(my_socket, b, "\n");

However, this next snippet will not compile, when it should:

dyn_buf b;
net::read(my_socket, b);

This is due to:

  • the DynamicBuffer template parameter being deduced as dyn_buf&, and
  • the read overload being specified to not participate in overload resolution unless is_dynamic_buffer_v<DynamicBuffer> is true.

This can fixed by changing the test to is_dynamic_buffer_v<decay_t<DynamicBuffer>>.

History
Date User Action Args
2019-01-20 16:20:00adminsetmessages: + msg10287
2018-03-04 11:37:14adminsetmessages: + msg9705
2018-02-27 00:00:00admincreate