Re: [Boost-users] signals/slots and boost::functions

For those interested, It appears the reason was because of a compiler
error I hit, and didn't ask about, or really worry how to resolve it.
:-/
Function declaration:
typedef boost::function < VSSP ( std::string, EncodingEnum) >
CreateTypeFunc;
bool ElementBase::disconnectCreateTypeSignal(const CreateTypeFunc& slot)
{
LOG4CXX_DEBUG(logger_, "disconnectCreateTypeSignal in");
bool retValue = false;
createTypeSignal_.disconnect(slot);

AMDG david.weber@l-3com.com wrote:
For those interested, It appears the reason was because of a compiler error I hit, and didn't ask about, or really worry how to resolve it. :-/
Function declaration:
typedef boost::function < VSSP ( std::string, EncodingEnum) > CreateTypeFunc;
bool ElementBase::disconnectCreateTypeSignal(const CreateTypeFunc& slot) { LOG4CXX_DEBUG(logger_, "disconnectCreateTypeSignal in"); bool retValue = false;
createTypeSignal_.disconnect(slot);
Ah. If you can somehow know what type slot holds, then it would work. See http://www.boost.org/doc/html/function/faq.html#id2914032 In Christ, Steven Watanabe

Ah. If you can somehow know what type slot holds, then it would work. See http://www.boost.org/doc/html/function/faq.html#id2914032
Hrm. I read it, and understand the reasons why, but then I read this: "The Signals library has a way around this." I was wondering if you had any insight, and could elaborate further, as this is functionality that would make our implementation significantly simpler. We do have a well-defined function prototype, and all the code is being written as we speak, so it's simple enough to enforce certain restrictions to gain the functionality (if possible).

AMDG david.weber@l-3com.com wrote:
Ah. If you can somehow know what type slot holds, then it would work. See http://www.boost.org/doc/html/function/faq.html#id2914032
Hrm. I read it, and understand the reasons why, but then I read this: "The Signals library has a way around this."
I was wondering if you had any insight, and could elaborate further, as this is functionality that would make our implementation significantly simpler. We do have a well-defined function prototype, and all the code is being written as we speak, so it's simple enough to enforce certain restrictions to gain the functionality (if possible)
You have to know what the real type of the slot is when
you call disconnect. Unless you are passing a single
type of function pointer, you can template the connect
and disconnect functions. Here's an extremely simplified example.
#include
participants (2)
-
david.weber@l-3com.com
-
Steven Watanabe