小编App*_*ble的帖子

如何在任一轴的std :: vector <std :: pair <int,int >>上找到std :: max_element?

如何std::vector<std::pair<int, int>>在任一轴上找到这对中的max元素。

将此作为样本对:

0, 1
0, 2
1, 1
1, 2
1, 4
2, 2
3, 1
Run Code Online (Sandbox Code Playgroud)

我尝试使用std::minmax_element()

const auto p = std::minmax_element(edges.begin(), edges.end());
auto max = p.second->first;
Run Code Online (Sandbox Code Playgroud)

但这仅生成第一列3的最大元素,即,但我想要任一列的最大元素,即4

我希望max元素成为任一列中的最高元素。

c++ algorithm std stdvector

7
推荐指数
2
解决办法
174
查看次数

标签 统计

algorithm ×1

c++ ×1

std ×1

stdvector ×1