mbrodeur65 | 29 Aug 17:04

1.34.1: boost bind issue with function template


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;
}
(Continue reading)

Patrick Loney | 29 Aug 17:21

Re: 1.34.1: boost bind issue with function template


#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;
}

Builds fine under VC8; can you upgrade to 2005?

******************************************************************************

"This message and any attachments are solely for the intended recipient and may contain confidential and
privileged information. If you are not the intended recipient, any disclosure, copying, use, or
(Continue reading)

mbrodeur65 | 29 Aug 17:25

Re: 1.34.1: boost bind issue with function template


Unfortunately, I cannot, ... I must generate my binaries under vc++ 7.1.

thanks

Patrick Loney wrote:
> 
> 
> #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;
> }
(Continue reading)

Peter Dimov | 29 Aug 20:48

Re: 1.34.1: boost bind issue with function template

mbrodeur65:
>
> 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 !!!

...

> 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

I see no errors here, just a harmless warning. Am I missing something? 
mbrodeur65 | 29 Aug 21:01

Re: 1.34.1: boost bind issue with function template


Yes, you are right, there are only warnings. However, I'm a bit scared of
possible side effects. I usually prefer to eliminate them by adopting the
proper syntax, which obviously, I don't have.

thanks.
Martin

Peter Dimov-5 wrote:
> 
> mbrodeur65:
>>
>> 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 !!!
> 
> ...
> 
>> 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
> 
(Continue reading)

Peter Barker | 30 Aug 12:23

Re: 1.34.1: boost bind issue with function template

--- On Fri, 29/8/08, mbrodeur65 <martin.brodeur <at> adacelcanada.com> wrote:

> From: mbrodeur65 <martin.brodeur <at> adacelcanada.com>
> Subject: Re: [Boost-users] 1.34.1: boost bind issue with function template
> To: boost-users <at> lists.boost.org
> Date: Friday, 29 August, 2008, 8:01 PM
> Yes, you are right, there are only warnings. However,
> I'm a bit scared of
> possible side effects. I usually prefer to eliminate them
> by adopting the
> proper syntax, which obviously, I don't have.
> 
> thanks.
> Martin
> 
> 
> 
> Peter Dimov-5 wrote:
> > 
> > mbrodeur65:
> >>
> >> 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 !!!
(Continue reading)

David Abrahams | 30 Aug 19:36
Favicon
Gravatar

Re: 1.34.1: boost bind issue with function template


on Fri Aug 29 2008, mbrodeur65 <martin.brodeur-AT-adacelcanada.com> wrote:

> Yes, you are right, there are only warnings. However, I'm a bit scared of
> possible side effects. I usually prefer to eliminate them by adopting the
> proper syntax, which obviously, I don't have.

There's no syntax to turn that warning off other than some MSVC-specific
pragma.  What the warning is telling you is, "previous versions of MSVC
were non-conforming in that they didn't support argument-dependent
lookup.  This version supports it, so overload resolution may have found
a different overload with this version than it would have with a
previous one."  In other words, everything is working as it should now.

>>> 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
>> 
>> I see no errors here, just a harmless warning. Am I missing something? 
>> 
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users <at> lists.boost.org
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>> 
>> 

--

-- 
(Continue reading)


Gmane