std::codecvt<InternT,ExternT,StateT>:: always_noconv, do_always_noconv
| 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_noconv
codecvt::do_always_noconv
|
||||
|
Definiert im Header
<locale>
|
||
| (1) | ||
|
public
:
bool always_noconv ( ) const throw ( ) ; |
(bis C++11) | |
|
public
:
bool always_noconv ( ) const noexcept ; |
(seit C++11) | |
| (2) | ||
|
protected
:
virtual bool do_always_noconv ( ) const throw ( ) ; |
(bis C++11) | |
|
protected
:
virtual bool do_always_noconv ( ) const noexcept ; |
(seit C++11) | |
do_always_noconv
der am stärksten abgeleiteten Klasse auf.
std::codecvt_base::noconv
zurückgeben.
Rückgabewert
true wenn diese Konvertierungsfacette keine Konvertierungen durchführt, false andernfalls.
Die nicht-konvertierende Spezialisierung std:: codecvt < char , char , std:: mbstate_t > gibt true zurück.
Hinweise
Diese Funktion kann beispielsweise in der Implementierung von std::basic_filebuf::underflow und std::basic_filebuf::overflow verwendet werden, um Massen-Zeichenkopie zu nutzen anstatt std::codecvt::in oder std::codecvt::out aufzurufen, falls bekannt ist, dass die in den std::basic_filebuf eingebettete Locale keine Konvertierungen vornimmt.
Beispiel
#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'; }
Ausgabe:
The non-converting char<->char codecvt::always_noconv() returns true while wchar_t<->char codecvt::always_noconv() returns false