最終更新日時(UTC):
が更新

履歴 編集

function
<string>

std::char_traits::to_char_type

static char_type to_char_type(const int_type& c);             // C++03
static constexpr char_type to_char_type(int_type c) noexcept; // C++11

概要

数値を文字に変換する。

戻り値

eq_int_type(c, to_int_type(e)) == trueとなるような整数値eが存在する場合、eを返す。そのような値がない場合は、未規定の値を返す。

計算量

定数時間

#include <iostream>
#include <string>

int main()
{
  char x = std::char_traits<char>::to_char_type(0x41);
  std::cout << x << std::endl;
}

出力例

A

参照