Boost logo

Boost Users :

From: Brendan Miller (catphive.lists_at_[hidden])
Date: 2006-07-09 06:53:25


I'm relatively new to the boost library and I'm having a problem with
boost::signals and bind. I've reproduced the problem I'm hitting here.

c++:
typedef boost::signal <LRESULT (ISigSource &, LPCREATESTRUCT)>
 SigWMCreate;
SigWMCreate sig;
LPARAM x;

boost::bind(boost::ref(sig), boost::ref(*this), _1)((LPCREATESTRUCT)(x));

The above function application generates the following warning on msvc
8/vs2005:
Error 1 error C2664: '__w64 long boost::_bi::bind_t<R,F,L>::operator
()<LPCREATESTRUCT>(A1 &) const' : cannot convert parameter 1 from
'LPCREATESTRUCT' to 'LPCREATESTRUCT &' c:\documents and
settings\catphive\my documents\visual studio
2005\projects\game\game\mainfrm.cpp 20

Now, this problem goes away if x is of type LPCREATESTRUCT to start with
instead of another type converted to LPCREATESTRUCT within the parentheses
of the function application. This seems a bit odd to me. Also, I'd like to
avoid changing how the function application is performed and get to the root
of the problem since in my *actual* code, the application is performed in a
system macro, and I'd like to avoid changing external headers (and having to
remember what I changed in case of an update to the headers) if possible.

My guess is that performing the cast creates an intermediary result that I'm
not allowed to take a reference of. Is this the case? Does this happen on
other compilers with analogous types? Is there a way to work around this?

Thanks



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