次の方法で共有


hash_set::find (STL/CLR)

指定したキーに一致する要素を検索します。

    iterator find(key_type key);

パラメーター

  • key
    検索するキー値。

解説

被制御シーケンスの 1 回以上の要素に keyと同等の命令がある場合は、メンバー関数は、それらの要素に 1 を指定する反復子を返します; それ以外の場合は hash_set::end (STL/CLR)()を返します。指定したキーに一致する被制御シーケンスの要素を現在の検索に使用します。

使用例

// cliext_hash_set_find.cpp 
// compile with: /clr 
#include <cliext/hash_set> 
 
typedef cliext::hash_set<wchar_t> Myhash_set; 
int main() 
    { 
    Myhash_set c1; 
    c1.insert(L'a'); 
    c1.insert(L'b'); 
    c1.insert(L'c'); 
 
// display initial contents " a b c" 
    for each (wchar_t elem in c1) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
    System::Console::WriteLine("find {0} = {1}", 
        L'A', c1.find(L'A') != c1.end()); 
    System::Console::WriteLine("find {0} = {1}", 
        L'b', *c1.find(L'b')); 
    System::Console::WriteLine("find {0} = {1}", 
        L'C', c1.find(L'C') != c1.end()); 
    return (0); 
    } 
 
  

Description

複数の要素が、その検索 find が保証されないことに注意してください。

必要条件

ヘッダー:<cliext/hash_set>

名前空間: の cliext

参照

関連項目

hash_set (STL/CLR)

hash_set::equal_range (STL/CLR)

hash_set::lower_bound (STL/CLR)

hash_set::upper_bound (STL/CLR)