However it appears that for two integers i and j such as i != j and cmp.at(i) == cmp.at(j), if I try to insert both, only one would be inserted into the set. I understand that it is the behaviour of std::set, however I would have prefered if both those integers (which are not equals) would be inserted in the set next to each other.
In your operator(), you could do
return (cmp.at(i) < cmp.at(j)) || (!(cmp.at(j) < cmp.at(i)) && (i < j));
Which is basically saying that the set will be sorted in ascending order by the value at the index, then by the relative value of the index itself.