c++ - Iterating through a vector without begin and end -
i have vector of keywords , need iterate through it. my attempt : bool iskeyword(string s) { return find(keywords, keywords + 10, s ) != keywords + 10; } however works array not vector. how can change + 10 iterate through vector? need since can't use end , begin because not have c++11 support. error given above code: error: no matching function call 'find(std::vector<std::basic_string<char> >&, std::vector<std::basic_string<char> >::size_type, std::string&)'| use begin() , end() this: find(keywords.begin(), keywords.end(), s ) here example: #include <iostream> #include <vector> #include <string> #include <algorithm> // std::find using namespace std; bool iskeyword(string& s, std::vector<string>& keywords) { return (find(keywords.begin(), keywords.end(), s ) != keywords.end()); } int main() { vector<string> v; string s = "stackoverflow"; ...