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

履歴 編集

function
<regex>

std::basic_regex::getloc(C++11)

locale_type getloc() const;

概要

現在のロケールを取得する。

効果

*this に保持されている traits_type 型のオブジェクト traits_inst に対して、traits_inst.getloc() を呼び出し、その結果を返す。

戻り値

現在設定されているロケール

備考

  • traits_instデフォルト初期化されたオブジェクトである。
  • locale_type は、ロケールに関する型であり、traits_type::locale_type の別名である。
  • traits_type は、クラステンプレート basic_regex の 2 番目のテンプレート引数で、デフォルトでは regex_traits<char_type> である。
    その場合、locale_typelocale である。

#include <iostream>
#include <locale>
#include <regex>

int main()
{
  std::regex re("\\w+");
  auto loc = re.getloc();
  std::cout << std::boolalpha << (loc == std::locale()) << std::endl;
}

出力

true

バージョン

言語

  • C++11

処理系