Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost::variant] problem with swap
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-12-20 10:53:08


AMDG

Ondrej Kuncar wrote:
> I have problems to compile this code with Visual Studio 9.0 SP1 and
> Boost 1.41:
>
> -------------------------------------------------------------------
>
> #include <boost/variant.hpp>
> #include <deque>
>
> typedef boost::variant<std::deque<int>::iterator> SemanticValue;
>
> int main() {
> SemanticValue v1;
> SemanticValue v2;
> v1.swap(v2);
> }
>
> -------------------------------------------------------------------
>
> I got this error:
>
> c:\program files\boost\boost_1_41_0\boost\variant\detail\move.hpp(155) :
> error C2668: 'std::swap' : ambiguous call to overloaded function
> c:\program
> files\boost\boost_1_41_0\boost\variant\detail\move.hpp(141): could be
> 'void boost::detail::variant::detail::move_swap::swap<T>(T &,T &)'
> with
> [
> T=T0
> ]
> c:\program files\microsoft visual studio
> 9.0\vc\include\utility(16): or 'void std::swap<T>(_Ty &,_Ty &)'
> [found using argument-dependent lookup]
> with
> [
> T=T0,
> _Ty=T0
> ]
> while trying to match the argument list '(T0, T0)'
> <snip>
>
>
> Do you have any ideas?
>

This is a known bug. I believe that there's an open trac ticket
for it. I don't think anyone has found a good solution yet.

In Christ,
Steven Watanabe


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