Calling Functions A TutorialCalling Functions A Tutorial Klaus Iglberger, CppCon 2020 klaus.iglberger@gmx.de2 Klaus Iglberger C++ Trainer since 2016 Author of the C++ math library (Co-)Organizer of the Munich Two-Phase Lookup Template Argument Deduction SFINAE Overload Resolution (Viable) Candidate Functions Ranking Ambiguous Function Calls Access Labels Function Template Specializations Virtual Two-Phase Lookup Template Argument Deduction SFINAE Overload Resolution (Viable) Candidate Functions Ranking Ambiguous Function Calls Access Labels Function Template Specializations Virtual0 码力 | 111 页 | 5.11 MB | 6 月前3
Back To Basics Functionsfor many years -- please provide suggestions, analogies, and other useful ways to think about functions now or in the future!Please do not redistribute slides without prior permission. 4Your Tour Guide for the talk ● Located here: https://github.com/MikeShah/Talks/tree/main/2023/cppcon/functions 6Abstract Functions are one of the first things programmers learn, granting you the ultimate power to 'reuse' overview of functions from the start to the end, on the various powers that are given to us from the ground up. Consider this talk your one stop for learning all of the great things about functions! We'll0 码力 | 123 页 | 7.26 MB | 6 月前3
From Functions to CoroutinesFrom Functions to Coroutines 40 Years Evolution Rainer Grimm Training, Coaching, and Technology Consulting www.ModernesCpp.netEvolution of Callable templateT invoke(Func sequence of functions can be changed ▪ Automatically parallelizable ▪ Results can be cachedPure Functions Working with a pure function is based on discipline Use common functions, meta-functions, constexpr constexpr, or consteval functions ▪ Function int powFunc(int m, int n){ if (n == 0) return 1; return m * powFunc(m, n - 1); } ▪ Meta-Function template struct PowMeta { static int const value 0 码力 | 29 页 | 510.47 KB | 6 月前3
Optimizing Away Virtual Functions May Be Pointlessvirt_duration = end-start;There are interesting technical details and surprising conclusions that virtual functions can be actually faster. Since CPU architectures are mentioned, I'd expect to see deep assembly eritance-vs-other- ways-performanceDoes it even matter?Conclusions ● The notion that “virtual functions are slower” is flat out wrong. ○ Which is not to say they are faster ○ Some of the suggested0 码力 | 20 页 | 1.19 MB | 6 月前3
How Meta Made Debugging Async Code Easier with Coroutines and Senders… … Stack Traces for Async Code are Unhelpful Threadpool threads: #0 process_file(...) #5 pool.run() #10 __clone … … IO Thread: #0 async_read_some_at(...) #3 ctx Threadpool threads: #0 process_file(...) #5 pool.run() #10 … IO Thread: … #0 async_read_some_at(...) #3 ctx.run() #5 __clone … … Main thread: #0 unifex::sync_wait( … #0 async_read_some_at(...) … #12 unifex::sync_wait(...) #16 main() #19 __libc_start_main() … … Async Stacks are BetterStructured Concurrency Makes Async Stacks Possible0 码力 | 131 页 | 907.41 KB | 6 月前3
Combining Co-Routines and Functions into a Job SystemHelmut Hlavacs – Combining Co-Routines and Functions into a Job System - CppCon 2021 1 / 39Helmut Hlavacs – Combining Co-Routines and Functions into a Job System - CppCon 2021 2 / 39 About Myself • Professor Processing) Technical Committee 14 Entertainment ComputingHelmut Hlavacs – Combining Co-Routines and Functions into a Job System - CppCon 2021 3 / 39 Creating Game Engines with C++ • Vienna Game Job System Vulkan Game Engine 2.0 https://github.com/hlavacs 20Helmut Hlavacs – Combining Co-Routines and Functions into a Job System - CppCon 2021 4 / 39 The Game Loop auto prev = high_resolution_clock::now();0 码力 | 39 页 | 1.23 MB | 6 月前3
Tornado 6.5 Documentationworld") def make_app(): return tornado.web.Application([ (r"/", MainHandler), ]) async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait()if __name__ decorated coroutines How it works How to call a coroutine Coroutine patterns Calling blocking functions Parallelism Interleaving Looping Running in the background Queue example - a concurrent web spider why CPU blocking must be taken as seriously as other kinds of blocking, consider password hashing functions like bcrypt [http://bcrypt.sourceforge.net/], which by design use hundreds of milliseconds of CPU0 码力 | 437 页 | 405.14 KB | 3 月前3
Comprehensive Rust(English) 20241236 1 6.4.1 Scopes and Shadowing . . . . . . . . . . . . . . . . . . . . . . . . . . 36 6.5 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 6.6 Macros . . . . . . . . . . . . 80 IV Day 2: Afternoon 82 14 Welcome Back 83 15 Generics 84 15.1 Generic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 15.2 Generic Data Types . . Unions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 30.5 Unsafe Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 30.6 Implementing Unsafe0 码力 | 382 页 | 1.00 MB | 10 月前3
Tornado 6.5 Documentationwrite("Hello, world") def make_app(): return tornado.web.Application([ (r"/", MainHandler), ]) async def main(): app = make_app() app.listen(8888) await asyncio.Event().wait() if __name__ == "__main__": why CPU blocking must be taken as seriously as other kinds of blocking, consider password hashing functions like bcrypt, which by design use hundreds of milliseconds of CPU time, far more than a typical network background before triggering some future action in the application (as opposed to normal synchronous functions, which do every- thing they are going to do before returning). There are many styles of asynchronous0 码力 | 272 页 | 1.12 MB | 3 月前3
Comprehensive Rust(简体中文) 202412. . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 XIV 并发:下午 326 63 异步 Rust 327 63.1 async/await . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 63.2 Futures . . 64.2 选择 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 65 关于 async/await 的误区 335 65.1 阻塞执行器 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 66 习题 342 66.1 Dining Philosophers — Async . . . . . . . . . . . . . . . . . . . . . . . . . . 342 66.2 广播聊天应用 . . . . . . . . . . . . . .0 码力 | 359 页 | 1.33 MB | 10 月前3
共 358 条
- 1
- 2
- 3
- 4
- 5
- 6
- 36













