diff --git a/src/Val.cc b/src/Val.cc index fe7f0a4c9b..e3eb35002f 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -2311,9 +2311,9 @@ ListValPtr TableVal::ToPureListVal() const return ToListVal(tl[0]->Tag()); } -std::unordered_map TableVal::ToMap() const +std::unordered_map TableVal::ToMap() const { - std::unordered_map res; + std::unordered_map res; for ( const auto& iter : *table_val ) { @@ -2321,7 +2321,7 @@ std::unordered_map TableVal::ToMap() const auto v = iter.GetValue(); auto vl = table_hash->RecoverVals(*k); - res[vl.release()] = v->GetVal(); + res[std::move(vl)] = v->GetVal(); } return res; diff --git a/src/Val.h b/src/Val.h index ec0a5db158..4bdd1b9dbc 100644 --- a/src/Val.h +++ b/src/Val.h @@ -896,9 +896,7 @@ public: ListValPtr ToPureListVal() const; // Returns a map of index-to-value's. The value is nil for sets. - // It's up to the caller to Unref() the index Val* when done - // with it. - std::unordered_map ToMap() const; + std::unordered_map ToMap() const; void SetAttrs(detail::AttributesPtr attrs);