Boost logo

Boost :

Subject: Re: [boost] [Bug Sprint] [variant] #2839 ambiguous swap call
From: Daniel Hulme (st_at_[hidden])
Date: 2009-06-03 17:51:56

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.

I think I will write an additional test case that checks a specialized
swap is being called if it exists, just to make me feel safer. I won't
be able to get round to this until Monday, though, as I'm out of town,
so if anyone wants to do it before then, I won't be offended. :-)

Thanks for all your help.

"Sometimes it's a Boat,  and sometimes it's more of an Accident.  It all
"Depends on what?"                                             depends."
"On whether I'm on the top of it or underneath it."
   -- A. A. Milne, ‘Winnie-the-Pooh’ 

Boost list run by bdawes at, gregod at, cpdaniel at, john at