vector检索

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 () (const StAlarmInfo  arin)
   {
         return arin.nAutoID == id;             
   }  
private:
 int id;
};

posted @ 2011-08-19 16:11  积木  阅读(239)  评论(0编辑  收藏  举报