#include #include void f() { std::cout << "::f()\n" ; } class SlotSet : public SlotSig::SlotsSetBase { public: void m() { std::cout << "SlotSet::m()\n" ; } void m2() { std::cout << "SlotSet::m2()\n" ; } } ; class OtherClass { public: virtual ~OtherClass() { } void m() { std::cout << "OtherClass::m()\n" ; } void m2() { std::cout << "OtherClass::m2()\n" ; } } ; int main (int argc, char* argv[]) { SlotSig::Sig0 sig ; SlotSet slot_set ; OtherClass other_class ; sig.connect(f) ; sig.connect(&slot_set, &SlotSet::m) ; sig.connect(&slot_set, &SlotSet::m2) ; sig.connect(&other_class, &OtherClass::m) ; sig.connect(&other_class, &OtherClass::m2) ; SlotSig::Sig0::const_iterator iter = sig.begin() ; while ( iter != sig.end() ) { SlotSig::Slot0* slot = *iter ; if ( slot != 0 ) { void* in_class = slot->in_class_void() ; std::cout << "Slot, in class " << in_class ; if ( in_class != 0 ) { if ( in_class == &slot_set ) std::cout << " SlotSet" ; else if ( in_class == &other_class ) std::cout << " OtherClass" ; else std::cout << " " ; SlotSig::SlotsSetBase * in_base = slot->in_base() ; if ( in_base == 0 ) std::cout << " (unmanaged)\n" ; else std::cout << " (SlotsSetBase-based)\n" ; } else { std::cout << " ==> it's a global function, " ; SlotSig::SlotGlobal0* slot_global = dynamic_cast*>(slot) ; std::cout << std::hex << (void*)(slot_global->the_slot()) << "\n" ; } } ++iter ; } SlotSig::about_to_delete(&other_class) ; return 0 ; }