std::codecvt::always_noconv, std::codecvt::do_always_noconv
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <locale> 中定义
|
||
public: bool always_noconv() const |
(1) | |
protected: bool do_max_length() const |
(2) | |
公共成员函数,调用最派生类的成员函数
2)
do_always_noconv
.原文:
public member function, calls the member function
do_always_noconv
of the most derived class.目录 |
[编辑] 返回值
true如果这种转换方面进行任何转换,false否则.
原文:
true if this conversion facet performs no conversions, false otherwise.
非转换专业化std::codecvt<char, char, std::mbstate_t>回报true
原文:
The non-converting specialization std::codecvt<char, char, std::mbstate_t> returns true
[编辑] 注释
可使用此功能,例如,在实施std::basic_filebuf::underflow使用大容量的字符复制,而不是调用std::codecvt::in如果它是已知的,在std::basic_filebuf的语言环境充满不执行任何转换
原文:
This function may be used e.g. in the implementation of std::basic_filebuf::underflow to use bulk character copy instead of calling std::codecvt::in if it is known that the locale imbued in the std::basic_filebuf does not perform any conversions.
[编辑] 例外
[编辑] 示例
#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"; }
输出:
The non-converting char<->char codecvt::always_noconv() returns true while wchar_t<->char codecvt::always_noconv() returns false