From 898afd40acc84624928faf17e3e8780680d0397c Mon Sep 17 00:00:00 2001 From: liqiangxl Date: Mon, 21 Nov 2022 13:00:40 -0500 Subject: [PATCH] use reference, some compilers may complain or treat it as error --- torch/csrc/jit/codegen/cuda/disjoint_set.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/torch/csrc/jit/codegen/cuda/disjoint_set.h b/torch/csrc/jit/codegen/cuda/disjoint_set.h index 354e9afe8d8c4..7cb7fa5631710 100644 --- a/torch/csrc/jit/codegen/cuda/disjoint_set.h +++ b/torch/csrc/jit/codegen/cuda/disjoint_set.h @@ -345,7 +345,7 @@ DisjointSets::DisjointSets(const DisjointSets& other) { // Deep copy the vector of the disjoint sets, keeping the same // ordering of the sets. - for (const auto other_set : other.disjoint_sets_) { + for (const auto& other_set : other.disjoint_sets_) { auto new_set = std::make_shared>(*other_set); int new_set_index = disjoint_sets_.size(); disjoint_sets_.emplace_back(new_set); @@ -356,7 +356,7 @@ DisjointSets::DisjointSets(const DisjointSets& other) { } // Copy the mappings using the new sets - for (const auto kv : other.disjoint_set_maps_) { + for (const auto& kv : other.disjoint_set_maps_) { const auto key = kv.first; const auto new_set_index = ptr_map.at(kv.second); disjoint_set_maps_.emplace(key, disjoint_sets_.at(new_set_index));