随笔分类 -  stl

摘要:了解了string 的操作符,查找函数和substr,其实就已经了解了string的80%的操作了。insert函数, replace函数和erase函数在使用起来相对简单。下面以一个例子来说明其应用。 string只是提供了按照位置和区间的replace函数,而不能用一个string字串来替换指定string中的另一个字串。这里写一个函数来实现这个功能: void string_replace(string & strBig, const string & strsrc, const string &strdst) { string::size_type pos=0; 阅读全文
posted @ 2011-09-28 09:23 积木 阅读(3216) 评论(0) 推荐(0)
摘要:std::vector<StAlarmInfo > g_vec; UINT j =1;std::vector<StAlarmInfo *>::iterator iter = std::find_if (g_vec.begin(), g_vec.end(), Find_AutoID_AlInfo(j));if(iter != g_vec.end() ){找到}class Find_AutoID_AlInfo{public: explicit Find_AutoID_AlInfo (const int autoid):id(autoid) {} bool operator 阅读全文
posted @ 2011-08-19 16:11 积木 阅读(247) 评论(0) 推荐(0)