std::set
is ordered container, while std::remove
changes order of elements in container placing elements that should be removed to the end, thus it can't be used with ordered containers where elements order is defined by predicate. You need to use:
s.erase( 1);
To remove 1 from set.