Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You have a range of elements that you need to partition in some well-defined way. For example, you may want all elements less than a particular value moved to the front of the range.
Use the partition standard algorithm with a predicate functor to move the elements around however you like. See Example 7-7.