Skip to content

Latest commit

 

History

History
67 lines (52 loc) · 1.5 KB

File metadata and controls

67 lines (52 loc) · 1.5 KB

ispunct

  • locale[meta header]
  • std[meta namespace]
  • function template[meta id-type]
namespace std {
  template <class charT>
  bool ispunct(charT c, const locale& loc);
}

概要

localeを引数で指定できるispunct()関数。 文字cが区切り文字であるかどうかを、ロケールに基いて判定する。

戻り値

std::use_facet<std::ctype<charT>>(loc).is(std::ctype_base::punct, c)を返す。

備考

localeを引数に取らないispunct()関数は、<cctype>ヘッダに存在する。

#include <locale>
#include <iostream>

int main()
{
  std::locale l = std::locale::classic();

  std::cout << std::boolalpha << std::ispunct('.', l) << std::endl;
}
  • std::ispunct[color ff0000]
  • std::locale[link locale.md]
  • classic()[link locale/classic.md]

出力

true

バージョン

言語

  • C++03

処理系

  • Clang: 3.0 [mark verified]
  • GCC: 4.3.6 [mark verified]
  • Visual C++: 2003 [mark verified], 2005 [mark verified], 2008 [mark verified], 2010 [mark verified], 2012 [mark verified]

実装例

template <class charT>
bool ispunct(charT c, const locale& loc)
{
  return std::use_facet<std::ctype<charT>>(loc).is(std::ctype_base::punct, c);
}

関連項目