## 24.4.2 Transformations - `partition`

- partition - moves all elements satisfying a predicate to one end
- Returns iterator to right-most element in left partition
- E.g., partition 1..10 with `is_even`

  > `vector<int> a(10);
  > generate(a.begin(), a.end(), SequenceGenerator(1));
  > partition(a.begin(), a.end(), is_even);`

- Yields

  `10` | `8` | `6` | `4` | `2` | `3` | `1` | `7` | `5` | `9`

- Relative order not maintained
  - Use `stable_partition` (slower)

prev |top |next