All the relevant constructors of set
also take an instance of Comp
class.
set<string, Comparator> ss(Comparator(-1));
Now you only need a constructor for Comparator
that initializes its member x
with an appropriate value.
That said, the standard library already comes with a comparator class for this purpose:
set<string, std::greater<std::string> > ss;