std::codecvt<InternT,ExternT,StateT>::always_noconv, do_always_noconv
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Text processing library
Regular expressions library (C++11)
Formatting library (C++20)
(C++17)
(C++17)
(C++17)
(C++17)
(C++17)
(C++26)
Localization library
(C++11/17/26*)
(C++11/17/26*)
(C++11/17/26*)
(C++11/17/26*)
(C++11/17/26*)
(C++11/17/26*)
std::codecvt
Member functions
codecvt::always_noconvcodecvt::do_always_noconv
Defined in header
<locale>
(1)
public:
bool always_noconv() const throw();
(until C++11)
bool always_noconv() const throw();
public:
bool always_noconv() const noexcept;
(since C++11)
bool always_noconv() const noexcept;
(2)
protected:
virtual bool do_always_noconv() const throw();
(until C++11)
virtual bool do_always_noconv() const throw();
protected:
virtual bool do_always_noconv() const noexcept;
(since C++11)
virtual bool do_always_noconv() const noexcept;
1) Public member function, calls the member function
do_always_noconv
of the most derived class.[edit] Return value
true if this conversion facet performs no conversions, false otherwise.
The non-converting specialization std::codecvt <char, char, std::mbstate_t > returns true.
[edit] 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.
[edit] 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