#include <iostream>
#include <vector>
#include <algorithm>
int main() {
std::vector<int> numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
// 使用 std::partition 将奇数和偶数分隔开
auto isOdd = [](int x) { return x % 2 != 0; };
auto partitionPoint = std::partition(numbers.begin(), numbers.end(), isOdd);
// 打印奇数
std::cout << "Odd numbers:";
std::for_each(numbers.begin(), partitionPoint, [](int x) { std::cout << " " << x; });
std::cout << std::endl;
// 打印偶数
std::cout << "Even numbers:";
std::for_each(partitionPoint, numbers.end(), [](int x) { std::cout << " " << x; });
std::cout << std::endl;
return 0;
}