C++11 observer pattern (signals, slots, events, change broadcaster/listener, or whatever you want to call it)
问题 With the changes made in C++11 (such as the inclusion of std::bind ), is there a recommended way to implement a simple single-threaded observer pattern without dependence on anything external to the core language or standard library (like boost::signal )? EDIT If someone could post some code showing how dependence on boost::signal could be reduced using new language features, that would still be very useful. 回答1: I think that bind makes it easier to create slots (cfr. the 'preferred' syntax