Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1014 Bytes

File metadata and controls

55 lines (39 loc) · 1014 Bytes

value

  • regex[meta header]
  • std[meta namespace]
  • regex_traits[meta class]
  • function[meta id-type]
  • cpp11[meta cpp]
int value(char_type ch, int radix) const;

概要

文字の整数表現を取得する。

要件

基数のパラメータradixは、81016のいずれかであること。

戻り値

基数radixの数字文字chに対応する数値を返す。対応する数値がない場合は-1を返す。

#include <regex>
#include <cassert>

int main()
{
  std::regex_traits<char> traits;

  // 10進数の数字文字'1'の数値表現を取得
  int value = traits.value('1', 10);
  assert(value == 1);
}
  • value('1', 10)[color ff0000]

出力

バージョン

言語

  • C++11

処理系