#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
using namespace std;
int main()
{
vector<int> v = {1,2,3,4,6,4,5};
// Get index of element from iterator
int index = distance(v.begin(), find(v.begin(), v.end(), 4));
cout << index;
}
int valueIndex = std::distance(
yourArray,
std::find(
yourArray,
yourArray + sizeof(yourArray) / sizeof(yourArray[0]),
yourValueToFind));
#include <iostream>
using namespace std;