diff --git a/asteria/runtime/module_loader.hpp b/asteria/runtime/module_loader.hpp index c67bbf1a9..b40adf978 100644 --- a/asteria/runtime/module_loader.hpp +++ b/asteria/runtime/module_loader.hpp @@ -73,14 +73,10 @@ class Module_Loader::Unique_Stream Unique_Stream& do_reset(const refcnt_ptr& loader, locked_stream_pair* strm) noexcept { - auto qloader = ::std::exchange(this->m_loader, loader); - auto qstrm = ::std::exchange(this->m_strm, strm); - if(!qstrm) - return *this; - - // Unlock the old stream if one has been assigned. - ROCKET_ASSERT(qloader); - qloader->do_unlock_stream(qstrm); + auto qloader = ::rocket::exchange(this->m_loader, loader); + auto qstrm = ::rocket::exchange(this->m_strm, strm); + if(qloader && qstrm) + qloader->do_unlock_stream(qstrm); return *this; } diff --git a/asteria/runtime/reference.hpp b/asteria/runtime/reference.hpp index a3cfbd43f..9eaaa0adf 100644 --- a/asteria/runtime/reference.hpp +++ b/asteria/runtime/reference.hpp @@ -56,7 +56,7 @@ class Reference m_var(::std::move(other.m_var)), m_ptc(::std::move(other.m_ptc)), m_mods(::std::move(other.m_mods)), - m_xref(::std::exchange(other.m_xref, xref_invalid)) + m_xref(::rocket::exchange(other.m_xref)) { if(this->m_xref == xref_temporary) this->m_value = ::std::move(other.m_value); @@ -73,7 +73,7 @@ class Reference this->m_ptc = ::std::move(other.m_ptc); this->m_mods = ::std::move(other.m_mods); - this->m_xref = ::std::exchange(other.m_xref, xref_invalid); + this->m_xref = ::rocket::exchange(other.m_xref); return *this; } diff --git a/asteria/value.hpp b/asteria/value.hpp index 02cc65028..1a86abdca 100644 --- a/asteria/value.hpp +++ b/asteria/value.hpp @@ -80,7 +80,7 @@ class Value Value(Value&& other) noexcept : - m_bytes(::std::exchange(other.m_bytes, bytes_type())) // HACK + m_bytes(::rocket::exchange(other.m_bytes)) // HACK { }