mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 13:13:36 +00:00
Added example from boost.
This commit is contained in:
parent
4f442cd8f3
commit
d50a0e63e6
@ -29,6 +29,9 @@ target_link_libraries (string_hash_map PRIVATE dbms)
|
||||
add_executable (string_hash_map_aggregation string_hash_map.cpp)
|
||||
target_link_libraries (string_hash_map_aggregation PRIVATE dbms)
|
||||
|
||||
add_executable (context context.cpp)
|
||||
target_link_libraries (context PRIVATE dbms)
|
||||
|
||||
add_executable (two_level_hash_map two_level_hash_map.cpp)
|
||||
target_include_directories (two_level_hash_map SYSTEM BEFORE PRIVATE ${SPARSEHASH_INCLUDE_DIR})
|
||||
target_link_libraries (two_level_hash_map PRIVATE dbms)
|
||||
|
26
src/Interpreters/tests/context.cpp
Normal file
26
src/Interpreters/tests/context.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
#include <boost/context/fiber.hpp>
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
namespace ctx=boost::context;
|
||||
int a;
|
||||
ctx::fiber source{[&a](ctx::fiber&& sink)
|
||||
{
|
||||
a=0;
|
||||
int b=1;
|
||||
while (true)
|
||||
{
|
||||
sink=std::move(sink).resume();
|
||||
int next=a+b;
|
||||
a=b;
|
||||
b=next;
|
||||
}
|
||||
return std::move(sink);
|
||||
}};
|
||||
for (int j=0;j<10;++j)
|
||||
{
|
||||
source=std::move(source).resume();
|
||||
std::cout << a << " ";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user