名前空間
変種
操作

std::has_facet

提供: cppreference.com
< cpp‎ | locale

 
 
 
ヘッダ <locale> で定義
template< class Facet >
bool has_facet( const locale& loc );
ロケールlocするかどうかをチェックするには、ファセットFacetを実装しています.
Original:
Checks if the locale loc implements the facet Facet.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

loc -
クエリへのロケールオブジェクト
Original:
the locale object to query
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

戻りtrueファセットFacetはロケールにインストールされている場合locfalseその他のとき.
Original:
Returns true if the facet Facet was installed in the locale loc, false otherwise.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 例外仕様

noexcept 指定:  
noexcept
  

[編集]

#include <iostream>
#include <locale>
// minimal custom facet
struct myfacet : public std::locale::facet {
    static std::locale::id id;
};
std::locale::id myfacet::id;
int main()
{
    // loc is a "C" locale with myfacet added
    std::locale loc(std::locale::classic(), new myfacet);
    std::cout << std::boolalpha
              << "Can loc classify chars? "
              << std::has_facet<std::ctype<char>>(loc) << '\n'
              << "Can loc classify char32_t? "
              << std::has_facet<std::ctype<char32_t>>(loc) << '\n'
              << "Does loc implement myfacet? "
              << std::has_facet<myfacet>(loc) << '\n';
}

出力:

Can loc classify chars? true
Can loc classify char32_t? false
Does loc implement myfacet? true

[編集] 参照

文化の違いをカプセル化する多相的なファセットの集合
(クラス) [edit]
ロケールからファセットを取得します
(関数テンプレート) [edit]