返回解决的迭代器一个元素的位置在具有键等效于指定的键设置的。
iterator find(
   const Key& _Key
);
const_iterator find(
   const Key& _Key
) const;
参数
- _Key
一个元素的排序关键字将匹配的参数键从一组搜索的。 
返回值
解决元素设置为与指定的键或解决成功最后一个元素的位置处于迭代或 const_iterator,如果与未作为项中。
备注
成员函数返回解决在设置的元素排序关键字与参数键是等效的二进制文件谓词下生成基于的排序小于可比性关系的迭代器。
如果 find 的返回值赋给 const_iterator,不能修改设置的对象。如果 find 的返回值赋给 iterator,可以修改设置的对象。
示例
// set_find.cpp
// compile with: /EHsc
#include <set>
#include <iostream>
int main( )
{
   using namespace std;
   set <int> s1;
   set <int> :: const_iterator s1_AcIter, s1_RcIter;
   
   s1.insert( 10 );
   s1.insert( 20 );
   s1.insert( 30 );
   s1_RcIter = s1.find( 20 );
   cout << "The element of set s1 with a key of 20 is: "
        << *s1_RcIter << "." << endl;
   s1_RcIter = s1.find( 40 );
   // If no match is found for the key, end( ) is returned
   if ( s1_RcIter == s1.end( ) )
      cout << "The set s1 doesn't have an element "
           << "with a key of 40." << endl;
   else
      cout << "The element of set s1 with a key of 40 is: "
           << *s1_RcIter << "." << endl;
   // The element at a specific location in the set can be found 
   // by using a dereferenced iterator addressing the location
   s1_AcIter = s1.end( );
   s1_AcIter--;
   s1_RcIter = s1.find( *s1_AcIter );
   cout << "The element of s1 with a key matching "
        << "that of the last element is: "
        << *s1_RcIter << "." << endl;
}
要求
标头: <set>
命名空间: std