From eecdf4b0f3d5c5355ba4c958ebe9fa00340ebda0 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 28 Jan 2024 19:45:07 -0500 Subject: [PATCH] Internals: Use C++14 exchange --- include/verilated_types.h | 8 ++++---- src/V3Dfg.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/verilated_types.h b/include/verilated_types.h index 63630d595..5f33d9869 100644 --- a/include/verilated_types.h +++ b/include/verilated_types.h @@ -1648,7 +1648,7 @@ public: } // cppcheck-suppress noExplicitConstructor VlClassRef(VlClassRef&& moved) - : m_objp{vlstd::exchange(moved.m_objp, nullptr)} {} + : m_objp{std::exchange(moved.m_objp, nullptr)} {} // cppcheck-suppress noExplicitConstructor template VlClassRef(const VlClassRef& copied) @@ -1658,7 +1658,7 @@ public: // cppcheck-suppress noExplicitConstructor template VlClassRef(VlClassRef&& moved) - : m_objp{vlstd::exchange(moved.m_objp, nullptr)} {} + : m_objp{std::exchange(moved.m_objp, nullptr)} {} ~VlClassRef() { refCountDec(); } // METHODS @@ -1673,7 +1673,7 @@ public: VlClassRef& operator=(VlClassRef&& moved) { if (m_objp == moved.m_objp) return *this; refCountDec(); - m_objp = vlstd::exchange(moved.m_objp, nullptr); + m_objp = std::exchange(moved.m_objp, nullptr); return *this; } template @@ -1688,7 +1688,7 @@ public: VlClassRef& operator=(VlClassRef&& moved) { if (m_objp == moved.m_objp) return *this; refCountDec(); - m_objp = vlstd::exchange(moved.m_objp, nullptr); + m_objp = std::exchange(moved.m_objp, nullptr); return *this; } // Assign with nullptr diff --git a/src/V3Dfg.h b/src/V3Dfg.h index 4e1c23a22..79fdb3908 100644 --- a/src/V3Dfg.h +++ b/src/V3Dfg.h @@ -109,12 +109,12 @@ class DfgGraph final { // cppcheck-suppress noExplicitConstructor UserDataInUse(UserDataInUse&& that) { UASSERT(that.m_graphp, "Moving from empty"); - m_graphp = vlstd::exchange(that.m_graphp, nullptr); + m_graphp = std::exchange(that.m_graphp, nullptr); } VL_UNCOPYABLE(UserDataInUse); UserDataInUse& operator=(UserDataInUse&& that) { UASSERT(that.m_graphp, "Moving from empty"); - m_graphp = vlstd::exchange(that.m_graphp, nullptr); + m_graphp = std::exchange(that.m_graphp, nullptr); return *this; }