mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-09 10:00:54 +00:00
23 lines
473 B
C++
23 lines
473 B
C++
|
#include <iostream>
|
||
|
#include <DB/Common/SimpleCache.h>
|
||
|
|
||
|
|
||
|
int func(int x, int y)
|
||
|
{
|
||
|
std::cerr << x << " + " << y << "\n";
|
||
|
return x + y;
|
||
|
}
|
||
|
|
||
|
|
||
|
int main(int argc, char ** argv)
|
||
|
{
|
||
|
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";
|
||
|
}
|