Dear friends:
I use the find algorithm in STL to find a term in the vector<string>, but the find only return the iterator, how to return the index number of the term.
Regards

vector<string> data;
vector<string>::iterator found = find(data.begin(), data.end(), "search");

int pos = found - data.begin();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.