Boost logo

Boost Users :

From: mbrodeur65 (martin.brodeur_at_[hidden])
Date: 2008-08-29 11:05:22


Hi,

I'm having problem compiling this piece of code in VC++ 7.1. I don't know if
it is a bug in this environment but it compiles properly under gcc 3.4.4.

thanks for any help !!!

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

boost::signal<void (int)> m_signal;

struct Foo
{
    void test(int x) {}
};

template <typename C>
boost::signals::connection Subscribe(C* ptr,void (C::*callback)(int))
{
        return m_signal.connect(boost::bind(callback,ptr,_1));
}

int main()
{
        Foo f;
        Subscribe(&f, &Foo::test);
        return 0;
}

Here are the compiler errors:

c:\Program Files\boost\boost_1_34_1\boost\visit_each.hpp(25) : warning
C4675: 'void
boost::_bi::visit_each<Visitor,void,boost::_mfi::mf1<R,T,A1>,boost::_bi::list2<boost::_bi::list_av_2<C
*,A2>::B1,A2>>(V &,const boost::_bi::bind_t<R,F,L> &,int)' : resolved
overload was found by argument-dependent lookup
        with
        [
            Visitor=boost::signals::detail::bound_objects_visitor,
            R=void,
            T=Foo,
            A1=int,
            C=Foo,
            A2=boost::arg<1>,
            V=boost::signals::detail::bound_objects_visitor,
            F=boost::_mfi::mf1<void,Foo,int>,
            L=boost::_bi::list2<boost::_bi::list_av_2<Foo
*,boost::arg<1>>::B1,boost::_bi::list_av_2<Foo *,boost::arg<1>>::B2>
        ]
        c:\Program Files\boost\boost_1_34_1\boost\bind.hpp(1173) : see
declaration of 'boost::_bi::visit_each'
        c:\Program Files\boost\boost_1_34_1\boost\signals\slot.hpp(123) :
see reference to function template instantiation 'void
boost::visit_each<boost::signals::detail::bound_objects_visitor,F>(Visitor
&,const T &)' being compiled
        with
        [
           
F=boost::_bi::bind_t<void,boost::_mfi::mf1<void,Foo,int>,boost::_bi::list2<boost::_bi::list_av_2<Foo
*,boost::arg<1>>::B1,boost::_bi::list_av_2<Foo *,boost::arg<1>>::B2>>,
            Visitor=boost::signals::detail::bound_objects_visitor,
           
T=boost::_bi::bind_t<void,boost::_mfi::mf1<void,Foo,int>,boost::_bi::list2<boost::_bi::list_av_2<Foo
*,boost::arg<1>>::B1,boost::_bi::list_av_2<Foo *,boost::arg<1>>::B2>>
        ]
        c:\Documents and Settings\mbrodeur\My Documents\Visual Studio
Projects\testboost\testboost\testboost.cpp(16) : see reference to function
template instantiation
'boost::slot<SlotFunction>::slot<boost::_bi::bind_t<R,F,L>>(const
boost::_bi::bind_t<R,F,L> &)' being compiled
        with
        [
           
SlotFunction=boost::signal1<boost::detail::function_traits_helper<boost::add_pointer<void
(int)>::type>::result_type,boost::detail::function_traits_helper<boost::add_pointer<void
(int)>::type>::arg1_type,boost::last_value<void>,int,std::less<int>,boost::function<void
(int)>>::slot_function_type,
            R=void,
            F=boost::_mfi::mf1<void,Foo,int>,
            L=boost::_bi::list2<boost::_bi::list_av_2<Foo
*,boost::arg<1>>::B1,boost::_bi::list_av_2<Foo *,boost::arg<1>>::B2>
        ]
        c:\Documents and Settings\mbrodeur\My Documents\Visual Studio
Projects\testboost\testboost\testboost.cpp(22) : see reference to function
template instantiation 'boost::signals::connection Subscribe<Foo>(C *,void
(__thiscall Foo::* )(int))' being compiled
        with
        [
            C=Foo
        ]

thanks !

-- 
View this message in context: http://www.nabble.com/1.34.1%3A-boost-bind-issue-with-function-template-tp19221694p19221694.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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