1 | #include <iostream> |
---|---|
2 | #include <common/SimpleCache.h> |
3 | |
4 | |
5 | static int func(int x, int y) |
6 | { |
7 | std::cerr << x << " + "<< y << "\n"; |
8 | return x + y; |
9 | } |
10 | |
11 | |
12 | int main(int, char **) |
13 | { |
14 | SimpleCache<decltype(func), &func> func_cached; |
15 | |
16 | std::cerr << func_cached(1, 2) << "\n"; |
17 | std::cerr << func_cached(1, 2) << "\n"; |
18 | std::cerr << func_cached(1, 2) << "\n"; |
19 | std::cerr << func_cached(3, 4) << "\n"; |
20 | std::cerr << func_cached(3, 4) << "\n"; |
21 | std::cerr << func_cached(3, 4) << "\n"; |
22 | } |
23 |