remove [...] puts the 'removed' elements at the beginning of the sequence
What? No. Both remove_if
and partition
put the "good" elements first. partition
puts the "bad" elements after that, whereas remove_if
does not specify what comes after it -- it might be the bad elements, but it might also be copies of any (either good or bad) elements.
For example, if you partition
1 2 3 4 5 on even, you might get 2 4 5 3 1 (note that each element occurs exactly once), whereas if you remove_if
the odd elements, you might get 2 4 3 4 5 (note the duplicates).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…