[Modern C++] Partition
vector v1 = { 1, 2, 4, 5, 3, 6, 8, 5, 7, 9 }; vector v2 = { 1, 2, 4, 5, 3, 6, 8, 5, 7, 9 }; auto lambda = [](int x) { return x % 2 == 1; }; auto p = partition(v1.begin(), v1.end(), lambda); auto s = stable_partition(v2.begin(), v2.end(), lambda); for (auto i = v1.begin(); i < v1.end(); i++) { cout
[Modern C++] C++ 의 map, reduce, filter
std::vector nums{ 1,2,3,4 }; std::vector map_example; std::vector filter_example; std::transform(nums.begin(), nums.end(), std::back_inserter(map_example), [](const auto& x) {return x * x; }); std::copy_if(nums.begin(), nums.end(), std::back_inserter(filter_example), [](const auto& x) {return x % 2 == 0; }); auto reduce_example = std::accumulate(nums.begin(), nums.end(), 1, [](const auto& x,cons..