Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <utility>
- #include <algorithm>
- #include <numeric>
- std::vector<std::pair<int, int>> gc_integers = { { 1, 2 }, { 3, 1 } };
- int main()
- {
- auto m = std::reduce(gc_integers.begin(), gc_integers.end(), std::make_pair<int, int>(0, 0),
- [](const auto& max, const auto& current)
- {
- return std::make_pair(
- std::max(max.first, current.first),
- std::max(max.second, current.second));
- });
- std::cout << "first max = " << m.first << " second max = " << m.second << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement