#include <iostream>
#include <vector>
#include <algorithm>
int main()
{
std::vector<int> v = {3,4,5,6,7,8,9};
int pos = -1;
std::vector<int>::iterator it;
if((it = std::find(v.begin(), v.end(), 6)) != v.end())
pos = it - v.begin();
std::cout << "6 is at pos " << pos << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKaW50IG1haW4oKQp7CiAgICBzdGQ6OnZlY3RvcjxpbnQ+IHYgPSB7Myw0LDUsNiw3LDgsOX07CiAgICAKICAgIGludCBwb3MgPSAtMTsKICAgIHN0ZDo6dmVjdG9yPGludD46Oml0ZXJhdG9yIGl0OwogICAgCiAgICBpZigoaXQgPSBzdGQ6OmZpbmQodi5iZWdpbigpLCB2LmVuZCgpLCA2KSkgIT0gdi5lbmQoKSkKICAgICAgICBwb3MgPSBpdCAtIHYuYmVnaW4oKTsKICAgICAgICAKICAgIHN0ZDo6Y291dCA8PCAiNiBpcyBhdCBwb3MgIiA8PCBwb3MgPDwgc3RkOjplbmRsOwp9