C++11: std::function and std::bind

std::function and std::bind were born inside the Boost C++ Library, but they were incorporated into the new C++11 standard.

std::function is a STL template class that provides a very convenient wrapper to a simple function, to a functor or to a lambda expression.

Continue reading “C++11: std::function and std::bind”

Advertisements

C++11: C++-style listener list

Consider you want to create a class where you can register a set of listeners to be notified when something occurs. For example, this is a class that performs some task and you want to be notified when the task has been completely executed. See this code in Java:
Continue reading “C++11: C++-style listener list”