The Many Shades of reference_wrappersome_object; if (cond) dialog = some_other_object; // ?? process(dialog); 3 CppCon 2020C++ reference can only be bound once auto& dialog = [&]() -> auto& { if (cond) return some_object; else return 2020Reference “assignment” 8 CppCon 2020 Python dialog = some_object if cond: dialog = some_other_object C++ auto& dialog = some_object; if (cond) dialog = some_other_object;C++ reference • initialization initialization binds the object to the reference • assignment assigns to the bounded object (so called “assign-through”) 9 CppCon 2020What if initialization and assignment both bind objects? • initialization0 码力 | 49 页 | 575.61 KB | 6 月前3
Lock-Free Atomic Shared Pointers Without a Split Reference Count? It Can Be Done!Atomics and concurrency patterns • How existing atomicare implemented (the split reference count technique) • Deferred reclamation, i.e., garbage collection in C++ Some assumed knowledge Atomics and concurrency patterns • How existing atomic are implemented (the split reference count technique) • Deferred reclamation, i.e., garbage collection in C++ Some assumed knowledge control_block pointer as a lock26 Daniel Anderson -- danielanderson.net Solution #2: The split reference count • Used by Folly (Facebook open-source library, used in production), • Used by JustThreads 0 码力 | 45 页 | 5.12 MB | 6 月前3
Modern C++ Tutorial: C++11/14/17/20 On the Fly. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Chapter 02: Language Usability Enhancements 13 2.1 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Chapter 03: Language Runtime Enhancements 37 3.1 Lambda Expression . . . . . . . . . . . . . . . . . . . . . . . . and std::placeholder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.3 rvalue Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 lvalue,0 码力 | 92 页 | 1.79 MB | 1 年前3
Some Things C++ Does Righttype-safe enough • C++ is a language where some defaults are wrong 6You might have heard… • C++ is not memory-safe enough • C++ is not type-safe enough • C++ is a language where some all defaults are 7You might have heard… • C++ is not memory-safe enough • C++ is not type-safe enough • C++ is a language where some all defaults are wrong • C++ is too expert-friendly 8You might have heard… • There's grain of truth in criticism, and C++ surely has a bit of each of these alleged warts • It's a language that has history, obviously, and that has evolved organically over the years, and it has the imperfections0 码力 | 228 页 | 2.47 MB | 6 月前3
Template Metaprogramming: Type Traitsthe language and have no formal language support 11Metafunctions • A metafunction is not a function but a class/struct • Metafunctions are not part of the language and have no formal language support use of existing language features 11Metafunctions • A metafunction is not a function but a class/struct • Metafunctions are not part of the language and have no formal language support • They exist existing language features • Their use is not enforced by the language 11Metafunctions • A metafunction is not a function but a class/struct • Metafunctions are not part of the language and have0 码力 | 403 页 | 5.30 MB | 6 月前3
Contracts for C++| https://timur.audio 1986 Bertrand Meyer coins "Design by Contract"; Eiffel programming language published 2024 We are here11 Copyright (c) Timur Doumler | @timur_audio | https://timur audio 1986 Bertrand Meyer coins "Design by Contract"; Eiffel programming language published 2001 D programming language published with Contracts support 2024 We are here12 Copyright (c) Timur "Design by Contract"; Eiffel programming language published 2001 D programming language published with Contracts support 2012 Ada programming language gains Contract support 2024 We are here130 码力 | 181 页 | 4.44 MB | 6 月前3
Irksome C++common_type, and void_t, as well as all of headersand . • Influenced such core language features as alias templates, contextual conversions, variable templates, requires-expressions about? • As much as I like C++, it is certainly not free of — let's say — quirks. • Both the core language and the standard library exhibit idiosyncrasies, some,mes even in conflict with one another. an incomplete type that can never be completed. ✘ Also, please recall that “Forming the type ‘reference to cv void’ is ill-formed.” (N4988 [dcl.ref]/1 — This last sentence of the paragraph almost seems 0 码力 | 15 页 | 3.03 MB | 6 月前3
C++23: An Overview of Almost All New and Updated Featuresof C++ Standard Library Quick Reference& C++17 Standard Library Quick Reference Founder of the Belgian C++ Users Group (BeCPP) C++204 Agenda C++23 Core Language Explicit Object Parameters Operator Attributes on Lambda-Expressions Literal Suffix for size_t auto(x): decay-copy in The Language #elifdef, #elifndef, and #warning Marking Unreachable Code Assumptions Named Universal Heterogeneous Erasure Removed Features Garbage Collection SupportC++23 Core Language6 Agenda C++23 Core Language Explicit Object Parameters if consteval Multidimensional Subscript Operator0 码力 | 105 页 | 759.96 KB | 6 月前3
Back To Basics Functionsvarious BASIC programming languages ● Dark Basic Pro (DBP) (a game engine and BASIC programming language) was instrumental in my start in getting excited about programming ○ (And later informed my decision very minimum -- “a command that returns a value” 24General Purpose of a Function in a programming language (1/2) 25 ● Some functions purely run a routine of code -- no return value. ○ prompt() on the given input and/or output ○ i.e. transforming dataGeneral Purpose of a Function in a programming language (2/2) 26 ● Some functions purely run a routine of code -- no return value. ○ prompt() on the0 码力 | 123 页 | 7.26 MB | 6 月前3
Quantifying Accidental Complexity: An empirical look at teaching and using C++8 533 language 84 std:: library 11 general/local 10 wrong (IMO) 7 8Quantifying Accidental Complexity: An empirical look at teaching and using C++ Herb Sutter 9/21/2020 4 9 533 language 361 accidental accidental + improvable 10 533 language 147 ‘essential’ + improvable 361 accidental + improvable 9 10Quantifying Accidental Complexity: An empirical look at teaching and using C++ Herb Sutter 9/21/2020 9/21/2020 5 11 533 language 25 essential + minimal 147 ‘essential’ + improvable 361 accidental + improvable 12 Brooks famously concluded: “No silver bullet” Conclusion: “There is no single development0 码力 | 36 页 | 2.68 MB | 6 月前3
共 278 条
- 1
- 2
- 3
- 4
- 5
- 6
- 28
相关搜索词
TheManyShadesofreferencewrapperLockFreeAtomicSharedPointersWithoutSplitReferenceCountItCanBeDoneModernC++Tutorial11141720OntheFlySomeThingsDoesRightTemplateMetaprogrammingTypeTraitsContractsforIrksome23AnOverviewAlmostAllNewandUpdatedFeaturesBackToBasicsFunctionsQuantifyingAccidentalComplexityempiricallookatteachingusing













