example1_regular_functions.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#include <iostream>
#include <functional>

int add(int a, int b) {
    return a + b;
}

int main() {
    std::function<int(int, int)> func = add;
    std::cout << "Result: " << func(3, 4) << std::endl;
    return 0;
}
Back to std_function