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
Post a Comment