2015-09-27 02:18:00 +00:00
|
|
|
#include <iostream>
|
2019-06-28 18:06:38 +00:00
|
|
|
#include <common/SimpleCache.h>
|
2015-09-27 02:18:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
int func(int x, int y)
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
std::cerr << x << " + " << y << "\n";
|
|
|
|
return x + y;
|
2015-09-27 02:18:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-12-01 17:49:12 +00:00
|
|
|
int main(int, char **)
|
2015-09-27 02:18:00 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
SimpleCache<decltype(func), &func> func_cached;
|
2015-09-27 02:18:00 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
std::cerr << func_cached(1, 2) << "\n";
|
|
|
|
std::cerr << func_cached(1, 2) << "\n";
|
|
|
|
std::cerr << func_cached(1, 2) << "\n";
|
|
|
|
std::cerr << func_cached(3, 4) << "\n";
|
|
|
|
std::cerr << func_cached(3, 4) << "\n";
|
|
|
|
std::cerr << func_cached(3, 4) << "\n";
|
2015-09-27 02:18:00 +00:00
|
|
|
}
|