std::codecvt<InternT,ExternT,StateT>::unshift, do_unshift
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Text processing library
Regular expressions library (C++11)
Formatting library (C++20)
Localization library
String and stream conversions
Unicode conversion facets
C library locales
(C++11/17/26*)
(C++11/17/26*)
(C++11/17/26*)
(C++11/17/26*)
(C++11/17/26*)
(C++11/17/26*)
std::codecvt
Member functions
codecvt::unshiftcodecvt::do_unshift
Defined in header
<locale>
public:
(1)
result unshift( StateT& state, ExternT* to, ExternT* to_end,
protected:
(2)
virtual result do_unshift( StateT& state, ExternT* to, ExternT* to_end,
1) Public member function, calls the member function
do_unshift
of the most derived class.2) If the encoding represented by this
codecvt
facet is state-dependent, and state represents a conversion state that is not the initial shift state, writes the characters necessary to return to the initial shift state. The characters are written to a character array whose first element is pointed to by to. No more than to_end - to characters are written. The parameter to_next is updated to point one past the last character written.[edit] Return value
A value of type std::codecvt_base::result , indicating the success status as follows:
ok
all necessary characters were written. state now represents initial shift state
partial
not enough space in the output buffer. to_next == to_end
error
an unspecified error has occurred
noconv
the encoding is not state-dependent, no termination sequence necessary
[edit] Notes
This function is called by std::basic_filebuf::close() and in other situations when finalizing a state-dependent multibyte character sequence.
[edit] Example
This section is incomplete
Reason: no example
Reason: no example
[edit] Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR | Applied to | Behavior as published | Correct behavior |
---|---|---|---|
LWG 305 | C++98 | std::codecvt <wchar_t, char, std::mbstate_t >::do_unshift was required not to write any character |
not required |
LWG 380 | C++98 | the meaning of returning partial was 'more characters need to be supplied to complete termination', but no character is supplied |
corrected to indicating insufficient buffer space |
LWG 381 | C++98 | state was not required to be valid, and error is returned if state is invalid |
state is required to be valid, and returning error indicates an error |
LWG 664 | C++98 | std::codecvt <char, char, std::mbstate_t >::do_unshift was required not to write any character |
not required |
LWG 665 | C++98 | std::codecvt <char, char, std::mbstate_t >::do_unshift was required to return noconv |
not required |