Coroutines and Structured Concurrency in Practice
A task can only run when it’s being awaited by another task https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/Sketching an API Taskgreet() { cout co_return co_await resolveOn(name, "1.1.1.1"); }); co_return visit(identity{}, v); }Structured concurrency Tasks naturally form a "call tree" • coroutines • leaf awaitables (sleeping, I/O, cancel()? No longer a simple allOf()Dynamic allOf() We have created a fundamental primitive of structured concurrency • nursery in Python trio • task group in Python asyncio • task scope in Rust • coroutine 0 码力 | 103 页 | 1.98 MB | 5 月前3C++26 Preview
collections, new ranges, language features 4Outline of the talk I Language & Library debugging structured bindings Language Templates Misc Contracts Reflection 5Outline of the talk II Library: string is_debugger_present is_replaceable 13Structured Bindings 14use as conditions in if, while, for, and switch statements success evaluation prior to destructuring blog: P0963 Structured binding declaration as a condition while, for, and switch statements success evaluation prior to destructuring blog: P0963 Structured binding declaration as a condition https://mariusbancila.ro/blog/2024/09/06/whats-new-in-c26- part-1/0 码力 | 118 页 | 2.02 MB | 5 月前3Modern C++ Tutorial: C++11/14/17/20 On the Fly
list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Structured binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.3 Type C++11, it contains a large number of small and beautiful languages and features (such as structured binding), and the appearance of these features once again corrects our programming paradigm in C++and etc. • … and many more There are also other features such as parameter binding (C++11 provides std::bind and std::function), export etc. are also deprecated. These features mentioned 0 码力 | 92 页 | 1.79 MB | 1 年前3Named Optional Parameters - JavaScript Style
function logger({one, two, three} = {}) { // in signature: = {} provides destructure // similar to structured binding // first check for what would be a “compiler” error if ( one == null ) throw new Error("i data members only ▪designated initializers -- initializing a struct with: { .field = value } ▪structured binding -- disaggregating a struct with: auto& [field1, field1] = myStruct ▪function overloading - noDefaultExists; Speed speed; }; Inside of processCarStateTransition the struct argument is spread with structured binding. Answer processCarStateTransition(const PathToChangingStatus& path) { auto& [car, roadType0 码力 | 1 页 | 3.17 MB | 5 月前3Back to Basics: Algebraic Data Types
generateDefaultCert(); std::cout << "Made cert for host " << std::get<0>(hct) << "\n"; // C++17 structured binding auto [host, cert, ttl] = generateDefaultCert(); std::cout << "Made cert for host " << host = generateDefaultCert(); std::cout << "Made cert for host " << info.host << "\n"; // C++17 structured binding still permits this auto [host, cert, ttl] = generateDefaultCert(); std::cout << "Made cert0 码力 | 73 页 | 267.05 KB | 5 月前3Back to Basics: Lambda Expressions
myLamb = [ ] (auto var1, int var2) { return var1 + var2; } 42Lambda Expressions ● Structured Bindings ○ structured bindings make it easier to access elements of tuples, arrays, and other compound types // line A auto myLamb = [x] () { return x + 7; }; // line B ○ capturing a structured binding was deemed invalid according to the standard, so line B does not compile as of C++17 ○ workaround:0 码力 | 48 页 | 175.89 KB | 5 月前3Whats in a Name? Whats a Name in? - Walter E. Brown - CppCon 2020
underscore plus most characters from ISO/IEC 10646). � “An en:ty is a value, object, reference, structured binding, func`on, enumerator, type, class member, bit-field, template, template specializa`on, namespace0 码力 | 7 页 | 4.37 MB | 5 月前3CppCon2021 Concurrency TS2
Heisenberg’s advice 2.Increase uncertainty to get performance and scalability 3.So Procrastinate away! Use Structured Deferral 4.Shared_ptr vs atomic_shared_ptr vs hazard pointers vs Read Copy Update (RCU) 5.Hazard about. ● We urge SGs to explicitly poll for this and their supporting reasons ● DG will offer non-binding advisory in some cases as ○ whether TS or IS route is preferred, or have you considered an SG ○0 码力 | 58 页 | 1.62 MB | 5 月前0.03Back to Basics: The structure of a Program
Declarations and Definitions • An entity is one of these things: • value • object • reference • structured binding • function • enumerator • type • class member • bit-field • template • template specialization0 码力 | 64 页 | 390.34 KB | 5 月前3Back to Basics: Templates - Part 1
Declarations and Definitions • An entity is one of these things: • value • object • reference • structured binding • function • enumerator • type • class member • bit-field • template • template specialization0 码力 | 68 页 | 436.75 KB | 5 月前3
共 137 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14