Boost logo

Boost :

Subject: Re: [boost] Interest in non-intrusive signal/slot lib?
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2015-05-18 18:37:31

On Mon, May 18, 2015 at 2:36 PM, Edward Diener <eldiener_at_[hidden]>

> On 5/18/2015 1:39 PM, Emil Dotchevski wrote:
>> On Mon, May 18, 2015 at 8:42 AM, Edward Diener <eldiener_at_[hidden]>
>> wrote:
>>> That's not where the confusion existed for me. Gavin Lambert explained
>>> why
>>> each signal must be a different type. I realized that a signal is a type,
>>> but not why the same signal could not be used for more than one event (
>>> button down, button up etc. ).
>> The signal *is* the event though. So I guess I still don't understand. If
>> you have two events, "button up" and "button down", then you need two
>> Synapse signals or else you wouldn't be able to tell them apart.
> Your synapse code evidently needs to tell them apart but from the
> end-user's perspective it isn't necessary, since the only thing he cares
> about is the parameter types being specified. If he has a signal of:
> typedef void (*button_signal)(int,int) ;
> why wouldn't he use it for both a button_up and a button_down event, since
> it has the correct number and type of parameters for both ?

I'm still trying to figure out what's the misunderstanding. Perhaps an
example will help, here is how you could use synapse::emit<> from a

typedef struct button_down_(*button_down)(int,int);
typedef struct button_up_(*button_up)(int,int);

WindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
    switch( uMsg )
    case WM_LBUTTONUP:

In your mind, how would the above look like such that you could use the
same type for both signals, assuming that you want different handlers
called depending on whether button_down or button_up was emitted?

Emil Dotchevski
Reverge Studios, Inc.

Boost list run by bdawes at, gregod at, cpdaniel at, john at