Class LayoutClass Layout Copyright © 2020 by Stephen C. Dewhurst and Daniel Saks 1 Class Layout Steve Dewhurst Semantics Consulting, Inc. www.stevedewhurst.com 1 Copyright © 2020 by Stephen C. Dewhurst and Daniel Daniel Saks C++ Classes Only non-static data declarations in a class definition add anything to the size of class objects. class HR { public: ~~~ void terminator(Salary *, Hourly *, Temp *); private: Stephen C. Dewhurst and Daniel Saks 1 7Class Layout Copyright © 2020 by Stephen C. Dewhurst and Daniel Saks 2 sizeof(Class Object) sizeof applied to the HR class yields the same result as sizeof applied0 码力 | 51 页 | 461.37 KB | 6 月前3
Using Modern C++ to Build XOffsetDatastructurestructures, including: • Base Types, Custom Types, Different Containers, Nested Types. • The diagram shows how these base types and containers can be combined to form complex data structures. Fanchen sent directly. • Deserialization without decoding: Data is accessed and modified directly. • The diagram shows that our method removes the need for encoding and decoding steps, simplifying the serialization include: • Serialization & deserialization • Read & write • In-place/non-in-place write • The diagram illustrates that, just like a road without bottlenecks allows for smooth traffic flow, we need0 码力 | 111 页 | 3.03 MB | 6 月前3
Back to Basics: Design Patternsstart this talk by introducing the taxonomy of design patterns at a high level, how to read a UML diagram (as a quick refresher), a refresher on inheritance vs composition, and then spend the rest of the we want!Time for the refactoring! (1/2) ● The first step is to move our global variables into a class ○ This groups both variables together ○ We will likely want to also have some behaviors (i.e. working with these values as well 38Time for the refactoring! (2/2) ● We move our globals into a class and will make them member variables ○ ConfigurationManager will be our Singleton ○ Through ConfigurationManager0 码力 | 96 页 | 2.10 MB | 6 月前3
Contracts for C++components, extending their ordinary definition with: • preconditions • postconditions • invariants (class invariants, loop invariants...) • called "Contracts" in accordance with a conceptual metaphor with components, extending their ordinary definition with: • preconditions • postconditions • invariants (class invariants, loop invariants...) • called "Contracts" in accordance with a conceptual metaphor with components, extending their ordinary definition with: • preconditions • postconditions • invariants (class invariants, loop invariants...) • called "Contracts" in accordance with a conceptual metaphor with0 码力 | 181 页 | 4.44 MB | 6 月前3
Back to Basics: Templates Part 2it is a recipe for making things • C++ provides six kinds of templates • Function templates • Class templates • Member function templates • Alias template • Variable templates • Lambda templates definitions are permitted" • Exactly one definition of a class must appear in any translation unit that uses it in such a way that the class must be complete • The rules for inline variables and functions parameters to create a template specialization 6 template<class T1, class T2> struct pair { T1 first; T2 second; ... }; template<class T> T const& max(T const& a, T const& b) { ... } pair0 码力 | 80 页 | 490.15 KB | 6 月前3
Back to Basics: Templates - Part 1functions 16 template<class T> T const& min(T const& a, T const& b); { return (a < b) ? a : b; } template<class T> void swap(T& a, T& b); template<class RandomIt, class Compare> void sort(RandomIt 2021 Bob Steagall Class Templates (C++98/03) • Recipes for making classes 17 template<class T, size_t N> struct array {...}; template<class T, class Alloc = allocator> class vector {...}; template class Key, class Val, class Compare = less , class Allocator = allocator >> class map {...};CppCon 2021 – Back to Basics: Templates – Part 1 Copyright © 2021 Bob Steagall 0 码力 | 68 页 | 436.75 KB | 6 月前3
Multi Producer, Multi Consumer, Lock Free, Atomic Queue| Lockfree, MPMC Queue https://github.com/erez-strauss/lockfree_mpmc_queue templateclass QueueSchedulerIssue { std::atomic writeIndex; std::atomic readIndex; elements[my_entry].second = my_entry ; return true; } }; pseudo code! 14 template class QueueSchedulerIssue { // … bool try_pop(T& value) { auto my_entry = readIndex.fetch_add(1); // delay write index increment bool lazy_pop = false> // delay read index increment class mpmc_queue { explicit mpmc_queue(uint64_t n = N); bool push(value_type d); // try to push 0 码力 | 54 页 | 886.12 KB | 6 月前3
Conda 23.3.x Documentation>=1.8,<2 • numpy >=1.8,<2|1.9 • numpy 1.8.1 py27_0 • numpy=1.8.1=py27_0 Version ordering The class VersionOrder(object) implements an order relation between version strings. Version strings can contain 3.1 conda.api.Solver class DepsModifier(value) Flags to enable alternate handling of dependencies. NOT_SET = 'not_set' NO_DEPS = 'no_deps' ONLY_DEPS = 'only_deps' class Solver(prefix, channels -- See solve_final_state(). Returns Return type UnlinkLinkTransaction 3.2 conda.cli.python_api class Commands CLEAN = 'clean' CONFIG = 'config' CREATE = 'create' INFO = 'info' INSTALL = 'install'0 码力 | 370 页 | 2.94 MB | 8 月前3
Conda 23.5.x Documentation>=1.8,<2 • numpy >=1.8,<2|1.9 • numpy 1.8.1 py27_0 • numpy=1.8.1=py27_0 Version ordering The class VersionOrder(object) implements an order relation between version strings. Version strings can contain 3.1 conda.api.Solver class DepsModifier(value) Flags to enable alternate handling of dependencies. NOT_SET = 'not_set' NO_DEPS = 'no_deps' ONLY_DEPS = 'only_deps' class Solver(prefix, channels -- See solve_final_state(). Returns Return type UnlinkLinkTransaction 3.2 conda.cli.python_api class Commands CLEAN = 'clean' CONFIG = 'config' CREATE = 'create' INFO = 'info' INSTALL = 'install'0 码力 | 370 页 | 3.11 MB | 8 月前3
A Picture is Worth a Thousand Wordscom/jgraph/drawio-desktopText to diagram converters • PlantUML • open source tool that converts simple textual descriptions to UML diagrams • Not only UML diagrams - Earth diagram, UI wireframes and more Integration to doxygen doc / markdown doc http://plantuml.com/guideThree simple lines generate this diagram…. Isn’t it awesome?Have a break! • Use PlantUML to create Sudoku. • The sudoku is randomly based diagramming and charting tool. • Mermaid can render: • Flowcharts • Sequence / class diagrams • Gantt diagram • Git graph and more https://mermaid-js.github.io/mermaid/#/Finally comes : the most0 码力 | 18 页 | 1.77 MB | 6 月前3
共 428 条
- 1
- 2
- 3
- 4
- 5
- 6
- 43













