std::codecv...ways_noconv(3)
πΈ NAME πΈ
std::codecvt::always_noconv,do_always_noconv - std::codecvt::always_noconv,do_always_noconv
okay bestie, you're on the std::codecv...ways_noconv(3) page from the C++ Standard Libary manual (yes, that's literally how it's spelled up top π«Ά). this is the whole always-noconv / do-always-noconv situation, and it's lowkey iconic.
π¦ Synopsis π¦
Defined in header <locale>
public: (until C++11)
bool always_noconv() const throw();
public: (since C++11)
bool always_noconv() const noexcept; (1)
protected:
(until C++11)
virtual bool do_always_noconv() const throw(); (2)
protected:
(since C++11)
virtual bool do_always_noconv() const noexcept;
- Public member function, calls the member function
do_always_noconvof the most derived class. - Returns
trueif bothdo_in()anddo_out()returnstd::codecvt_base::noconvfor all valid inputs.
π Return value π
true if this conversion facet performs no conversions, false otherwise. simple as that, no cap β¨
The non-converting specialization std::codecvt<char, char, std::mbstate_t> returns true. periodt π
β¨ Notes β¨
This function may be used e.g. in the implementation of std::basic_filebuf::underflow and std::basic_filebuf::overflow to use bulk character copy instead of calling std::codecvt::in or std::codecvt::out if it is known that the locale imbued in the std::basic_filebuf does not perform any conversions.
like, the vibe check is: if nobody's converting anything, why call the converter? exactly. main character optimization energy π₯
π Example π
// Run this code
#include <iostream>
#include <locale>
int main()
{
std::cout << "The non-converting char<->char
codecvt::always_noconv() returns "
<< std::boolalpha
<< std::use_facet<std::codecvt<char, char,
std::mbstate_t>>(
std::locale()
).always_noconv() << '\n'
<< "while wchar_t<->char codecvt::always_noconv() returns
"
<< std::use_facet<std::codecvt<wchar_t, char,
std::mbstate_t>>(
std::locale()
).always_noconv() << '\n';
}
π Output π
The non-converting char<->char codecvt::always_noconv() returns true
while wchar_t<->char codecvt::always_noconv() returns false
mwah π this page came from http://cppreference.com, dated 2024.06.10, and the footer literally says std::codecv...ways_noconv(3). byeee bestie π¦π
π¦ 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