It is not difficult to return the position. For example you could use standard algorithm std::find_if
and then apply function std::distance
to determine the position. Or you can write the function yourself using a loop
std::vector<std::set<int>>::size_type i = 0;
while ( i < v.size() && v[i].find( key ) == v[i].end() ) ++i;
if ( i != v.size() ) v.erase( std::next( v.begin(), i ) );
or
auto it = std::find_if( v.begin(), v.end(),
[&]( const std::set<int> &s )
[
return ( s.find(key ) != s.end() );
} );
if ( it != v.end() ) v.erase( it );
If you need to delete all elements of the vector that contain a given value (key) then you can use standard algorithm std::remove_if
along with member function erase