add example using std::function's and fix for #54