DynamicBuffer
prepare
exception specificationSection: 16.2.4 [networking.ts::buffer.reqmts.dynamicbuffer] Status: New Submitter: Vinnie Falco Opened: 2017-10-16 Last modified: 2020-09-06
Priority: 3
View other active issues in [networking.ts::buffer.reqmts.dynamicbuffer].
View all other issues in [networking.ts::buffer.reqmts.dynamicbuffer].
View all issues with New status.
Discussion:
Addresses: networking.ts
The current wording for the DynamicBuffer
prepare
member function implies that std::length_error
is the
only allowable thrown exception. This should be changed to reflect that
any exception may be thrown, with std::length_error
thrown
in particular when size() + n
exceeds max_size()
.
[2017-11-08]
Priority set to 3 after five votes on mailing list
Proposed resolution:
This wording is relative to N4588.
Change 16.2.4 [networking.ts::buffer.reqmts.dynamicbuffer], Table 14 "DynamicBuffer requirements", as indicated:
Table 14 — DynamicBuffer
requirementsexpression return type assertion/note pre/post-condition […]
x.prepare(n)
X::mutable_buffers_type
Returns a mutable buffer sequence u
representing the writable bytes, and where
buffer_size(u) == n
. The dynamic buffer
reallocates memory as required. All constant or
mutable buffer sequences previously obtained using
data()
orprepare()
are invalidated.
Throws:length_error
ifsize() + n
exceedsmax_size()
or any other exception
if the request cannot otherwise be satisfied.