C++高性能并行编程与优化 - 课件 - 13 C++ STL 容器全解之 vectorvector(initializer_listlist); vector 容器:构造函数 • 初始化表达式的等号可以写也可以不写: • vector a = {6, 1, 7, 4}; • vector a{6, 1, 7, 4}; • 都是等价的。 • vector(initializer_list list); vector 容器:构造函数 ,这样才能保证 调用他的显式( explicit )构造函数: • vector a(4); • 会得到长度为 4 元素全为 0 的数组。 • vector(initializer_list list); • explicit vector(size_t n); vector 容器:构造函数 • 这在对于只能用花括号初始化的类成员来说,就 有很大问题: • vector 但还是可以用这种写法强制调用显式构造函数: • vector a = vector (4); • 会得到长度为 4 元素全为 0 的数组。 • vector(initializer_list list); • explicit vector(size_t n); vector 容器:构造函数 • 这在对于只能用花括号初始化的类成员来说,就 有很大问题: • vector 0 码力 | 90 页 | 4.93 MB | 1 年前3
hazard pointer synchronous reclamationwhen not using global cleanup Without global cleanup With global cleanup SequentialObjList list_; SharedObjList list_; Extra synchronization Removed private cache from Folly Using sharded domain lists instead LockedHeadOnlyList: • Pop all operation locks list for other pop all operations. • Push operations are lock-free. • ~hazard_pointer_cohort() • Pops all objects and locks list • Extracts objects with matching cohort cohort • Pushes back unmatching objects and unlocks list • Reclaim matching objects • Why lock? Concurrent cohort destructors. Asynchronous Reclamation Revisited Hazard Pointer Synchronous Reclamation Beyond0 码力 | 31 页 | 856.38 KB | 6 月前3
C++20's database. • This functionality requires several new types to be added to the library: • tzdb • tzdb_list • time_zone • zoned_time • time_zone_link • ambiguous_local_time • nonexistent_local_time • …37 time_zone tzdb_list which contains a list of tzdb objects. • Since tzdb objects can be tied to newer versions of the time zone data, this list can contain various versions of the tzdb. • The tzdb_list is a singleton, and should be accessed via the get_tzdb_list() function. Then you can access individual tzdbs from the list using the tzdb_list::const_iterator. • Alternatively, you can just use the0 码力 | 55 页 | 8.67 MB | 6 月前3
whats new in visual studio0.82 Series1 IntelliSense Ready* 1.9x faster *) Colorization + Member List 1 2 0 1 2 3 4 5 6 5.42 2.84 Series1 Open Member List 29% faster Unreal Engine 4.27.1 IntelliSense Ready 18x faster Learn more faster Open C++ File 2.4x faster IntelliSense Ready* 1.9x faster *) Colorization + Member List Open Member List 29% faster Unreal Engine 4.27.1 IntelliSense Ready 18x faster Learn more at http://aka faster Open C++ File 2.4x faster IntelliSense Ready* 1.9x faster *) Colorization + Member List Open Member List 29% faster Unreal Engine 4.27.1 IntelliSense Ready 18x faster Learn more at http://aka0 码力 | 42 页 | 19.02 MB | 6 月前3
C++高性能并行编程与优化 - 课件 - 14 C++ 标准库系列课 - 你所不知道的 set 容器back_insert_iterator output_iterator 前向迭代器 * , != , == , ++ forward_list forward_iterator 双向迭代器 * , != , == , ++ , -- set , map , list bidirectional_iterator 随机访问迭代器 * , != , == , ++ , -- , + , - , += 代器 这意味着如果一个 STL 模板函数(比如 std::find )要求迭代器是前向迭代器即可,那么也可 以给他随机访问迭代器,因为前向迭代器是随机访问迭代器的子集。 例如, vector 和 list 都可以调用 std::find ( set 则直接提供了 find 作为成员函数,稍后 讨论) set 和 vector 迭代器的不同点 • set 的迭代器对象也重载了 + + 为红黑树的遍历。 函数 。 • 这和 vector 的 clear 函数 名字是一样的,方便记忆。 • void clear() noexcept; • set &operator=(initializer_listlst); set 的大小(元素个数) • 和 vector 一样, set 也有 个 size() 函数查询其中元素 个数。 • size_t size() const noexcept; 0 码力 | 83 页 | 10.23 MB | 1 年前3
C++高性能并行编程与优化 - 课件 - 02 现代 C++ 入门:RAII 内存管理其实:如果你的类已经实现了移动赋值函数,那 么为了省力你可以删除拷贝赋值函数。 • 这样当用户调用: • v2 = v1; • 时,因为拷贝赋值被删除,编译器会尝试: • v2 = List(v1) • 从而先调用拷贝构造函数,然后因为 List(v1) 相 当于就地构造的对象,从而变成了移动语义,从 而进一步调用移动赋值函数。 构造函数全家桶:总结 限于篇幅,其实构造函数还完全没讲完…… 下一讲继续完善我们刚才发明的 • 已经发布到: https://github.com/parallel101/hw02 • 仓库的 README.md 里有详细的作业要求和说明。请按要求修改其中的代码,使得双向 链表类 List 的拷贝构造函数能正常工作,且内存能够安全释放。 • 通过 pull request 提交你的作业,这样我可以通过 diff 页面清楚地看到你的改动。 • 什么事 pull request ?还是善用搜索引擎,这是作业的一部分(0 码力 | 96 页 | 16.28 MB | 1 年前3
RustBelt - Rust 的形式化语义模型[true] ∨ v̄ = [false] ⟦τ⟧.own(v̄)- A relation between a type and a list of values := ⟦τ⟧.own(v̄) −∗ ⟦τ⟧.own(v̄) ∗ ⟦τ⟧.own(v̄) τ: Copy List concatentation ⟦int⟧.own(v̄) ⟦τ1 × τ2⟧.own(v̄) := ∃z ∈ ℤ.0 码力 | 21 页 | 2.63 MB | 1 年前3
A Crash Course in Calendars, Dates, Time, and Time ZonesZones Time zone database: = list of time zones, including things like daylight saving time descriptions Access time zone database std::chrono::get_tzdb() List all available time zones: const0 码力 | 43 页 | 551.60 KB | 6 月前3
C++20: An (Almost) Complete Overview"three"s} }; bool result { myMap.contains(2) }; remove(), remove_if(), and unique() for list and forward_list now return size_type instead of void, the number of removed elements shift_left() and0 码力 | 85 页 | 512.18 KB | 6 月前3
KubeCon2020/大型Kubernetes集群的资源编排优化Dynamic-scheduler 5m Load >65% filtered Pod 1h Load >70% filtered Add node1 to priority candidate list Dynamic-Scheduler Priority Node2 Node3 Node1 5m Load 50% 1h Load 40% 5m Load 50% 1h Load0 码力 | 27 页 | 3.91 MB | 1 年前3
共 14 条
- 1
- 2













