Enable readability-container-contains clang-tidy check (#6909)
This commit is contained in:
committed by
GitHub
parent
1a6f4c44e7
commit
9aaab7a53f
@@ -22,7 +22,7 @@ auto makeHasNeighborNotInCheck(const DinicMaxFlow::SourceSinkNodes &set,
|
||||
return [&](const NodeID nid)
|
||||
{
|
||||
const auto is_not_contained = [&set](const BisectionEdge &edge)
|
||||
{ return set.count(edge.target) == 0; };
|
||||
{ return !set.contains(edge.target); };
|
||||
return view.EndEdges(nid) !=
|
||||
std::find_if(view.BeginEdges(nid), view.EndEdges(nid), is_not_contained);
|
||||
};
|
||||
@@ -128,7 +128,7 @@ DinicMaxFlow::ComputeLevelGraph(const BisectionGraphView &view,
|
||||
levels[node_id] = 0;
|
||||
level_queue.push(node_id);
|
||||
for (const auto &edge : view.Edges(node_id))
|
||||
if (source_nodes.count(edge.target))
|
||||
if (source_nodes.contains(edge.target))
|
||||
levels[edge.target] = 0;
|
||||
}
|
||||
// check if there is flow present on an edge
|
||||
@@ -139,7 +139,7 @@ DinicMaxFlow::ComputeLevelGraph(const BisectionGraphView &view,
|
||||
const auto relax_node = [&](const NodeID node_id)
|
||||
{
|
||||
// don't relax sink nodes
|
||||
if (sink_nodes.count(node_id))
|
||||
if (sink_nodes.contains(node_id))
|
||||
return;
|
||||
|
||||
const auto level = levels[node_id] + 1;
|
||||
@@ -264,7 +264,7 @@ std::vector<NodeID> DinicMaxFlow::GetAugmentingPath(LevelGraph &levels,
|
||||
dfs_stack.top().edge_iterator++;
|
||||
|
||||
// check if the edge is valid
|
||||
const auto has_capacity = flow[target].count(path.back()) == 0;
|
||||
const auto has_capacity = !flow[target].contains(path.back());
|
||||
const auto descends_level_graph = levels[target] + 1 == levels[path.back()];
|
||||
|
||||
if (has_capacity && descends_level_graph)
|
||||
@@ -300,8 +300,9 @@ bool DinicMaxFlow::Validate(const BisectionGraphView &view,
|
||||
// sink and source cannot share a common node
|
||||
const auto separated = std::find_if(source_nodes.begin(),
|
||||
source_nodes.end(),
|
||||
[&sink_nodes](const auto node)
|
||||
{ return sink_nodes.count(node); }) == source_nodes.end();
|
||||
[&sink_nodes](const auto node) {
|
||||
return sink_nodes.contains(node);
|
||||
}) == source_nodes.end();
|
||||
|
||||
const auto invalid_id = [&view](const NodeID nid) { return nid >= view.NumberOfNodes(); };
|
||||
const auto in_range_source =
|
||||
|
||||
Reference in New Issue
Block a user