Boost logo

Boost :

Subject: [boost] [move] abiguious ctor (msvc-10.0)
From: Oliver Kowalke (k-oli_at_[hidden])
Date: 2011-01-11 08:10:54


I get error C2668 with msvc-10.0 - (gcc.4.x works).
Any ideas?

1>test.cpp(44): error C2668: 'X::X': Mehrdeutiger Aufruf einer überladenen Funktion
1> test.cpp(19): kann 'X::X<boost::_bi::bind_t<R,F,L>>(Fn &&,size_t)' sein
1> with
1> [
1> R=void,
1> F=void (__cdecl *)(int),
1> L=boost::_bi::list1<boost::_bi::value<int>>,
1> Fn=boost::_bi::bind_t<void,void (__cdecl *)(int),boost::_bi::list1<boost::_bi::value<int>>>
1> ]
1> test.cpp(16): oder "X::X<boost::_bi::bind_t<R,F,L>>(Fn,size_t)"
1> with
1> [
1> R=void,
1> F=void (__cdecl *)(int),
1> L=boost::_bi::list1<boost::_bi::value<int>>,
1> Fn=boost::_bi::bind_t<void,void (__cdecl *)(int),boost::_bi::list1<boost::_bi::value<int>>>
1> ]
1> bei Anpassung der Argumentliste '(boost::_bi::bind_t<R,F,L>, int)'
1> with
1> [
1> R=void,
1> F=void (__cdecl *)(int),
1> L=boost::_bi::list1<boost::_bi::value<int>>
1> ]

test app:

#include <cstdlib>
#include <iostream>

#include <boost/bind.hpp>
#include <boost/move/move.hpp>

class X
{
private:
        BOOST_COPYABLE_AND_MOVABLE( X);

public:
        X() {}

        template< typename Fn >
        X( Fn fn, std::size_t i) {}

        template< typename Fn >
        X( BOOST_RV_REF( Fn) fn, std::size_t i) {}

        X( X const& other) {}

        X & operator=( BOOST_COPY_ASSIGN_REF( X) other)
        {
                X tmp( other);
                return * this;
        }

        X( BOOST_RV_REF( X) other) {}

        X & operator=( BOOST_RV_REF( X) other)
        {
                X tmp( boost::move( other) );
                return * this;
        }
};

void f( int) {}

int main()
{
        try
        {
                X x( boost::bind( f, 1), 1);

                return EXIT_SUCCESS;
        }
        catch ( std::exception const& e)
        { std::cerr << "exception: " << e.what() << std::endl; }
        catch (...)
        { std::cerr << "unhandled exception" << std::endl; }
        return EXIT_FAILURE;
}

-- 
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk