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_typeはlocaleである。
例
#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++: ??