There is no general answer for all algorithms. For set_difference
you can learn from C++11 25.4.5.4/2 that:
Requires: The resulting range shall not overlap with either of the original ranges.
This seems to make your code undefined behavior that seems to do what you want.
You'll just have to look at the requirements for a particular algorithm before you decide what iterator ranges to use.