Subject: Re: [boost] [Bug Sprint] [variant] #2839 ambiguous swap call
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-06-03 18:02:26


AMDG

Daniel Hulme wrote:
> On Wed, Jun 03, 2009 at 07:38:51PM +0100, Joseph Gauterin wrote:
>
>>> I'm pretty sure the intent of the code is to replace the generic
>>> swap-by-copy-assignment std::swap template
>>>
>> The intent is to replace std::swap with a call a specialized swap (via
>> ADL) or to call boost::detail::move_swap::swap otherwise. std::swap
>> will never be called from that function, unless std::swap is picked up
>> by ADL - in which case it probably *is* specialized for the type being
>> swapped. By making boost::detail::move_swap::swap less specialized
>> than std::swap, you can stop the ambiguity that happens only in this
>> case.
>>
>
> OK, yes, I'll buy that. I'm not convinced that there is nothing in ::std
> without a std::swap specialization, but I guess I am convinced
> that for any of those things it makes no difference whether we call
> std::swap or detail::move_swap::swap. Maybe.
>

classes in namespace std are not a problem. In the worst case,
we could enumerate them. The real problem is that arbitrary user
defined types can have namespace std as an associated namespace.

In Christ,
Steven Watanabe