2015-09-27 02:18:00 +00:00
|
|
|
#include <iostream>
|
2017-04-01 09:19:00 +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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char ** argv)
|
|
|
|
{
|
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
|
|
|
}
|