std::codecv...,do_unshift(3)
π std::codecv...,do_unshift(3) β C++ Standard Libary manual, bestie! π
Okay so welcome to the manual page for std::codecvt::unshift and do_unshift, straight from the <purple>C++ Standard Libary</purple>. This is your group-chat explainer for conversion states, and we are keeping every parameter and every weird little detail. No skipping, no cap. π¦
πΈ NAME
std::codecvt::unshift,do_unshift β yep, the name is literally std::codecvt::unshift,do_unshift, and it is giving βrepetition is the brand.β π
π¦ Synopsis
Defined in header <locale>.
public:
result unshift( StateT& state, ExternT* to, ExternT* to_end,
ExternT*& to_next ) const;
(1) β public member function: calls the member function do_unshift of the most derived class. π
protected:
virtual result do_unshift( StateT& state, ExternT* to, ExternT* to_end,
ExternT*& to_next ) const;
(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. π¦
π Return value
It returns a value of type std::codecvt_base::result, and that result tells you the success status, like a little vibe check for the conversion:
okβ all necessary characters were written.statenow 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. π
π§ Notes
This function is called by std::basic_filebuf::close() and in other situations when finalizing a state-dependent multibyte character sequence. π«Ά
π Example
This section is incomplete. Reason: no example.
π Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
LWG 305β Applied to:C++98. Behavior as published:std::codecvt<wchar_t, char, std::mbstate_t>::do_unshiftwas required not to write any character. Correct behavior: not required.LWG 380β Applied to:C++98. Behavior as published: the meaning of returningpartialwas 'more characters need to be supplied to complete termination', but no character is supplied. Correct behavior: corrected to indicating insufficient buffer space.LWG 381β Applied to:C++98. Behavior as published:statewas not required to be valid, anderroris returned ifstateis invalid. Correct behavior:stateis required to be valid, and returningerrorindicates an error.LWG 664β Applied to:C++98. Behavior as published:std::codecvt<char, char, std::mbstate_t>::do_unshiftwas required not to write any character. Correct behavior: not required.LWG 665β Applied to:C++98. Behavior as published:std::codecvt<char, char, std::mbstate_t>::do_unshiftwas required to returnnoconv. Correct behavior: not required.
π See also
wcrtombβ converts a wide character to its multibyte representation, given state(function).do_outβ converts a string fromInternTtoExternT, such as when writing to file[virtual](virtual protected member function).
π·οΈ Category
* Todo no example
π That is the whole page, bestie β source/version: http://cppreference.com, date: 2024.06.10. Go finalize those state-dependent sequences and slay, periodt. π«Ά
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms