20 Oct
2004
20 Oct
'04
12:58 p.m.
Ewan Campbell wrote:
The MSVC++ 6.0 compiler implements swap like so:
template<class _Ty> inline void swap(_Ty& _X, _Ty& _Y) {_Ty _Tmp = _X; _X = _Y, _Y = _Tmp; }
The unreferenced local variable warning is referring to _Tmp. Since _Tmp is required to swap the variables, does this not indicate that this particular use of the swap function is redundant?
It may be redundant for a specific allocator type, but by commenting the swap() line you are eliminating the swap call for all possible allocator types, some of which may, indeed, need it.