wstring_convert
and wbuffer_convert
validitySection: 99 [depr.conversions.string], 99 [depr.conversions.buffer] Status: C++14 Submitter: Jonathan Wakely Opened: 2012-08-02 Last modified: 2017-09-07
Priority: Not Prioritized
View other active issues in [depr.conversions.string].
View all other issues in [depr.conversions.string].
View all issues with C++14 status.
Discussion:
See discussion following c++std-lib-32710.
It's not specified what happens ifwstring_convert
and wbuffer_convert
objects are constructed
with null Codecvt
pointers.
Should the constructors have preconditions that the pointers are not null? If not, are conversions expected to
fail, or is it undefined to attempt conversions if the pointers are null?
There are no observer functions to check whether objects were constructed with valid Codecvt
pointers.
If the types are made movable such observers would be necessary even if the constructors require non-null
pointers (see also LWG 2176).
[2013-03-15 Issues Teleconference]
Moved to Tentatively Ready.
[2013-04-20 Bristol]
Proposed resolution:
This wording is relative to N3376.
Insert a new paragraph before [conversions.string] paragraph 16:
wstring_convert(Codecvt *pcvt = new Codecvt); wstring_convert(Codecvt *pcvt, state_type state); wstring_convert(const byte_string& byte_err, const wide_string& wide_err = wide_string());-?- Requires: For the first and second constructors
-16- Effects: The first constructor shall storepcvt != nullptr
.pcvt
incvtptr
and default values incvtstate
,byte_err_string
, andwide_err_string
. The second constructor shall storepcvt
incvtptr
,state
incvtstate
, and default values inbyte_err_string
andwide_err_string
; moreover the stored state shall be retained between calls tofrom_bytes
andto_bytes
. The third constructor shall storenew Codecvt
incvtptr
,state_type()
in cvtstate,byte_err
inbyte_err_string
, andwide_err
inwide_err_string
.
Insert a new paragraph before [conversions.buffer] paragraph 10:
wbuffer_convert(std::streambuf *bytebuf = 0, Codecvt *pcvt = new Codecvt, state_type state = state_type());-?- Requires:
-10- Effects: The constructor constructs a stream buffer object, initializespcvt != nullptr
.bufptr
tobytebuf
, initializescvtptr
topcvt
, and initializescvtstate
tostate
.