1std::vector<Type> v = ....;
2std::string myString = ....;
3auto it = find_if(v.begin(), v.end(), [&myString](const Type& obj) {return obj.getName() == myString;})
4
5if (it != v.end())
6{
7 // found element. it is an iterator to the first matching element.
8 // if you really need the index, you can also get it:
9 auto index = std::distance(v.begin(), it);
10}