CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
can I have something which accepts both:
std::function<void()> and std::function<bool()>
I actually had many argument to function also but that I am taking care by passing argument to std::find. How to handle return type of function so that bool function() and void function() is also allowed to get called
*/
#include <iostream>
#include <functional>
using namespace std;
void foo() {
cout << "from void foo()\n\n";
}
bool bar() {
cout << "from bool bar()\n";
return true;
}
int baz() {
cout << "from int baz()\n";
return 42;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run