I was trying to resort a set when i realised that it was impossible to resort a set and i had to create a new set and have a custom sort function to resort it . I researched onl
Your two sets have different types (the compare function is part of the type definition).
Since std::set
does not provide a constructor or assignment operator for different compare functions, you have to either initialize the new set with an iterator pair to your first set or std::copy
over the elements.
That is:
set p2d_set2 { std::begin(p2d_set), std::end(p2d_set) };
or
set p2d_set2;
std::copy(std::begin(p2d_set), std::end(p2d_set), std::inserter(p2d_set2));