问题
Suppose I have used sigc::bind
to construct a callback functor. Suppose I have registered that callback with another class -- in my case it's a scheduling class. At the right time, the scheduling class will call my callback, with all the correctly-bound arguments. And that works fine.
But suppose I want a debugging interface on that other class, that will give me my callbacks back (as data objects, that is, not by calling them). That is, in the case of the scheduling class, suppose I want a way to dump the schedule. It'd be straightforward, I think, to have the other class (the scheduling class) hand me back the same callbacks I handed it -- but what do I do with those callbacks? Even if I know I used sigc::bind
to bind together two or three arguments into each callback, how do I pick one apart to get my two or three things back?
I think I'm looking for something along the lines of sigc::unbind
, but I have no idea whether such a thing exists (or can exist), or even what to call it.
来源:https://stackoverflow.com/questions/57879245/sigc-unbind-or-deconstruct-a-functor