Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- auto dummy_lambda = []{};
- using lambda_type = decltype(dummy_lambda);
- template<typename F1, typename F2 = lambda_type const&>
- void foo(F1&& f1, F2&& f2 = dummy_lambda)
- {
- std::forward<F1>(f1)();
- std::forward<F2>(f2)();
- }
- void bar()
- {
- std::cout << "hello!\n";
- }
- int main(int, const char*[])
- {
- foo(&bar, &bar);
- foo(&bar);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement