better partition implementation: use std::back_inserter