diff --git a/Src/Base/AMReX_VisMF.cpp b/Src/Base/AMReX_VisMF.cpp index 6749c626c3..8b9a80d0d3 100644 --- a/Src/Base/AMReX_VisMF.cpp +++ b/Src/Base/AMReX_VisMF.cpp @@ -75,14 +75,14 @@ namespace auto cached_ba = it->first.lock(); if (cached_ba) { if (cached_ba->m_abox == ba_ref->m_abox) { - ba_ref = cached_ba; + ba_ref = std::move(cached_ba); dm_ref = it->second.lock(); ielem = int(std::distance(s_layout_cache.begin(), it)); break; } ++it; } else { // expired - s_layout_cache.erase(it); + it = s_layout_cache.erase(it); } }