STL(5)find_first_of函数
2013-11-22 11:09
260 查看
/* // TEMPLATE FUNCTION find_first_of template<class _FwdIt1, class _FwdIt2> inline _FwdIt1 _Find_first_of(_FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2) { // look for one of [_First2, _Last2) that matches element _DEBUG_RANGE(_First1, _Last1); _DEBUG_RANGE(_First2, _Last2); for (; _First1 != _Last1; ++_First1) for (_FwdIt2 _Mid2 = _First2; _Mid2 != _Last2; ++_Mid2) if (*_First1 == *_Mid2) return (_First1); return (_First1); } template<class _FwdIt1, class _FwdIt2> inline _FwdIt1 find_first_of(_FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt2 _First2, _FwdIt2 _Last2) { // look for one of [_First2, _Last2) that matches element _DEBUG_RANGE(_First1, _Last1); _DEBUG_RANGE(_First2, _Last2); _ASSIGN_FROM_BASE(_First1, _Find_first_of(_CHECKED_BASE(_First1), _CHECKED_BASE(_Last1), _CHECKED_BASE(_First2), _CHECKED_BASE(_Last2))); return _First1; } */ //*********************by vincent http://my.csdn.net/sunboyiris ************************// #include "stdafx.h" #include "algorithm" #include "iostream" using namespace std; int _tmain(int argc, _TCHAR* argv[]) { char*s1="with"; char*s2="he standard string class provides support for such objects with an interface"; cout<<find_first_of(s1,s1+strlen(s1),s2,s2+strlen(s2))<<endl; return 0; }
相关文章推荐
- STL(5)find_first_of函数
- STL可能的误用-find_first_of和erase
- 关于find_first_of函数的疑惑...
- 输入1,2,3,4....输出1 2 3 4并且输出结果要换行(STL Find_first_of)
- stl string的substr和find_first_of函数的一点心得
- STL 之find,find_if,find_end,find_first_of
- c++之STL(13) STL 算法 - 查找算法(4)find_first_of(b,e,sb,se) find_first_of(b,e,sb,se,bp)
- C++string中的查找函数find与find_first_of函数的区别
- C++ STL 算法:查找算法(4)find_first_of
- 11.2.1 find_first_of函数
- C++STL库中string类的find()和findfirstof()函数比较
- 实战c++中的vector系列--vector应用之STL的find、find_if、find_end、find_first_of、find_if_not(C++11)
- 实战c++中的vector系列--vector应用之STL的find、find_if、find_end、find_first_of、find_if_not(C++11)
- STL_算法_查找算法(find_first_of、find_last_of)
- C++的STL之find_first_of
- (原創) 如何使用find_first_of() algorithm? (C/C++) (STL)
- stl:find _first_of与search用法
- STL 之find,find_if,find_end,find_first_of
- string的erase函数和find、find_first_of函数
- STL find_first_of算法