c++ - How are signal signatures in `boost::signals2` implemented? -


i have been using boost::signals2 time in projects. shame, still not understand how implemented under hood. problems start @ definition of signal. how definition such as

boost::signals2::signal< void (bool, double) >  

handled? can see implementation details signature becomes template parameter aptly named signature. however, not understand syntax. syntax permitted c++ standard? how can signal "store" function signature when provided in form?

i tried looking @ sources, unable find explanation syntax. appreciated.

yes, syntax allowed; type denotes reference function taking bool , double , returning void. if typedef it, awkward, because name sit in middle:

typedef void signature(bool, double); 

with new alias syntax becomes more readable:

using signature = void(bool, double); 

the parallel pointers functions be:

typedef void (*pointer)(bool, double);  using pointer = void (*)(bool, double); 

afterwards, there template tricks tease apart various elements (extract return type, , type of each argument).


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -