ClickHouse/dbms/src/Common/tests/simple_cache.cpp

23 lines
487 B
C++
Raw Normal View History

#include <iostream>
2019-06-28 18:06:38 +00:00
#include <common/SimpleCache.h>
int func(int x, int y)
{
std::cerr << x << " + " << y << "\n";
return x + y;
}
2017-12-01 17:49:12 +00:00
int main(int, char **)
{
SimpleCache<decltype(func), &func> func_cached;
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";
}