#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

struct p {
    int x,y;
    p(const int x, const int y) : x(x), y(y) {};
    bool operator==(const p& other) const { return x == other.y && y == other.y; };
};

int findInVector(const std::vector<p>  & vecOfElements, const p & element)
{
    int result;

    auto it = std::find_if(vecOfElements.begin(), vecOfElements.end(), [&temp = element]
            (const p& pp) -> bool { return temp == pp; });

    if (it != vecOfElements.end())
    {
        result = distance(vecOfElements.begin(), it);
    }
    else
    {
        result = -1;
    }

    return result;
}

int main(){
    p test = p(1,2);
    std::vector<p> pvector;
    pvector.push_back(test);
    std::cout << findInVector(pvector,test);
}