
The C standard describes that the zero-valued mbstate_t shall count as an initial state. From n1256:
7.24.6 Extended multibyte/wide character conversion utilities
...
3 The initial conversion state corresponds, for a conversion in either direction, to the beginning of a new multibyte character in the initial shift state. A zero-valued mbstate_t object is (at least) one way to describe an initial conversion state. A zero-valued mbstate_t object can be used to initiate conversion involving any multibyte character sequence, in any LC_CTYPE category setting.
...
Ok that is interesting, it actually allows me to keep what I need if I know it is zeroed Thank you, I'll take a look on it.
Also, there is the mbsinit function that allows to detect if the state has the initial value (just in case there are other initial values, other than zero-filled).
I can't really relay on mbsinit as they not available in on CRTL's
and further on, in the paragraph 5 (regarding do_unshift), there is a footnote that explains that the method is intended to return the state to the initial value (typically, stateT()).
That is probably the most misleading point. If state is POD then stateT() does nothing! Thank your for your points. I'll take a look on what can be done. Artyom