This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
async_
)read
and (async_
)write
don't support DynamicBuffer
lvaluesSection: 17 [networking.ts::buffer.stream] Status: New Submitter: Christopher Kohlhoff Opened: 2018-02-27 Last modified: 2020-09-06
Priority: 3
View all issues with New status.
Discussion:
Addresses: networking.tsSuppose 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:
DynamicBuffer
template parameter being deduced as dyn_buf&
, andread
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>>
.
[2019-01-20 Reflector prioritization]
Set Priority to 3
Proposed resolution:
This wording is relative to N4711.
Edit 17.5 [networking.ts::buffer.read] as indicated:
-14- Remarks: This function shall not participate in overload resolution unless
is_dynamic_buffer_v<decay_t<DynamicBuffer>>
istrue
.
Edit 17.6 [networking.ts::buffer.async.read] as indicated:
-16- Remarks: This function shall not participate in overload resolution unless
is_dynamic_buffer_v<decay_t<DynamicBuffer>>
istrue
.
Edit 17.7 [networking.ts::buffer.write] as indicated:
-14- Remarks: This function shall not participate in overload resolution unless
is_dynamic_buffer_v<decay_t<DynamicBuffer>>
istrue
.
Edit 17.8 [networking.ts::buffer.async.write] as indicated:
-16- Remarks: This function shall not participate in overload resolution unless
is_dynamic_buffer_v<decay_t<DynamicBuffer>>
istrue
.