SlideShare una empresa de Scribd logo
1 de 60
Descargar para leer sin conexión
Adding Async Algorithms to std
C++Russia, Санкт-Петербург
© 2016 Kirk Shoop (github twitter)
1
debounce
5
diagrams courtesy of André Staltz from rxmarbles
1 / 60
1
2 3 4 5 6
6
code (rxcpp)
asyncReadBytes() |
tap(printVectorOfBytes) |
concat_map(vectorOfStringsFromVectorOfBytes) |
group_by(groupFromString) |
flat_map(appendGroupStrings) |
subscribe(println(cout));
output (emscripten)
65 65 65 65 65 65 13 66 66 66 66
AAAAAA
66 66 66 66 66 66 66 66 66 66 66
66 66 13 67 67 67 67 67 67 67 13
BBBBBBBBBBBBBBBBB
CCCCCCC
68 68 68 68 68 68 68 68 68 68 68
68 68 68 13 69 69 69 69 69 69 69
DDDDDDDDDDDDDD
69 69 69 69 69 69 69 69 13
EEEEEEEEEEEEEEE
lines from bytes
© 2016 Kirk Shoop (github twitter) 2 / 60
code (rxcpp)
auto down$ = mousedown$("#window");
auto up$ = mouseup$("#window");
auto move$ = mousemove$("#window");
down$ |
flat_map([=](MouseEvent){
return move$ |
take_until(up$) |
map([](MouseEvent){return 1;}) |
start_with(0) |
sum();
}) |
map(
[](int c){
return to_string(c) + " moves while mouse down";
}) |
subscribe(println(cout));
output (emscripten)
2 moves while mouse down
moves while mouse button down
© 2016 Kirk Shoop (github twitter) 3 / 60
code (rxcpp)
struct data { int size; string firstLine;};
struct model {
map<string, data> store;
};
httpGet("http://kirkshoop.github.io/.../README.md") |
flat_map([](response_t r) {
return r.progress() |
combine_latest(
[=](progress_t p, vector<uint8_t> d){
return make_tuple(r.url(), p, d);
},
r.load()) |
scan(
model{},
updateModelFromTuple);
}) |
subscribe(println(cout));
output (emscripten)
README.md, 0
README.md, 0
README.md, 66
README.md, 66
здравствуйте!
bytes from http GET
© 2016 Kirk Shoop (github twitter) 4 / 60
© 2016 Kirk Shoop (github twitter)
1
combineLatest((x, y) => "" + x + y)
2D
5 / 60
A
1A
2
2A
B
2B
C
2C
D
3
3D
4
4D
5
5D
© 2016 Kirk Shoop (github twitter)
scan((x, y) => x + y)
6 / 60
1
1
2
3
3
6
4
10
5
15
© 2016 Kirk Shoop (github twitter) 7 / 60
why alogrithms?
documented
stable
optimized
descriptive
© 2016 Kirk Shoop (github twitter) 8 / 60
what do algorithms operate on?
© 2016 Kirk Shoop (github twitter) 9 / 60
sequences
© 2016 Kirk Shoop (github twitter) 10 / 60
in space
vector of mouse positions
generator of mouse positions
using mouseMoves = vector<tuple<int,int>>;
sequences
auto mouseMoves(int start, int end)
-> std::generator<tuple<int, int>> {
for(;start != end; ++start){
auto position = start * 100;
co_yield make_tuple(position, position);
}
}
© 2016 Kirk Shoop (github twitter)
0, 0 100, 100 200, 200 300, 300 400, 400
11 / 60
in time
mouse move events
network packets
auto window::mouseMoves()
-> async_generator<tuple<int, int>> {
for co_await(auto event : events()) {
if (event.id == MOUSEMOVE) {
co_yield mousePositionFrom(event);
}
}
}
auto socket::bytes()
-> async_generator<vector<byte>> {
vector<byte> out;
while (out = co_await read(. . .)) {
co_yield out;
}
}
sequences
© 2016 Kirk Shoop (github twitter) 12 / 60
what are the design options?
abstract the sequence or algorithm?
flow control using push or pull?
cancel by ommission or trigger?
chain algorithms using operator| or function nesting?
© 2016 Kirk Shoop (github twitter) 13 / 60
what designs allow async algorithms?
abstract flow cancel chain
sequence push trigger operator
© 2016 Kirk Shoop (github twitter) 14 / 60
© 2016 Kirk Shoop (github twitter) 15 / 60
what might a toy implementation based on these properties look like?
© 2016 Kirk Shoop (github twitter) 16 / 60
push sequence implementations
const auto ints = [](auto first, auto last){
return [=](auto r){
for(auto i=first;i <= last; ++i){
r(i);
}
};
};
const auto copy_if = [](auto pred){
return [=](auto dest){
return [=](auto v){
if (pred(v)) dest(v);
};
};
};
const auto printto = [](auto& output){
return [&](auto v) {
output << v << endl;
};
};
auto even = [](auto v){return (v % 2) == 0;};
push sequence concepts
struct sender
{
template<class Receiver>
void operator()(Receiver);
};
struct algorithm
{
template<class SenderV>
SenderV operator()(SenderV);
};
struct lifter
{
template<class ReceiverV>
ReceiverU operator()(ReceiverV);
};
struct receiver
{
template<class V>
void operator()(V);
};
© 2016 Kirk Shoop (github twitter) 17 / 60
code
ints(0, 9)(copy_if(even)(printto(cout)));
output (emscripten)
0
2
4
6
8
push sequence
© 2016 Kirk Shoop (github twitter) 18 / 60
code
ints(0, 9) |
copy_if(even) |
printto(cout);
output (emscripten)
0
2
4
6
8
push sequence
© 2016 Kirk Shoop (github twitter) 19 / 60
what needs to change to support last_or_default?
© 2016 Kirk Shoop (github twitter)
last
20 / 60
1 2 3 4
4
push sequence implementations
const auto last_or_default = [](auto def){
return [=](auto dest){
auto l = make_shared<decay_t<decltype(def)>>(def);
return make_receiver(
[=](auto v){
l = v;
},
[=](){
d(l);
d();
});
};
};
push sequence concepts
struct receiver
{
template<class V>
void operator()(V);
void operator()();
};
© 2016 Kirk Shoop (github twitter) 21 / 60
code
ints(0, 100000000) |
copy_if(even) |
last_or_default(42) |
printto(cout);
output (emscripten)
new ints
new copy_if
new last_or_default
new printto
new lifetime
last_or_default bound to dest
copy_if bound to dest
ints bound to dest
99999998
1 values received - done!
stopped
destructed
what needs to change to support last_or_default?
© 2016 Kirk Shoop (github twitter) 22 / 60
what needs to change to support take?
© 2016 Kirk Shoop (github twitter)
take(2)
23 / 60
1
1
2
2
3 4
push sequence implementations
const auto take = [](int n){
return [=](auto dest){
auto remaining = dest.lifetime.
template make_state<int>(n);
return make_receiver(dest, remaining,
[](auto& d, auto& r, auto v){
if (r-- == 0) {
d();
}
d(v);
});
};
};
push sequence concepts
struct subscription
{
using stopper = function<void()>;
bool is_stopped();
void stop();
void insert(subscription);
void erase(subscription);
void insert(stopper);
template<class Payload,
class... ArgN>
state<Payload>
make_state(ArgN... argn);
};
struct receiver
{
subscription lifetime;
template<class V>
void operator()(V);
void operator()();
};
© 2016 Kirk Shoop (github twitter) 24 / 60
code
async_ints(0, 9) |
copy_if(even) |
take(3) |
printto(cout);
output (emscripten)
new async_ints
new copy_if
new take
new printto
new lifetime
take bound to dest
copy_if bound to dest
async_ints bound to dest
0
2
4
3 values received - done!
stopped
destructed
what needs to change to support take?
© 2016 Kirk Shoop (github twitter) 25 / 60
what needs to change to support failure?
© 2016 Kirk Shoop (github twitter) 26 / 60
what needs to change to support failure?
struct receiver
{
subscription lifetime;
template<class V>
void operator()(V);
void operator()(exception_ptr);
void operator()();
};
© 2016 Kirk Shoop (github twitter) 27 / 60
code
async_ints(0, 9) |
copy_if(always_throw) |
take(3) |
printto(cout);
output (emscripten)
new async_ints
new copy_if
new take
new printto
new lifetime
take bound to dest
copy_if bound to dest
async_ints bound to dest
always throw!
stopped
destructed
what needs to change to support failure?
© 2016 Kirk Shoop (github twitter) 28 / 60
© 2016 Kirk Shoop (github twitter) 29 / 60
what needs to change to support delay?
© 2016 Kirk Shoop (github twitter)
1
delay
30 / 60
2 1
1 2 1
struct schedulable
: public worker
, public subscription {
void operator()();
};
struct worker {
steady_clock::time_point now();
void schedule(const schedulable& scbl);
void schedule(
steady_clock::time_point when,
const schedulable& scbl);
};
struct scheduler {
worker create_worker(subscription);
};
struct subscription {
void unsubscribe();
};
template<class T>
struct observer {
on_next(T);
on_error(exception_ptr);
on_completed();
};
template<class T>
struct subscriber
: public observer<T>
, public subscription {
};
template<class T>
struct observable {
subscription subscribe(subscriber<T>);
};
what needs to change to support delay?
© 2016 Kirk Shoop (github twitter) 31 / 60
code
interval(1s, scheduler) |
tap(printproduced) |
delay(1500ms, scheduler) |
take(5) |
subscribe(printemitted);
output (emscripten)
1.0s - 1 produced
2.0s - 2 produced
2.5s - 1 emitted
3.0s - 3 produced
3.5s - 2 emitted
4.0s - 4 produced
4.5s - 3 emitted
4.512s - real time elapsed
what needs to change to support delay?
© 2016 Kirk Shoop (github twitter) 32 / 60
what needs to change to support testing?
© 2016 Kirk Shoop (github twitter) 33 / 60
struct test_worker {
steady_clock::time_point now();
void schedule(const schedulable& scbl);
void schedule(
steady_clock::time_point when,
const schedulable& scbl);
void advance_to(long time) const;
void advance_by(long time) const;
void sleep(long time) const;
template<class T, class F>
auto start(F createSource, long created,
long subscribed, long unsubscribed) const
-> subscriber<T, testable_observer<T>>;
};
what needs to change to support testing?
struct recorded {
steady_clock::time_point time() const;
template<class Observer>
virtual accept(const Observer& o) const;
};
struct test {
using messages_t vector<recorded>;
steady_clock::time_point now() const;
test_worker create_worker(subscription cs) const
template<class T>
auto make_hot_observable(messages_t m) const
-> testable_observable<T>;
template<class T>
auto make_cold_observable(messages_t m) const;
-> testable_observable<T>;
};
© 2016 Kirk Shoop (github twitter) 34 / 60
code
auto scheduler = make_test();
auto worker = scheduler.create_worker();
auto interval$ = scheduler.make_hot_observable({
on.next(1000, 1),
on.next(2000, 2),
on.next(3000, 3),
on.next(4000, 4)
});
auto res = worker.start([&]() {
return interval$ |
tap(printproduced) |
delay(1500ms, scheduler) |
take(3) |
tap(printemitted);
});
output (emscripten)
1.0s - 1 produced
2.0s - 2 produced
2.5s - 1 emitted
3.0s - 3 produced
3.5s - 2 emitted
4.0s - 4 produced
4.5s - 3 emitted
0.026s - real time elapsed
emitted value test - SUCCEEDED
lifetime test - SUCCEEDED
what needs to change to support testing?
© 2016 Kirk Shoop (github twitter) 35 / 60
what needs to change to support testing?
auto required = rxu::to_vector({
on.next(1000 + 1500, 1),
on.next(2000 + 1500, 2),
on.next(3000 + 1500, 3)
});
auto actual = res.get_observer().messages();
cout << "emitted value test";
if (required == actual) {
cout << " - SUCCEEDED" << endl;
} else {
cout << " - FAILED" << endl;
cout << "REQUIRED: " << required << endl;
cout << "ACTUAL : " << actual << endl;
}
© 2016 Kirk Shoop (github twitter) 36 / 60
© 2016 Kirk Shoop (github twitter) 37 / 60
what designs do other combinations produce?
© 2016 Kirk Shoop (github twitter) 38 / 60
async_generator
abstract flow cancel chain
sequence pull trigger operator
© 2016 Kirk Shoop (github twitter) 39 / 60
template<class T>
struct await_iterator {
bool await_ready();
void await_suspend(coroutine_handle<>);
async_iterator<T> await_resume();
};
template<class T>
struct async_iterator {
T& operator*();
await_iterator<T> operator++();
};
template<class T>
struct async_generator {
await_iterator<T> begin();
async_iterator<T> end();
};
async_generator
abstract flow cancel chain
sequence pull trigger operator
async_generator concepts
© 2016 Kirk Shoop (github twitter) 40 / 60
async_generator
abstract flow cancel chain
sequence pull trigger operator
implement filter operator
template<typename T, typename P>
async_generator<T> filter(async_generator<T> s, P pred) {
for co_await(auto&& v : s) {
if (pred(v)) {
co_yield v;
}
}
}
© 2016 Kirk Shoop (github twitter) 41 / 60
async_generator
abstract flow cancel chain
sequence pull trigger operator
use operators to chain algorithms together
auto fiveOddInts = tempSensor() |
filter([](int n) { return n % 2 == 0; }) | // discard even
take(5); // stop after 5
for co_await(auto n : fiveOddInts) {
// . . .
}
© 2016 Kirk Shoop (github twitter) 42 / 60
sfrp
abstract flow cancel chain
sequence pull omission function
© 2016 Kirk Shoop (github twitter) 43 / 60
sfrp
abstract flow cancel chain
sequence pull omission function
example
template <typename R, typename Args...>
Behavior<R>
map(function<R(Args...)> func, Behavior<Args>... behaviors);
Behavior<Drawing>
circleFollowsMouse(Behavior<Point2D> mousePos) {
return map(circleAt, mousePos);
}
© 2016 Kirk Shoop (github twitter) 44 / 60
Спасибо!
I enjoyed visiting with you in
Санкт-Петербург!
© 2016 Kirk Shoop (github twitter) 45 / 60
complete.
questions?
© 2016 Kirk Shoop (github twitter)
20
merge
20
46 / 60
40
40
60
60
1
1
80
80
100
100
1
1
© 2016 Kirk Shoop (github twitter) 47 / 60
range-v3
abstract flow cancel chain
sequence pull omission operator
© 2016 Kirk Shoop (github twitter) 48 / 60
range-v3
abstract flow cancel chain
sequence pull omission operator
the range concept
template<class Iterator, class EndIterator = Iterator>
struct range {
Iterator begin();
EndIterator end();
};
© 2016 Kirk Shoop (github twitter) 49 / 60
range-v3 - implement the transform view
// A class that adapts an existing range with a function
template<class Rng, class Fun>
class transform_view : public view_adaptor<transform_view<Rng, Fun>, Rng>
{
class adaptor : public adaptor_base
{
// . . .
auto get(range_iterator_t<Rng> it) const -> decltype(fun_(*it)) {
return fun_(*it);
}
};
adaptor begin_adaptor() const { return {fun_}; }
adaptor end_adaptor() const { return {fun_}; }
// . . .
};
template<class Rng, class Fun>
transform_view<Rng, Fun> transform(Rng && rng, Fun fun) {
return {std::forward<Rng>(rng), std::move(fun)};
}
© 2016 Kirk Shoop (github twitter) 50 / 60
range-v3
abstract flow cancel chain
sequence pull omission operator
use operators to chain algorithms together
auto fiveOddInts = view::ints(0) | //generates next int when asked
view::remove_if([](int n) { return n % 2 == 0; }) | // discard even ints
view::take(5); // stop after 5
auto result = fiveOddInts | view::to_vector;
© 2016 Kirk Shoop (github twitter) 51 / 60
Transducers
abstract flow cancel chain
algorithm push omission function
© 2016 Kirk Shoop (github twitter) 52 / 60
Transducers
abstract flow cancel chain
algorithm push omission function
the step function
struct transducer {
template<class NextStep>
struct step {
template<class State, class T>
auto operator()(State state, T v);
template<class State>
auto operator()(State state);
};
template<class NextStep>
auto operator()(NextStep nextstep) {
return step<NextStep>(nextstep);
}
}; © 2016 Kirk Shoop (github twitter) 53 / 60
Transducers
abstract flow cancel chain
algorithm push omission function
implement the filterer transducer
auto filterer = [](auto pred) {
return [=](auto step) {
return stateless(
[=](auto s, auto v) {
if (pred(v)) {return step(s, v);}
return s;
},
[=](auto s){
return step(s);
});
};
};
© 2016 Kirk Shoop (github twitter) 54 / 60
Transducers
abstract flow cancel chain
algorithm push omission function
use function nesting to chain algorithms together
auto fiveOddInts = comp(
filter([](int n) { return n % 2 == 0; }), // discard even
take(5)); // stop after 5
auto result = into(vector<int> {}, fiveOddInts, range(0, 10));
© 2016 Kirk Shoop (github twitter) 55 / 60
rxcpp
abstract flow cancel chain
sequence push trigger operator
© 2016 Kirk Shoop (github twitter) 56 / 60
struct schedulable
: public worker
, public subscription {
void operator()();
};
struct worker {
steady_clock::time_point now();
void schedule(const schedulable& scbl);
void schedule(
steady_clock::time_point when,
const schedulable& scbl);
};
struct scheduler {
worker create_worker(subscription);
};
struct subscription {
void unsubscribe();
};
template<class T>
struct observer {
on_next(T);
on_error(std::exception_ptr);
on_completed();
};
template<class T>
struct subscriber
: public observer<T>
, public subscription {
};
template<class T>
struct observable {
subscription subscribe(subscriber<T>);
};
concepts in rxcpp
© 2016 Kirk Shoop (github twitter) 57 / 60
rxcpp - implement the filter operator
auto filter = [](auto pred) {
return [=](auto subscriber) {
return make_subscriber(
[=](auto v) {
if (pred(v)) {
subscriber.on_next(v);
}
},
[=](std::exception_ptr ep) {
subscriber.on_error(ep);
},
[=]() {
subscriber.on_completed();
}
);
}
};
© 2016 Kirk Shoop (github twitter) 58 / 60
rxcpp
abstract flow cancel chain
sequence push trigger operator
use operators to chain algorithms together
auto fiveOddInts = tempSensor() |
filter([](int n) { return n % 2 == 0; }) | // discard even
take(5); // stop after 5
fiveOddInts.subscribe([](int n){. . .});
© 2016 Kirk Shoop (github twitter) 59 / 60
© 2016 Kirk Shoop (github twitter) 60 / 60

Más contenido relacionado

La actualidad más candente

C++20 the small things - Timur Doumler
C++20 the small things - Timur DoumlerC++20 the small things - Timur Doumler
C++20 the small things - Timur Doumlercorehard_by
 
Virtual machine and javascript engine
Virtual machine and javascript engineVirtual machine and javascript engine
Virtual machine and javascript engineDuoyi Wu
 
Алексей Кутумов, Вектор с нуля
Алексей Кутумов, Вектор с нуляАлексей Кутумов, Вектор с нуля
Алексей Кутумов, Вектор с нуляSergey Platonov
 
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015NAVER / MusicPlatform
 
Fuzzing: The New Unit Testing
Fuzzing: The New Unit TestingFuzzing: The New Unit Testing
Fuzzing: The New Unit TestingDmitry Vyukov
 
Дмитрий Демчук. Кроссплатформенный краш-репорт
Дмитрий Демчук. Кроссплатформенный краш-репортДмитрий Демчук. Кроссплатформенный краш-репорт
Дмитрий Демчук. Кроссплатформенный краш-репортSergey Platonov
 
Антон Нонко, Классические строки в C++
Антон Нонко, Классические строки в C++Антон Нонко, Классические строки в C++
Антон Нонко, Классические строки в C++Sergey Platonov
 
Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJSstefanmayer13
 
PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...Andrey Karpov
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The LandingHaci Murat Yaman
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in JavaDoug Hawkins
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesAndrey Karpov
 
Работа с реляционными базами данных в C++
Работа с реляционными базами данных в C++Работа с реляционными базами данных в C++
Работа с реляционными базами данных в C++corehard_by
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013aleks-f
 
Алексей Кутумов, Coroutines everywhere
Алексей Кутумов, Coroutines everywhereАлексей Кутумов, Coroutines everywhere
Алексей Кутумов, Coroutines everywhereSergey Platonov
 
Cascadia.js: Don't Cross the Streams
Cascadia.js: Don't Cross the StreamsCascadia.js: Don't Cross the Streams
Cascadia.js: Don't Cross the Streamsmattpodwysocki
 
How to make a large C++-code base manageable
How to make a large C++-code base manageableHow to make a large C++-code base manageable
How to make a large C++-code base manageablecorehard_by
 

La actualidad más candente (20)

C++20 the small things - Timur Doumler
C++20 the small things - Timur DoumlerC++20 the small things - Timur Doumler
C++20 the small things - Timur Doumler
 
Joel Falcou, Boost.SIMD
Joel Falcou, Boost.SIMDJoel Falcou, Boost.SIMD
Joel Falcou, Boost.SIMD
 
Virtual machine and javascript engine
Virtual machine and javascript engineVirtual machine and javascript engine
Virtual machine and javascript engine
 
Алексей Кутумов, Вектор с нуля
Алексей Кутумов, Вектор с нуляАлексей Кутумов, Вектор с нуля
Алексей Кутумов, Вектор с нуля
 
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
서버 개발자가 바라 본 Functional Reactive Programming with RxJava - SpringCamp2015
 
Fuzzing: The New Unit Testing
Fuzzing: The New Unit TestingFuzzing: The New Unit Testing
Fuzzing: The New Unit Testing
 
Дмитрий Демчук. Кроссплатформенный краш-репорт
Дмитрий Демчук. Кроссплатформенный краш-репортДмитрий Демчук. Кроссплатформенный краш-репорт
Дмитрий Демчук. Кроссплатформенный краш-репорт
 
Антон Нонко, Классические строки в C++
Антон Нонко, Классические строки в C++Антон Нонко, Классические строки в C++
Антон Нонко, Классические строки в C++
 
Functional Reactive Programming with RxJS
Functional Reactive Programming with RxJSFunctional Reactive Programming with RxJS
Functional Reactive Programming with RxJS
 
PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...
 
Node.js System: The Landing
Node.js System: The LandingNode.js System: The Landing
Node.js System: The Landing
 
TensorFlow XLA RPC
TensorFlow XLA RPCTensorFlow XLA RPC
TensorFlow XLA RPC
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in Java
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' Mistakes
 
Работа с реляционными базами данных в C++
Работа с реляционными базами данных в C++Работа с реляционными базами данных в C++
Работа с реляционными базами данных в C++
 
Qt Rest Server
Qt Rest ServerQt Rest Server
Qt Rest Server
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013
 
Алексей Кутумов, Coroutines everywhere
Алексей Кутумов, Coroutines everywhereАлексей Кутумов, Coroutines everywhere
Алексей Кутумов, Coroutines everywhere
 
Cascadia.js: Don't Cross the Streams
Cascadia.js: Don't Cross the StreamsCascadia.js: Don't Cross the Streams
Cascadia.js: Don't Cross the Streams
 
How to make a large C++-code base manageable
How to make a large C++-code base manageableHow to make a large C++-code base manageable
How to make a large C++-code base manageable
 

Destacado

Для чего мы делали свой акторный фреймворк и что из этого вышло?
Для чего мы делали свой акторный фреймворк и что из этого вышло?Для чего мы делали свой акторный фреймворк и что из этого вышло?
Для чего мы делали свой акторный фреймворк и что из этого вышло?Yauheni Akhotnikau
 
Борис Сазонов, RAII потоки и CancellationToken в C++
Борис Сазонов, RAII потоки и CancellationToken в C++Борис Сазонов, RAII потоки и CancellationToken в C++
Борис Сазонов, RAII потоки и CancellationToken в C++Sergey Platonov
 
Григорий Демченко, Универсальный адаптер
Григорий Демченко, Универсальный адаптерГригорий Демченко, Универсальный адаптер
Григорий Демченко, Универсальный адаптерSergey Platonov
 
Использование юнит-тестов для повышения качества разработки
Использование юнит-тестов для повышения качества разработкиИспользование юнит-тестов для повышения качества разработки
Использование юнит-тестов для повышения качества разработкиvictor-yastrebov
 
Евгений Рыжков, Андрей Карпов Как потратить 10 лет на разработку анализатора ...
Евгений Рыжков, Андрей Карпов Как потратить 10 лет на разработку анализатора ...Евгений Рыжков, Андрей Карпов Как потратить 10 лет на разработку анализатора ...
Евгений Рыжков, Андрей Карпов Как потратить 10 лет на разработку анализатора ...Platonov Sergey
 
Сергей Шамбир, Адаптация Promise/A+ для взаимодействия между C++ и Javascript
Сергей Шамбир, Адаптация Promise/A+ для взаимодействия между C++ и JavascriptСергей Шамбир, Адаптация Promise/A+ для взаимодействия между C++ и Javascript
Сергей Шамбир, Адаптация Promise/A+ для взаимодействия между C++ и JavascriptSergey Platonov
 
Полухин Антон, Как делать не надо: C++ велосипедостроение для профессионалов
Полухин Антон, Как делать не надо: C++ велосипедостроение для профессионаловПолухин Антон, Как делать не надо: C++ велосипедостроение для профессионалов
Полухин Антон, Как делать не надо: C++ велосипедостроение для профессионаловSergey Platonov
 
Догнать и перегнать boost::lexical_cast
Догнать и перегнать boost::lexical_castДогнать и перегнать boost::lexical_cast
Догнать и перегнать boost::lexical_castRoman Orlov
 
Алексей Кутумов, C++ без исключений, часть 3
Алексей Кутумов,  C++ без исключений, часть 3Алексей Кутумов,  C++ без исключений, часть 3
Алексей Кутумов, C++ без исключений, часть 3Platonov Sergey
 
Фитнес для вашего кода: как держать его в форме
Фитнес для вашего кода: как держать его в формеФитнес для вашего кода: как держать его в форме
Фитнес для вашего кода: как держать его в формеIlia Shishkov
 
C++ Core Guidelines
C++ Core Guidelines C++ Core Guidelines
C++ Core Guidelines Sergey Zubkov
 
Quality assurance of large c++ projects
Quality assurance of large c++ projectsQuality assurance of large c++ projects
Quality assurance of large c++ projectscorehard_by
 
Повседневный С++: алгоритмы и итераторы @ C++ Russia 2017
Повседневный С++: алгоритмы и итераторы @ C++ Russia 2017Повседневный С++: алгоритмы и итераторы @ C++ Russia 2017
Повседневный С++: алгоритмы и итераторы @ C++ Russia 2017Mikhail Matrosov
 
Василий Сорокин, Простой REST сервер на Qt с рефлексией
Василий Сорокин, Простой REST сервер на Qt с рефлексиейВасилий Сорокин, Простой REST сервер на Qt с рефлексией
Василий Сорокин, Простой REST сервер на Qt с рефлексиейSergey Platonov
 

Destacado (15)

Для чего мы делали свой акторный фреймворк и что из этого вышло?
Для чего мы делали свой акторный фреймворк и что из этого вышло?Для чего мы делали свой акторный фреймворк и что из этого вышло?
Для чего мы делали свой акторный фреймворк и что из этого вышло?
 
Борис Сазонов, RAII потоки и CancellationToken в C++
Борис Сазонов, RAII потоки и CancellationToken в C++Борис Сазонов, RAII потоки и CancellationToken в C++
Борис Сазонов, RAII потоки и CancellationToken в C++
 
Григорий Демченко, Универсальный адаптер
Григорий Демченко, Универсальный адаптерГригорий Демченко, Универсальный адаптер
Григорий Демченко, Универсальный адаптер
 
Использование юнит-тестов для повышения качества разработки
Использование юнит-тестов для повышения качества разработкиИспользование юнит-тестов для повышения качества разработки
Использование юнит-тестов для повышения качества разработки
 
Евгений Рыжков, Андрей Карпов Как потратить 10 лет на разработку анализатора ...
Евгений Рыжков, Андрей Карпов Как потратить 10 лет на разработку анализатора ...Евгений Рыжков, Андрей Карпов Как потратить 10 лет на разработку анализатора ...
Евгений Рыжков, Андрей Карпов Как потратить 10 лет на разработку анализатора ...
 
Сергей Шамбир, Адаптация Promise/A+ для взаимодействия между C++ и Javascript
Сергей Шамбир, Адаптация Promise/A+ для взаимодействия между C++ и JavascriptСергей Шамбир, Адаптация Promise/A+ для взаимодействия между C++ и Javascript
Сергей Шамбир, Адаптация Promise/A+ для взаимодействия между C++ и Javascript
 
Parallel STL
Parallel STLParallel STL
Parallel STL
 
Полухин Антон, Как делать не надо: C++ велосипедостроение для профессионалов
Полухин Антон, Как делать не надо: C++ велосипедостроение для профессионаловПолухин Антон, Как делать не надо: C++ велосипедостроение для профессионалов
Полухин Антон, Как делать не надо: C++ велосипедостроение для профессионалов
 
Догнать и перегнать boost::lexical_cast
Догнать и перегнать boost::lexical_castДогнать и перегнать boost::lexical_cast
Догнать и перегнать boost::lexical_cast
 
Алексей Кутумов, C++ без исключений, часть 3
Алексей Кутумов,  C++ без исключений, часть 3Алексей Кутумов,  C++ без исключений, часть 3
Алексей Кутумов, C++ без исключений, часть 3
 
Фитнес для вашего кода: как держать его в форме
Фитнес для вашего кода: как держать его в формеФитнес для вашего кода: как держать его в форме
Фитнес для вашего кода: как держать его в форме
 
C++ Core Guidelines
C++ Core Guidelines C++ Core Guidelines
C++ Core Guidelines
 
Quality assurance of large c++ projects
Quality assurance of large c++ projectsQuality assurance of large c++ projects
Quality assurance of large c++ projects
 
Повседневный С++: алгоритмы и итераторы @ C++ Russia 2017
Повседневный С++: алгоритмы и итераторы @ C++ Russia 2017Повседневный С++: алгоритмы и итераторы @ C++ Russia 2017
Повседневный С++: алгоритмы и итераторы @ C++ Russia 2017
 
Василий Сорокин, Простой REST сервер на Qt с рефлексией
Василий Сорокин, Простой REST сервер на Qt с рефлексиейВасилий Сорокин, Простой REST сервер на Qt с рефлексией
Василий Сорокин, Простой REST сервер на Qt с рефлексией
 

Similar a Adding Async Algorithms to std C

NetPonto - The Future Of C# - NetConf Edition
NetPonto - The Future Of C# - NetConf EditionNetPonto - The Future Of C# - NetConf Edition
NetPonto - The Future Of C# - NetConf EditionPaulo Morgado
 
Use of django at jolt online v3
Use of django at jolt online v3Use of django at jolt online v3
Use of django at jolt online v3Jaime Buelta
 
RxJava applied [JavaDay Kyiv 2016]
RxJava applied [JavaDay Kyiv 2016]RxJava applied [JavaDay Kyiv 2016]
RxJava applied [JavaDay Kyiv 2016]Igor Lozynskyi
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoinknight1128
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomyDongmin Yu
 
Angular and The Case for RxJS
Angular and The Case for RxJSAngular and The Case for RxJS
Angular and The Case for RxJSSandi Barr
 
Unit testing en iOS @ MobileCon Galicia
Unit testing en iOS @ MobileCon GaliciaUnit testing en iOS @ MobileCon Galicia
Unit testing en iOS @ MobileCon GaliciaRobot Media
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기NAVER D2
 
Counter Wars (JEEConf 2016)
Counter Wars (JEEConf 2016)Counter Wars (JEEConf 2016)
Counter Wars (JEEConf 2016)Alexey Fyodorov
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningCarol McDonald
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015Michiel Borkent
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerLocks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerJAX London
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Michael Barker
 
.gradle 파일 정독해보기
.gradle 파일 정독해보기.gradle 파일 정독해보기
.gradle 파일 정독해보기경주 전
 
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Víctor Bolinches
 
Hands on clang-format
Hands on clang-formatHands on clang-format
Hands on clang-formatKai Wolf
 
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockRobot Media
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityBrendan Gregg
 

Similar a Adding Async Algorithms to std C (20)

NetPonto - The Future Of C# - NetConf Edition
NetPonto - The Future Of C# - NetConf EditionNetPonto - The Future Of C# - NetConf Edition
NetPonto - The Future Of C# - NetConf Edition
 
Verifikation - Metoder og Libraries
Verifikation - Metoder og LibrariesVerifikation - Metoder og Libraries
Verifikation - Metoder og Libraries
 
Use of django at jolt online v3
Use of django at jolt online v3Use of django at jolt online v3
Use of django at jolt online v3
 
RxJava applied [JavaDay Kyiv 2016]
RxJava applied [JavaDay Kyiv 2016]RxJava applied [JavaDay Kyiv 2016]
RxJava applied [JavaDay Kyiv 2016]
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoin
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomy
 
Angular and The Case for RxJS
Angular and The Case for RxJSAngular and The Case for RxJS
Angular and The Case for RxJS
 
Unit testing en iOS @ MobileCon Galicia
Unit testing en iOS @ MobileCon GaliciaUnit testing en iOS @ MobileCon Galicia
Unit testing en iOS @ MobileCon Galicia
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기
 
Counter Wars (JEEConf 2016)
Counter Wars (JEEConf 2016)Counter Wars (JEEConf 2016)
Counter Wars (JEEConf 2016)
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerLocks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael Barker
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!
 
.gradle 파일 정독해보기
.gradle 파일 정독해보기.gradle 파일 정독해보기
.gradle 파일 정독해보기
 
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
Paradigma FP y OOP usando técnicas avanzadas de Programación | Programacion A...
 
Hands on clang-format
Hands on clang-formatHands on clang-format
Hands on clang-format
 
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
LSFMM 2019 BPF Observability
LSFMM 2019 BPF ObservabilityLSFMM 2019 BPF Observability
LSFMM 2019 BPF Observability
 

Más de Sergey Platonov

Лев Казаркин, Удивительные приключения регистров SSE или в поисках одного бага
Лев Казаркин, Удивительные приключения регистров SSE или в поисках одного багаЛев Казаркин, Удивительные приключения регистров SSE или в поисках одного бага
Лев Казаркин, Удивительные приключения регистров SSE или в поисках одного багаSergey Platonov
 
Павел Филонов, Разделяй и управляй вместе с Conan.io
Павел Филонов, Разделяй и управляй вместе с Conan.ioПавел Филонов, Разделяй и управляй вместе с Conan.io
Павел Филонов, Разделяй и управляй вместе с Conan.ioSergey Platonov
 
Григорий Демченко, Асинхронность и неблокирующая синхронизация
Григорий Демченко, Асинхронность и неблокирующая синхронизацияГригорий Демченко, Асинхронность и неблокирующая синхронизация
Григорий Демченко, Асинхронность и неблокирующая синхронизацияSergey Platonov
 
Антон Полухин. C++17
Антон Полухин. C++17Антон Полухин. C++17
Антон Полухин. C++17Sergey Platonov
 
Павел Беликов, Как избежать ошибок, используя современный C++
Павел Беликов, Как избежать ошибок, используя современный C++Павел Беликов, Как избежать ошибок, используя современный C++
Павел Беликов, Как избежать ошибок, используя современный C++Sergey Platonov
 
Денис Кандров, Пушкова Евгения, QSpec: тестирование графических приложений на Qt
Денис Кандров, Пушкова Евгения, QSpec: тестирование графических приложений на QtДенис Кандров, Пушкова Евгения, QSpec: тестирование графических приложений на Qt
Денис Кандров, Пушкова Евгения, QSpec: тестирование графических приложений на QtSergey Platonov
 
Александр Тарасенко, Использование python для автоматизации отладки С/C++ код...
Александр Тарасенко, Использование python для автоматизации отладки С/C++ код...Александр Тарасенко, Использование python для автоматизации отладки С/C++ код...
Александр Тарасенко, Использование python для автоматизации отладки С/C++ код...Sergey Platonov
 
Павел Довгалюк, Обратная отладка
Павел Довгалюк, Обратная отладкаПавел Довгалюк, Обратная отладка
Павел Довгалюк, Обратная отладкаSergey Platonov
 
Никита Глушков, К вопросу о реализации кроссплатформенных фреймворков
Никита Глушков, К вопросу о реализации кроссплатформенных фреймворковНикита Глушков, К вопросу о реализации кроссплатформенных фреймворков
Никита Глушков, К вопросу о реализации кроссплатформенных фреймворковSergey Platonov
 
Dori Exterman, Considerations for choosing the parallel computing strategy th...
Dori Exterman, Considerations for choosing the parallel computing strategy th...Dori Exterman, Considerations for choosing the parallel computing strategy th...
Dori Exterman, Considerations for choosing the parallel computing strategy th...Sergey Platonov
 
Александр Фокин, Рефлексия в C++
Александр Фокин, Рефлексия в C++Александр Фокин, Рефлексия в C++
Александр Фокин, Рефлексия в C++Sergey Platonov
 
Михаил Матросов, Повседневный С++: boost и STL
Михаил Матросов, Повседневный С++: boost и STLМихаил Матросов, Повседневный С++: boost и STL
Михаил Матросов, Повседневный С++: boost и STLSergey Platonov
 
Илья Шишков, Принципы создания тестируемого кода
Илья Шишков, Принципы создания тестируемого кодаИлья Шишков, Принципы создания тестируемого кода
Илья Шишков, Принципы создания тестируемого кодаSergey Platonov
 
Антон Наумович, Система автоматической крэш-аналитики своими средствами
Антон Наумович, Система автоматической крэш-аналитики своими средствамиАнтон Наумович, Система автоматической крэш-аналитики своими средствами
Антон Наумович, Система автоматической крэш-аналитики своими средствамиSergey Platonov
 
Андрей Карпов, Приватные байки от разработчиков анализатора кода
Андрей Карпов, Приватные байки от разработчиков анализатора кодаАндрей Карпов, Приватные байки от разработчиков анализатора кода
Андрей Карпов, Приватные байки от разработчиков анализатора кодаSergey Platonov
 
Юрий Ефимочев, Компилируемые в реальном времени DSL для С++
Юрий Ефимочев, Компилируемые в реальном времени DSL для С++ Юрий Ефимочев, Компилируемые в реальном времени DSL для С++
Юрий Ефимочев, Компилируемые в реальном времени DSL для С++ Sergey Platonov
 

Más de Sergey Platonov (16)

Лев Казаркин, Удивительные приключения регистров SSE или в поисках одного бага
Лев Казаркин, Удивительные приключения регистров SSE или в поисках одного багаЛев Казаркин, Удивительные приключения регистров SSE или в поисках одного бага
Лев Казаркин, Удивительные приключения регистров SSE или в поисках одного бага
 
Павел Филонов, Разделяй и управляй вместе с Conan.io
Павел Филонов, Разделяй и управляй вместе с Conan.ioПавел Филонов, Разделяй и управляй вместе с Conan.io
Павел Филонов, Разделяй и управляй вместе с Conan.io
 
Григорий Демченко, Асинхронность и неблокирующая синхронизация
Григорий Демченко, Асинхронность и неблокирующая синхронизацияГригорий Демченко, Асинхронность и неблокирующая синхронизация
Григорий Демченко, Асинхронность и неблокирующая синхронизация
 
Антон Полухин. C++17
Антон Полухин. C++17Антон Полухин. C++17
Антон Полухин. C++17
 
Павел Беликов, Как избежать ошибок, используя современный C++
Павел Беликов, Как избежать ошибок, используя современный C++Павел Беликов, Как избежать ошибок, используя современный C++
Павел Беликов, Как избежать ошибок, используя современный C++
 
Денис Кандров, Пушкова Евгения, QSpec: тестирование графических приложений на Qt
Денис Кандров, Пушкова Евгения, QSpec: тестирование графических приложений на QtДенис Кандров, Пушкова Евгения, QSpec: тестирование графических приложений на Qt
Денис Кандров, Пушкова Евгения, QSpec: тестирование графических приложений на Qt
 
Александр Тарасенко, Использование python для автоматизации отладки С/C++ код...
Александр Тарасенко, Использование python для автоматизации отладки С/C++ код...Александр Тарасенко, Использование python для автоматизации отладки С/C++ код...
Александр Тарасенко, Использование python для автоматизации отладки С/C++ код...
 
Павел Довгалюк, Обратная отладка
Павел Довгалюк, Обратная отладкаПавел Довгалюк, Обратная отладка
Павел Довгалюк, Обратная отладка
 
Никита Глушков, К вопросу о реализации кроссплатформенных фреймворков
Никита Глушков, К вопросу о реализации кроссплатформенных фреймворковНикита Глушков, К вопросу о реализации кроссплатформенных фреймворков
Никита Глушков, К вопросу о реализации кроссплатформенных фреймворков
 
Dori Exterman, Considerations for choosing the parallel computing strategy th...
Dori Exterman, Considerations for choosing the parallel computing strategy th...Dori Exterman, Considerations for choosing the parallel computing strategy th...
Dori Exterman, Considerations for choosing the parallel computing strategy th...
 
Александр Фокин, Рефлексия в C++
Александр Фокин, Рефлексия в C++Александр Фокин, Рефлексия в C++
Александр Фокин, Рефлексия в C++
 
Михаил Матросов, Повседневный С++: boost и STL
Михаил Матросов, Повседневный С++: boost и STLМихаил Матросов, Повседневный С++: boost и STL
Михаил Матросов, Повседневный С++: boost и STL
 
Илья Шишков, Принципы создания тестируемого кода
Илья Шишков, Принципы создания тестируемого кодаИлья Шишков, Принципы создания тестируемого кода
Илья Шишков, Принципы создания тестируемого кода
 
Антон Наумович, Система автоматической крэш-аналитики своими средствами
Антон Наумович, Система автоматической крэш-аналитики своими средствамиАнтон Наумович, Система автоматической крэш-аналитики своими средствами
Антон Наумович, Система автоматической крэш-аналитики своими средствами
 
Андрей Карпов, Приватные байки от разработчиков анализатора кода
Андрей Карпов, Приватные байки от разработчиков анализатора кодаАндрей Карпов, Приватные байки от разработчиков анализатора кода
Андрей Карпов, Приватные байки от разработчиков анализатора кода
 
Юрий Ефимочев, Компилируемые в реальном времени DSL для С++
Юрий Ефимочев, Компилируемые в реальном времени DSL для С++ Юрий Ефимочев, Компилируемые в реальном времени DSL для С++
Юрий Ефимочев, Компилируемые в реальном времени DSL для С++
 

Último

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 

Último (20)

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

Adding Async Algorithms to std C

  • 1. Adding Async Algorithms to std C++Russia, Санкт-Петербург © 2016 Kirk Shoop (github twitter) 1 debounce 5 diagrams courtesy of André Staltz from rxmarbles 1 / 60 1 2 3 4 5 6 6
  • 2. code (rxcpp) asyncReadBytes() | tap(printVectorOfBytes) | concat_map(vectorOfStringsFromVectorOfBytes) | group_by(groupFromString) | flat_map(appendGroupStrings) | subscribe(println(cout)); output (emscripten) 65 65 65 65 65 65 13 66 66 66 66 AAAAAA 66 66 66 66 66 66 66 66 66 66 66 66 66 13 67 67 67 67 67 67 67 13 BBBBBBBBBBBBBBBBB CCCCCCC 68 68 68 68 68 68 68 68 68 68 68 68 68 68 13 69 69 69 69 69 69 69 DDDDDDDDDDDDDD 69 69 69 69 69 69 69 69 13 EEEEEEEEEEEEEEE lines from bytes © 2016 Kirk Shoop (github twitter) 2 / 60
  • 3. code (rxcpp) auto down$ = mousedown$("#window"); auto up$ = mouseup$("#window"); auto move$ = mousemove$("#window"); down$ | flat_map([=](MouseEvent){ return move$ | take_until(up$) | map([](MouseEvent){return 1;}) | start_with(0) | sum(); }) | map( [](int c){ return to_string(c) + " moves while mouse down"; }) | subscribe(println(cout)); output (emscripten) 2 moves while mouse down moves while mouse button down © 2016 Kirk Shoop (github twitter) 3 / 60
  • 4. code (rxcpp) struct data { int size; string firstLine;}; struct model { map<string, data> store; }; httpGet("http://kirkshoop.github.io/.../README.md") | flat_map([](response_t r) { return r.progress() | combine_latest( [=](progress_t p, vector<uint8_t> d){ return make_tuple(r.url(), p, d); }, r.load()) | scan( model{}, updateModelFromTuple); }) | subscribe(println(cout)); output (emscripten) README.md, 0 README.md, 0 README.md, 66 README.md, 66 здравствуйте! bytes from http GET © 2016 Kirk Shoop (github twitter) 4 / 60
  • 5. © 2016 Kirk Shoop (github twitter) 1 combineLatest((x, y) => "" + x + y) 2D 5 / 60 A 1A 2 2A B 2B C 2C D 3 3D 4 4D 5 5D
  • 6. © 2016 Kirk Shoop (github twitter) scan((x, y) => x + y) 6 / 60 1 1 2 3 3 6 4 10 5 15
  • 7. © 2016 Kirk Shoop (github twitter) 7 / 60
  • 9. what do algorithms operate on? © 2016 Kirk Shoop (github twitter) 9 / 60
  • 10. sequences © 2016 Kirk Shoop (github twitter) 10 / 60
  • 11. in space vector of mouse positions generator of mouse positions using mouseMoves = vector<tuple<int,int>>; sequences auto mouseMoves(int start, int end) -> std::generator<tuple<int, int>> { for(;start != end; ++start){ auto position = start * 100; co_yield make_tuple(position, position); } } © 2016 Kirk Shoop (github twitter) 0, 0 100, 100 200, 200 300, 300 400, 400 11 / 60
  • 12. in time mouse move events network packets auto window::mouseMoves() -> async_generator<tuple<int, int>> { for co_await(auto event : events()) { if (event.id == MOUSEMOVE) { co_yield mousePositionFrom(event); } } } auto socket::bytes() -> async_generator<vector<byte>> { vector<byte> out; while (out = co_await read(. . .)) { co_yield out; } } sequences © 2016 Kirk Shoop (github twitter) 12 / 60
  • 13. what are the design options? abstract the sequence or algorithm? flow control using push or pull? cancel by ommission or trigger? chain algorithms using operator| or function nesting? © 2016 Kirk Shoop (github twitter) 13 / 60
  • 14. what designs allow async algorithms? abstract flow cancel chain sequence push trigger operator © 2016 Kirk Shoop (github twitter) 14 / 60
  • 15. © 2016 Kirk Shoop (github twitter) 15 / 60
  • 16. what might a toy implementation based on these properties look like? © 2016 Kirk Shoop (github twitter) 16 / 60
  • 17. push sequence implementations const auto ints = [](auto first, auto last){ return [=](auto r){ for(auto i=first;i <= last; ++i){ r(i); } }; }; const auto copy_if = [](auto pred){ return [=](auto dest){ return [=](auto v){ if (pred(v)) dest(v); }; }; }; const auto printto = [](auto& output){ return [&](auto v) { output << v << endl; }; }; auto even = [](auto v){return (v % 2) == 0;}; push sequence concepts struct sender { template<class Receiver> void operator()(Receiver); }; struct algorithm { template<class SenderV> SenderV operator()(SenderV); }; struct lifter { template<class ReceiverV> ReceiverU operator()(ReceiverV); }; struct receiver { template<class V> void operator()(V); }; © 2016 Kirk Shoop (github twitter) 17 / 60
  • 18. code ints(0, 9)(copy_if(even)(printto(cout))); output (emscripten) 0 2 4 6 8 push sequence © 2016 Kirk Shoop (github twitter) 18 / 60
  • 19. code ints(0, 9) | copy_if(even) | printto(cout); output (emscripten) 0 2 4 6 8 push sequence © 2016 Kirk Shoop (github twitter) 19 / 60
  • 20. what needs to change to support last_or_default? © 2016 Kirk Shoop (github twitter) last 20 / 60 1 2 3 4 4
  • 21. push sequence implementations const auto last_or_default = [](auto def){ return [=](auto dest){ auto l = make_shared<decay_t<decltype(def)>>(def); return make_receiver( [=](auto v){ l = v; }, [=](){ d(l); d(); }); }; }; push sequence concepts struct receiver { template<class V> void operator()(V); void operator()(); }; © 2016 Kirk Shoop (github twitter) 21 / 60
  • 22. code ints(0, 100000000) | copy_if(even) | last_or_default(42) | printto(cout); output (emscripten) new ints new copy_if new last_or_default new printto new lifetime last_or_default bound to dest copy_if bound to dest ints bound to dest 99999998 1 values received - done! stopped destructed what needs to change to support last_or_default? © 2016 Kirk Shoop (github twitter) 22 / 60
  • 23. what needs to change to support take? © 2016 Kirk Shoop (github twitter) take(2) 23 / 60 1 1 2 2 3 4
  • 24. push sequence implementations const auto take = [](int n){ return [=](auto dest){ auto remaining = dest.lifetime. template make_state<int>(n); return make_receiver(dest, remaining, [](auto& d, auto& r, auto v){ if (r-- == 0) { d(); } d(v); }); }; }; push sequence concepts struct subscription { using stopper = function<void()>; bool is_stopped(); void stop(); void insert(subscription); void erase(subscription); void insert(stopper); template<class Payload, class... ArgN> state<Payload> make_state(ArgN... argn); }; struct receiver { subscription lifetime; template<class V> void operator()(V); void operator()(); }; © 2016 Kirk Shoop (github twitter) 24 / 60
  • 25. code async_ints(0, 9) | copy_if(even) | take(3) | printto(cout); output (emscripten) new async_ints new copy_if new take new printto new lifetime take bound to dest copy_if bound to dest async_ints bound to dest 0 2 4 3 values received - done! stopped destructed what needs to change to support take? © 2016 Kirk Shoop (github twitter) 25 / 60
  • 26. what needs to change to support failure? © 2016 Kirk Shoop (github twitter) 26 / 60
  • 27. what needs to change to support failure? struct receiver { subscription lifetime; template<class V> void operator()(V); void operator()(exception_ptr); void operator()(); }; © 2016 Kirk Shoop (github twitter) 27 / 60
  • 28. code async_ints(0, 9) | copy_if(always_throw) | take(3) | printto(cout); output (emscripten) new async_ints new copy_if new take new printto new lifetime take bound to dest copy_if bound to dest async_ints bound to dest always throw! stopped destructed what needs to change to support failure? © 2016 Kirk Shoop (github twitter) 28 / 60
  • 29. © 2016 Kirk Shoop (github twitter) 29 / 60
  • 30. what needs to change to support delay? © 2016 Kirk Shoop (github twitter) 1 delay 30 / 60 2 1 1 2 1
  • 31. struct schedulable : public worker , public subscription { void operator()(); }; struct worker { steady_clock::time_point now(); void schedule(const schedulable& scbl); void schedule( steady_clock::time_point when, const schedulable& scbl); }; struct scheduler { worker create_worker(subscription); }; struct subscription { void unsubscribe(); }; template<class T> struct observer { on_next(T); on_error(exception_ptr); on_completed(); }; template<class T> struct subscriber : public observer<T> , public subscription { }; template<class T> struct observable { subscription subscribe(subscriber<T>); }; what needs to change to support delay? © 2016 Kirk Shoop (github twitter) 31 / 60
  • 32. code interval(1s, scheduler) | tap(printproduced) | delay(1500ms, scheduler) | take(5) | subscribe(printemitted); output (emscripten) 1.0s - 1 produced 2.0s - 2 produced 2.5s - 1 emitted 3.0s - 3 produced 3.5s - 2 emitted 4.0s - 4 produced 4.5s - 3 emitted 4.512s - real time elapsed what needs to change to support delay? © 2016 Kirk Shoop (github twitter) 32 / 60
  • 33. what needs to change to support testing? © 2016 Kirk Shoop (github twitter) 33 / 60
  • 34. struct test_worker { steady_clock::time_point now(); void schedule(const schedulable& scbl); void schedule( steady_clock::time_point when, const schedulable& scbl); void advance_to(long time) const; void advance_by(long time) const; void sleep(long time) const; template<class T, class F> auto start(F createSource, long created, long subscribed, long unsubscribed) const -> subscriber<T, testable_observer<T>>; }; what needs to change to support testing? struct recorded { steady_clock::time_point time() const; template<class Observer> virtual accept(const Observer& o) const; }; struct test { using messages_t vector<recorded>; steady_clock::time_point now() const; test_worker create_worker(subscription cs) const template<class T> auto make_hot_observable(messages_t m) const -> testable_observable<T>; template<class T> auto make_cold_observable(messages_t m) const; -> testable_observable<T>; }; © 2016 Kirk Shoop (github twitter) 34 / 60
  • 35. code auto scheduler = make_test(); auto worker = scheduler.create_worker(); auto interval$ = scheduler.make_hot_observable({ on.next(1000, 1), on.next(2000, 2), on.next(3000, 3), on.next(4000, 4) }); auto res = worker.start([&]() { return interval$ | tap(printproduced) | delay(1500ms, scheduler) | take(3) | tap(printemitted); }); output (emscripten) 1.0s - 1 produced 2.0s - 2 produced 2.5s - 1 emitted 3.0s - 3 produced 3.5s - 2 emitted 4.0s - 4 produced 4.5s - 3 emitted 0.026s - real time elapsed emitted value test - SUCCEEDED lifetime test - SUCCEEDED what needs to change to support testing? © 2016 Kirk Shoop (github twitter) 35 / 60
  • 36. what needs to change to support testing? auto required = rxu::to_vector({ on.next(1000 + 1500, 1), on.next(2000 + 1500, 2), on.next(3000 + 1500, 3) }); auto actual = res.get_observer().messages(); cout << "emitted value test"; if (required == actual) { cout << " - SUCCEEDED" << endl; } else { cout << " - FAILED" << endl; cout << "REQUIRED: " << required << endl; cout << "ACTUAL : " << actual << endl; } © 2016 Kirk Shoop (github twitter) 36 / 60
  • 37. © 2016 Kirk Shoop (github twitter) 37 / 60
  • 38. what designs do other combinations produce? © 2016 Kirk Shoop (github twitter) 38 / 60
  • 39. async_generator abstract flow cancel chain sequence pull trigger operator © 2016 Kirk Shoop (github twitter) 39 / 60
  • 40. template<class T> struct await_iterator { bool await_ready(); void await_suspend(coroutine_handle<>); async_iterator<T> await_resume(); }; template<class T> struct async_iterator { T& operator*(); await_iterator<T> operator++(); }; template<class T> struct async_generator { await_iterator<T> begin(); async_iterator<T> end(); }; async_generator abstract flow cancel chain sequence pull trigger operator async_generator concepts © 2016 Kirk Shoop (github twitter) 40 / 60
  • 41. async_generator abstract flow cancel chain sequence pull trigger operator implement filter operator template<typename T, typename P> async_generator<T> filter(async_generator<T> s, P pred) { for co_await(auto&& v : s) { if (pred(v)) { co_yield v; } } } © 2016 Kirk Shoop (github twitter) 41 / 60
  • 42. async_generator abstract flow cancel chain sequence pull trigger operator use operators to chain algorithms together auto fiveOddInts = tempSensor() | filter([](int n) { return n % 2 == 0; }) | // discard even take(5); // stop after 5 for co_await(auto n : fiveOddInts) { // . . . } © 2016 Kirk Shoop (github twitter) 42 / 60
  • 43. sfrp abstract flow cancel chain sequence pull omission function © 2016 Kirk Shoop (github twitter) 43 / 60
  • 44. sfrp abstract flow cancel chain sequence pull omission function example template <typename R, typename Args...> Behavior<R> map(function<R(Args...)> func, Behavior<Args>... behaviors); Behavior<Drawing> circleFollowsMouse(Behavior<Point2D> mousePos) { return map(circleAt, mousePos); } © 2016 Kirk Shoop (github twitter) 44 / 60
  • 45. Спасибо! I enjoyed visiting with you in Санкт-Петербург! © 2016 Kirk Shoop (github twitter) 45 / 60
  • 46. complete. questions? © 2016 Kirk Shoop (github twitter) 20 merge 20 46 / 60 40 40 60 60 1 1 80 80 100 100 1 1
  • 47. © 2016 Kirk Shoop (github twitter) 47 / 60
  • 48. range-v3 abstract flow cancel chain sequence pull omission operator © 2016 Kirk Shoop (github twitter) 48 / 60
  • 49. range-v3 abstract flow cancel chain sequence pull omission operator the range concept template<class Iterator, class EndIterator = Iterator> struct range { Iterator begin(); EndIterator end(); }; © 2016 Kirk Shoop (github twitter) 49 / 60
  • 50. range-v3 - implement the transform view // A class that adapts an existing range with a function template<class Rng, class Fun> class transform_view : public view_adaptor<transform_view<Rng, Fun>, Rng> { class adaptor : public adaptor_base { // . . . auto get(range_iterator_t<Rng> it) const -> decltype(fun_(*it)) { return fun_(*it); } }; adaptor begin_adaptor() const { return {fun_}; } adaptor end_adaptor() const { return {fun_}; } // . . . }; template<class Rng, class Fun> transform_view<Rng, Fun> transform(Rng && rng, Fun fun) { return {std::forward<Rng>(rng), std::move(fun)}; } © 2016 Kirk Shoop (github twitter) 50 / 60
  • 51. range-v3 abstract flow cancel chain sequence pull omission operator use operators to chain algorithms together auto fiveOddInts = view::ints(0) | //generates next int when asked view::remove_if([](int n) { return n % 2 == 0; }) | // discard even ints view::take(5); // stop after 5 auto result = fiveOddInts | view::to_vector; © 2016 Kirk Shoop (github twitter) 51 / 60
  • 52. Transducers abstract flow cancel chain algorithm push omission function © 2016 Kirk Shoop (github twitter) 52 / 60
  • 53. Transducers abstract flow cancel chain algorithm push omission function the step function struct transducer { template<class NextStep> struct step { template<class State, class T> auto operator()(State state, T v); template<class State> auto operator()(State state); }; template<class NextStep> auto operator()(NextStep nextstep) { return step<NextStep>(nextstep); } }; © 2016 Kirk Shoop (github twitter) 53 / 60
  • 54. Transducers abstract flow cancel chain algorithm push omission function implement the filterer transducer auto filterer = [](auto pred) { return [=](auto step) { return stateless( [=](auto s, auto v) { if (pred(v)) {return step(s, v);} return s; }, [=](auto s){ return step(s); }); }; }; © 2016 Kirk Shoop (github twitter) 54 / 60
  • 55. Transducers abstract flow cancel chain algorithm push omission function use function nesting to chain algorithms together auto fiveOddInts = comp( filter([](int n) { return n % 2 == 0; }), // discard even take(5)); // stop after 5 auto result = into(vector<int> {}, fiveOddInts, range(0, 10)); © 2016 Kirk Shoop (github twitter) 55 / 60
  • 56. rxcpp abstract flow cancel chain sequence push trigger operator © 2016 Kirk Shoop (github twitter) 56 / 60
  • 57. struct schedulable : public worker , public subscription { void operator()(); }; struct worker { steady_clock::time_point now(); void schedule(const schedulable& scbl); void schedule( steady_clock::time_point when, const schedulable& scbl); }; struct scheduler { worker create_worker(subscription); }; struct subscription { void unsubscribe(); }; template<class T> struct observer { on_next(T); on_error(std::exception_ptr); on_completed(); }; template<class T> struct subscriber : public observer<T> , public subscription { }; template<class T> struct observable { subscription subscribe(subscriber<T>); }; concepts in rxcpp © 2016 Kirk Shoop (github twitter) 57 / 60
  • 58. rxcpp - implement the filter operator auto filter = [](auto pred) { return [=](auto subscriber) { return make_subscriber( [=](auto v) { if (pred(v)) { subscriber.on_next(v); } }, [=](std::exception_ptr ep) { subscriber.on_error(ep); }, [=]() { subscriber.on_completed(); } ); } }; © 2016 Kirk Shoop (github twitter) 58 / 60
  • 59. rxcpp abstract flow cancel chain sequence push trigger operator use operators to chain algorithms together auto fiveOddInts = tempSensor() | filter([](int n) { return n % 2 == 0; }) | // discard even take(5); // stop after 5 fiveOddInts.subscribe([](int n){. . .}); © 2016 Kirk Shoop (github twitter) 59 / 60
  • 60. © 2016 Kirk Shoop (github twitter) 60 / 60