| Localization library | |||||||||||||||||||||||||
| Regular expressions library(C++11) | |||||||||||||||||||||||||
| Formatting library(C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | ||||
codecvt::always_noconvcodecvt::do_always_noconv | ||||
Defined in header <locale> | ||
| (1) | ||
public: bool always_noconv()constthrow(); | (until C++11) | |
public: bool always_noconv()constnoexcept; | (since C++11) | |
| (2) | ||
protected: virtualbool do_always_noconv()constthrow(); | (until C++11) | |
protected: virtualbool do_always_noconv()constnoexcept; | (since C++11) | |
do_always_noconv of the most derived class.true if this conversion facet performs no conversions,false otherwise.
The non-converting specializationstd::codecvt<char,char,std::mbstate_t> returnstrue.
This function may be used e.g. in the implementation ofstd::basic_filebuf::underflow andstd::basic_filebuf::overflow to use bulk character copy instead of callingstd::codecvt::in orstd::codecvt::out if it is known that the locale imbued in thestd::basic_filebuf does not perform any conversions.
#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 truewhile wchar_t<->char codecvt::always_noconv() returns false