• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <regex>

    std::basic_regex::getloc

    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

    処理系

    • Clang: 3.0 , 3.1 , 3.2 , 3.3 , 3.4 , 3.5 , 3.6
    • GCC: 4.9.0 , 4.9.1 , 4.9.2 , 5.0.0
    • ICC: ??
    • Visual C++: ??