Defined in header <locale> | ||
---|---|---|
public: bool always_noconv() const; | (1) | |
protected: virtual bool do_always_noconv() const; | (2) |
do_always_noconv
of the most derived class.true
if this conversion facet performs no conversions, false
otherwise.
The non-converting specialization std::codecvt<char, char, std::mbstate_t>
returns true
.
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.
(none) | (until C++11) |
noexcept specification: noexcept | (since C++11) |
#include <locale> #include <iostream> 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
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/locale/codecvt/always_noconv