使用 Objective-C 或者 Java 的都对其中的 delegate 方法印象很深,而在我们经常使用的 C++ 中虽然也有所谓的 Callback,但是似乎还挺麻烦的。有没有一个更好的实现方法呢?有的,国外的《Member Function Pointers and the Fastest Possible C++ Delegates》这篇文章就给了我们一个简单方便的实现库。 原理在作者的文章中已经讲得很详细了,我们这里简单讲一下使用方法: C++ #include <iostream> #include "FastDelegate.h" using namespace fastdelegate; // If you want...