It's not the erase-remove idiom any more but, yes, it'll do the job correctly, optimally and stably.
std::remove
gathers all the unwanted elements into one contiguous block before erasure, but your sortedness has already done that so it's not needed.
You can drop the meaningless (void)
prefixes.