int main() {
using namespace std::placeholders;
ApplyFunction(CreateCallback<LogCallback>(&MyLog));
Logger logger_;
auto f = std::bind(&Logger::log, &logger_, _1);
ApplyFunction(CreateCallback<LogCallback>(f));
ApplyFunction(CreateCallback<LogCallback>(std::bind(&Logger::clog, &logger_, _1)));
std::function<void(const char*)> ff = [](const char* message) { std::cout << "ff log: " << message << std::endl; };
ApplyFunction(CreateCallback<LogCallback>([](const char *message) {
std::cout << "ff log: " << message << std::endl;
}));
ApplyFunction(
CreateCallback<LogIntCallback>(std::bind(&Logger::log_int, &logger_, _1)),
CreateCallback<GetIntCallback>(std::bind(&Logger::get_number, &logger_))
);
auto m = std::mem_fn(&Logger::log);
auto mm = std::bind(m, &logger_, _1);
ApplyFunction(CreateCallback<LogCallback>(mm));
}
-
Notifications
You must be signed in to change notification settings - Fork 0
Playing callback game
License
michael-novikov/callbacks
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Playing callback game
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published