C++20 STL Features: 1 Year of Development on GitHubLibraries stl@microsoft.com @StephanTLavavej2 Getting Started • Please hold your questions until the end • Write down the slide numbers • Part 0: Overview • What's happened in the last year • Part 1: calling m.erase(iter) • Many potential hazards 🙀 • remove_if(v.begin(), v.end(), pred); 🐞 • v.erase(remove_if(v.begin(), v.end(), pred)); 🐞 • Quadratic complexity vec.erase(iter) loop 🐞 • Invalidating Build system: CMake/Ninja • vcpkg submodule acquires Boost.Math for Special Math • tests/std, tests/libcxx, tests/tr1 (legacy) • llvm-project submodule for libc++'s test suite • Uses Python and lit0 码力 | 45 页 | 702.09 KB | 6 月前3
C++高性能并行编程与优化 - 课件 - 06 TBB 开启的并行编程之旅查看更多用法。 CMake 中使用: find_package CMake 中使用:作为子模块 这个什么“勾勾”公司非要默认开启 tests ,导致需要去寻找 googletest ,妨碍了我们作为子模块使用。 小彭老师单方面宣布:一切默认开启 tests , docs 构建目标的 cmake 项目,有病啊! 你妨碍别人作为子模块用你的项目。没错说的就是你 OpenSim ,张心欣当时浪费好多时间伺候这个沙雕库。 推荐通过迭代器顺序访问 • 最好的方式是用 begin() 和 end() 的迭代 器区间,按顺序访问。 parallel_for 也支持迭代器 • 冷知识: tbb::blocked_range 的参数不一 定是 size_t ,也可以是迭代器表示的区间 。 • 这样 lambda 体内 r 的 begin 和 end 也会返回 tbb::concurrent_vector 的迭代0 码力 | 116 页 | 15.85 MB | 1 年前3
Golang Warsaw #54Warsaw #54 26 October 2023 – 18:30 7N, Puławska 182, WarszawaHostSponsorsAgenda 1. Go-first End to End Tests for Highly Stateful Features - Kuba Martin 2. Break / Your announcements (OpenSource, event0 码力 | 7 页 | 1.66 MB | 6 月前3
Golang Warsaw #55Warsaw #55 24 January 2024 – 18:00 Okta – Koszykowa 61, WarsawHostSponsorsAgenda 1. Go-first End to End Tests for Highly Stateful Features - Kuba Martin 2. Break / Your announcements (OpenSource, event0 码力 | 7 页 | 1.34 MB | 6 月前3
C++高性能并行编程与优化 - 课件 - 14 C++ 标准库系列课 - 你所不知道的 set 容器vector 迭代器的共同点 • 上节课讲了迭代器: vector 具 有 begin() 和 end() 两个成 员函数,他们分别返回指向数 组头部元素和尾部再之后一格 元素的迭代器对象。 • vector 作为连续数组,他的迭 代器基本等效于指针。 • set 也有 begin() 和 end() 函数,他返回的迭代器对象重 载了 * 来访问指向的地址。 迭代器的五大分类 提供的运算符重载 数,他会寻找 set 中与之相等的元素。 • 如果找到,则返回指向找到元素的迭代器 。 • 如果找不到,则返回 end() 迭代器。 • 刚刚说过, end() 指向的是 set 的尾部 再之后一格元素,他指向的是一个不存在 的地址,不可能有任何元素在那里!因此 end() 常被标准库用作一个标记,来表示 找不到的情况。 Python 中的 find 找不 到元素时会返回 -1 来表示,也是这个思 &val) const; 1 2 4 find(2) begin() end() 1 2 4 find(2) begin() end() 1 2 4 find(2) begin() end() * * * 出错! 在 set 中查询元素是否存在 • 因此,可以用这个写法: • set.find(x) != set.end() • 来判断集合 set 中是否存在 元素 x 。 • 这是个固定的写法,虽然要0 码力 | 83 页 | 10.23 MB | 1 年前3
C++高性能并行编程与优化 - 课件 - 13 C++ STL 容器全解之 vector的内存的容器就没辙了。 • 没错, list 没有 data() 这个成员函数,因 为他根本就不连续。 迭代器模式:首迭代器+尾迭代器 • 然而 list 却提供了 begin() 和 end() 函数,他 们会返回两个 list::iterator 对象。 • 这个 list ::iterator 是一个特殊定义过的 类型,其具有 != 和 ++ 以及 * 这些运算符的 分不同的重载……编译器会在 p++ 的 时候自动改成调用 p.operator++(0) 。 vector 容器: begin • begin 可以获取指向第一个元素所在位置的迭代器。 • end 可以获取指向最后一个元素下一个位置的迭代器。 • 迭代器的作用类似于一个位置标记符。 • 虽然对于 vector 来说只需要下标( index )就能标记位置了,例如 Python 中也是通过 )来标记位置,他实际上是一个指针,这样 的好处是:不需要指定原来的容器本身,就能知道指定的位置。 • 一对迭代器 begin 和 end 就标记了一个区间( range )。区间可以是一个容器的全部, 例如 {a.begin(), a.end()} 区间;也可以是一个容器的部分,例如 {a.begin() + 1, a.end() - 1} 相当于去头去尾后的列表,相当于 Python 中的 a[1:-1] 。 • 区间这个概念在 0 码力 | 90 页 | 4.93 MB | 1 年前3
C++高性能并行编程与优化 - 课件 - 17 由浅入深学习 map 容器m[“key”]; • 读取键值为 “ key” 的元素,如果不存在,那就创建一个 “ key” 元素并初始化为 0 。等价于: • it = m.find(“key”); • if (it == m.end()) { • it = m.insert({“key”, 0}); • } • val = it->second; 读取 map 元素 • mapm; • m.at(“key”); • 读取键值为 “ key” 的元素,如果不存在,那就抛出异常,导致程序异常退出。等价于: • it = m.find(“key”); • if (it == m.end()) { • throw std::out_of_range(“ 找不到键值” ); • } • val = it->second; 从 map 中读取元素: C++ 和 Python val; • 写入键值为 “ key” 的元素,如果不存在,那就创建一个 “ key” 元素并初始化为 0 。等价于: • it = m.find(“key”); • if (it == m.end()) { • it = m.insert({“key”, 0}); • } • it->second = val; 写入 map 元素 • map m; • 0 码力 | 90 页 | 8.76 MB | 1 年前3
C++20: An (Almost) Complete OverviewSeptember 4, 2020, the C++20 standard passed ISO voting, expected to be formally published by the end of 2020.4 Agenda Modules Ranges Coroutines Concepts Lambda Expression Changes [= elements Similar to a begin/end iterator pair, but does not replace them Why ranges? Provide nicer and easier to read syntax: vector data { 11, 22, 33 }; sort(begin(data), end(data)); ranges::sort(data); ranges::sort(data); Eliminate mismatching begin/end iterators Allows “range adaptors” to lazily transform/filter underlying sequences of elements12 Ranges Based on following major components: Range: A0 码力 | 85 页 | 512.18 KB | 6 月前3
唐刚 - Use Rust to Develop the Decentralized Open Data Application - RustChinaConf2023data to everyone. ➔ Why we need open data? The business of the closed data model has been at the end. A New Proposal: Open Data Application The Road to Open Web ➔ From the user side, it looks like platform? Two Major Problems ➔ End user drives, no security (or token fund) drives. ➔ Network is like a living creature, it will evolve – grow or die. The needs of the end users is the force to drive this this network to evolve. ➔ So what we should keep doing is to develop the scale of the end users. ➔ More users, more data, more meanings. ➔ The incoming depends on consumer traffics, not directly on0 码力 | 30 页 | 2.53 MB | 1 年前3
Visualize Time Enabled Data using ArcGIS Qt (C++) and Toolkithurricane data as features • Each feature has a specific start time and end time in the feature table • We will use these start and end date values to draw and clear features on the map • The JSON of the the feature layer includes all the necessary information for the time slider - Start and end dates, time interval, etc. - Feature layer URLArcGIS Runtime for Qt - SDK • The Qt SDK allows you to build0 码力 | 10 页 | 734.09 KB | 6 月前3
共 21 条
- 1
- 2
- 3













