0
如何通過矢量搜索特定的字符串?那搜索會返回什麼?在矢量中搜索字符串?
我設置以下名稱作爲搜索的用戶輸入。
find(user_list.begin(), user_list.end(), name)
我不知道如何實現這個到一個布爾函數,因爲我不知道什麼值查找將返回。
功能是
bool BBoard::user_exists(const string &name, const string &pass) const{}
,我得到了很多的錯誤,現在它是如何不能比的。
嗯,這就是[文件](HTTP:// en.cppreference.com/w/cpp/algorithm/find)。 – jrok
_「我不知道find會返回什麼值」_ - 可以通過引用[documentation](http://en.cppreference.com/w/cpp/algorithm/find)輕鬆解決。 –
std :: find返回迭代器:std :: vector :: iterator,則if(res_itr!= user_list.end()){std :: cout << * res_itr; } –
marcinj