[_First1,_Last1)の中で[_First2,_Last2)に含まれる要素が最初に見つかる位置を返す.
/* template<class _FwdIt1, class _FwdIt2> _FwdIt1 find_first_of( _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2) template<class _FwdIt1, class _FwdIt2, class _Pr> _FwdIt1 find_first_of( _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2, _Pr _Pred ) */ #include <algorithm> #include <iostream> using namespace std; int main() { int a[] = { 9,7,1,3 }; int b[] = { 3,1,2 }; int c[] = { 5,4,6 }; //true bの要素1がa[2]にある cout << ( find_first_of( a,a+4, b,b+3 ) == a+2 ? "true":"false" ) << endl; //not found cの要素はaに含まれていない cout << ( find_first_of( a,a+4, c,c+3 ) == a+4 ? "not found":"found" ) << endl; return 0; }