There was an error while loading. Please reload this page.
1 parent e75fb44 commit 87948f9Copy full SHA for 87948f9
Dependencies/Utility/Utility/CppMacros.h
@@ -49,14 +49,17 @@
49
#define nullptr 0
50
#endif
51
52
-// TheSuperHackers @performance bobtista 25/11/2025 Helper to move-assign from reference: uses std::move in C++11, swap in C++98
+// Helper to move-assign from reference: uses std::move in C++11, swap in C++98
53
template<typename T>
54
inline void move_or_swap(T& dest, T& src)
55
{
56
#if __cplusplus >= 201103L
57
dest = std::move(src);
58
#else
59
-// Use swap to emulate move semantics for VC6 compatibility
+// C++03 fallback: mimic move semantics
60
+// dest gets src's value, src becomes empty
61
+T empty;
62
dest.swap(src);
63
+src.swap(empty);
64
65
}
0 commit comments