Check out example codes for "storing custom objects in set c++". It will help you in understanding the concepts better.

Code Example 1

Add to Class template

bool operator< (const ClassName &other) const
{
    return x < other.x;
}

Learn ReactJs, React Native from akashmittal.com