This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD Editorial status.

393. do_in/do_out operation on state unclear

Section: 30.4.2.5.3 [locale.codecvt.virtuals] Status: NAD Editorial Submitter: Alberto Barbati Opened: 2002-12-24 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [locale.codecvt.virtuals].

View all issues with NAD Editorial status.

Discussion:

this DR follows the discussion on the previous thread "codecvt::do_in not consuming external characters". It's just a clarification issue and not a request for a change.

Can do_in()/do_out() produce output characters without consuming input characters as a result of operation on state?

Proposed resolution:

Add a note at the end of 30.4.2.5.3 [locale.codecvt.virtuals], paragraph 3:

[Note: As a result of operations on state, it can return ok or partial and set from_next == from and to_next != to. --end note]

Rationale:

The submitter believes that standard already provides an affirmative answer to the question. However, the current wording has induced a few library implementors to make the incorrect assumption that do_in()/do_out() always consume at least one internal character when they succeed.

The submitter also believes that the proposed resolution is not in conflict with the related issue 76. Moreover, by explicitly allowing operations on state to produce characters, a codecvt implementation may effectively implement N-to-M translations without violating the "one character at a time" principle described in such issue. On a side note, the footnote in the proposed resolution of issue 76 that informally rules out N-to-M translations for basic_filebuf should be removed if this issue is accepted as valid.

[ Kona (2007): The proposed resolution is to add a note. Since this is non-normative, the issue is editorial, but we believe that the note is correct. Proposed Disposition: NAD, Editorial ]