mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-12-09 19:48:23 +00:00
The swap() function provided in the MathLib header was renamed to V_swap in recent Source SDK versions (e.g. 2013) to avoid causing ambiguity problems with std::swap(). But older SDK versions (such as TF2) lack this change, as they predate it. The ambiguity between MathLib's swap() and std::swap() causes considerable problems when using newer features of C++ (such as std::unique_ptr) which internally call swap() in an unqualified manner to implement move semantics: /usr/include/c++/5.2.0/bits/unique_ptr.h:342:6: error: call of overloaded ‘swap(MyType*&, MyType*&)’ is ambiguous /usr/include/c++/5.2.0/bits/move.h:176:5: note: candidate: void std::swap(_Tp&, _Tp&) [with _Tp = MyType*] hl2sdk-tf2/public/mathlib/mathlib.h:611:18: note: candidate: void swap(T&, T&) [with T = MyType*] This patch backports the swap() -> V_swap() rename from the 2013 SDK version to the TF2 SDK version, so that the TF2 SDK can be used in conjunction with C++11 features such as std::unique_ptr without difficulty. More information on why swap() isn't called in a namespace-qualified manner by standard library functions: http://en.cppreference.com/w/cpp/language/adl#Notes |
||
|---|---|---|
| .. | ||
| sdk_basegrenade_projectile.cpp | ||
| sdk_basegrenade_projectile.h | ||
| sdk_fx_shared.cpp | ||
| sdk_fx_shared.h | ||
| sdk_gamemovement.cpp | ||
| sdk_gamerules.cpp | ||
| sdk_gamerules.h | ||
| sdk_player_shared.cpp | ||
| sdk_playeranimstate.cpp | ||
| sdk_playeranimstate.h | ||
| sdk_shareddefs.h | ||
| sdk_usermessages.cpp | ||
| sdk_weapon_parse.cpp | ||
| sdk_weapon_parse.h | ||
| weapon_basesdkgrenade.cpp | ||
| weapon_basesdkgrenade.h | ||
| weapon_grenade.cpp | ||
| weapon_grenade.h | ||
| weapon_mp5.cpp | ||
| weapon_sdkbase.cpp | ||
| weapon_sdkbase.h | ||
| weapon_shotgun.cpp | ||