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

1252. wbuffer_convert::state_type inconsistency

Section: 99 [depr.conversions.buffer] Status: C++11 Submitter: Bo Persson Opened: 2009-10-21 Last modified: 2017-04-22

Priority: Not Prioritized

View other active issues in [depr.conversions.buffer].

View all other issues in [depr.conversions.buffer].

View all issues with C++11 status.

Discussion:

The synopsis for wbuffer_convert [conversions.buffer]/2 contains

typedef typename Tr::state_type   state_type; 

making state_type a synonym for (possibly) some char_traits<x>::state_type.

However, in paragraph 9 of the same section, we have

typedef typename Codecvt::state_type state_type;

The type shall be a synonym for Codecvt::state_type.

From what I can see, it might be hard to implement wbuffer_convert if the types were not both std::mbstate_t, but I cannot find a requirement that they must be the same type.

[ Batavia 2010: ]

Howard to draft wording, move to Review. Run it by Bill. Need to move this in Madrid.

[2011-03-06: Howard drafts wording]

[2011-03-24 Madrid meeting]

Moved to Immediate

Proposed resolution:

Modify the state_type typedef in the synopsis of [conversions.buffer] p.2 as shown [This makes the synopsis consistent with [conversions.buffer] p.9]:

namespace std {
template<class Codecvt,
  class Elem = wchar_t,
  class Tr = std::char_traits<Elem> >
class wbuffer_convert
  : public std::basic_streambuf<Elem, Tr> {
public:
  typedef typename TrCodecvt::state_type state_type;
  […]
};
}