charT
widen(char c) const; // (1) C++98
const char*
widen(const char* low,
const char* high,
charT* to) const; // (2) C++98
概要
指定されたchar型の文字に該当するcharT型の文字を取得する。
- (1) : 文字
cをcharT型へ変換する - (2) : 範囲
[low, high)の各文字をcharT型へ変換し、toが指す領域へ格納する
戻り値
- (1) :
do_widen(c) - (2) :
do_widen(low, high, to)
例
#include <iostream>
#include <locale>
int main()
{
const auto& ct = std::use_facet<std::ctype<wchar_t>>(std::locale::classic());
// (1)
std::wcout << ct.widen('a') << std::endl;
// (2)
const char s[] = "abc";
wchar_t buf[4] = {};
ct.widen(s, s + 3, buf);
std::wcout << buf << std::endl;
}
出力
a
abc
バージョン
言語
- C++98