Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct myStruct {
- public:
- int Sum(int i, int j) const{
- return (i + j);
- }
- };
- template <typename Func>
- int my_functor(Func f, int i, int j){
- f(i, j);
- }
- int main()
- {
- myStruct A;
- auto p = [&A](int i, int j){
- cout << A.Sum(i, j) << endl;
- };
- my_functor(p, 10, 20);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement