Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-10-20 07:58:23


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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net