最終更新日時:
が更新

履歴 編集

function template
<locale>

std::isprint

namespace std {
  template <class charT>
  bool isprint(charT c, const locale& loc);
}

概要

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

戻り値

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

備考

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

#include <locale>
#include <iostream>

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

  std::cout << std::boolalpha << std::isprint('a', l) << std::endl;
}

出力

true

バージョン

言語

  • C++03

処理系

  • Clang: 3.0
  • GCC: 4.3.6
  • Visual C++: 2003 , 2005 , 2008 , 2010 , 2012

実装例

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

関連項目