Reflection Based Libraries to Look Forward Towrapped copy Attributes: x <__main__.MyClass object at 0x7f1a9 1 2 3 4 5 6 7 8 9 10 11 13GoLang 14Golang is a compiled but duck-typed language Well, structurally typed, but close enough Runtime compile time constructs Provides a package reflect to get “reflection values”. Reflecting GoLang 15Reflecting GoLang type T struct { A string B int } t := T{"CppCon!", 24} s := reflect.ValueOf(&t) the type Customizing the default behavior *mentioned in P2911 52One of my favorite features from Golang Adding information at the point of definition Has its place, as opposed to adding code at the time0 码力 | 118 页 | 14.33 MB | 6 月前3
Modern C++ Tutorial: C++11/14/17/20 On the FlyRuntime Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Merge and Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . arr_5[len_foo()+5]; // illegal char arr_6[len_foo_constexpr() + 1]; // legal // 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 std::cout << fibonacci(10) << std::endl; return 0; } In the above example, char arr_4[len_2] may "capacity:" << v.capacity() << std::endl; // output 4 // The auto-expansion logic here is very similar to Golang's slice. v.push_back(4); v.push_back(5); std::cout << "size:" << v.size() << std::endl; // output0 码力 | 92 页 | 1.79 MB | 1 年前3
现代C++ 教程:高速上手C++11/14/17/20std::weak_ptr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . arr_6[len_foo_constexpr() + 1]; // 合法 std::cout << fibonacci(10) << std::endl; // 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 std::cout << fibonacci(10) << std::endl; return 0; } 上面的例子中,char arr_4[len_2] 可能比较令人困惑,因为 len_2 std::cout << "capacity:" << v.capacity() << std::endl; // 输出 4 46 4.1 线性容器 第 4 章容器 // 这里的自动扩张逻辑与 Golang 的 slice 很像 v.push_back(4); v.push_back(5); std::cout << "size:" << v.size() << std::endl; // 输出0 码力 | 83 页 | 2.42 MB | 1 年前3
Hello 算法 1.0.0b2 C++版(int n : list) { count++; } 拼接两个列表。再创建一个新列表 list1 ,我们可以将其中一个列表拼接到另一个的尾部。 4. 数组与链表 hello‑algo.com 55 // === File: list.cpp === /* 拼接两个列表 */ vectorlist1 = { 6, 8, 7, 10, 9 }; // 将列表 list1 拼接到 1.8 之后,HashMap 内数组长度大于 64 时,长度大于 8 的链 表会被转化为「红黑树」,以提升查找性能。 Python 采用「开放寻址」。字典 dict 使用伪随机数进行探测。 Golang 采用「链式地址」。Go 规定每个桶最多存储 8 个键值对,超出容量则连接一个溢出桶; 当溢出桶过多时,会执行一次特殊的等量扩容操作,以保证性能。 6.3. 小结 ‧ 向哈希表中输入一个键 key 0 码力 | 197 页 | 15.72 MB | 1 年前3
Hello 算法 1.0.0b4 C++版. 50 4.2. 链表 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 4.3. 列表 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 4 构建的。数组是神经网络编程中最常使用的数据结构。 ‧ 数据结构实现:数组可以用于实现栈、队列、哈希表、堆、图等数据结构。例如,邻接矩阵是图的常见 表示之一,它实质上是一个二维数组。 4. 数组与链表 hello‑algo.com 55 4.2. 链表 内存空间是所有程序的公共资源,排除已被占用的内存空间,空闲内存空间通常散落在内存各处。在上一节 中,我们提到存储数组的内存空间必须是连续的,而当我们需要申请一个非常大的数组时,空闲内存中可能 1.8 以来,当 HashMap 内数组长度达到 64 且链表长度达到 8 时,链表会被转 换为红黑树以提升查找性能。 Python 采用开放寻址。字典 dict 使用伪随机数进行探测。 Golang 采用链式地址。Go 规定每个桶最多存储 8 个键值对,超出容量则连接一个溢出桶;当溢出桶过多时, 会执行一次特殊的等量扩容操作,以确保性能。 6.3. 哈希算法 在上两节中,我们了解了哈0 码力 | 343 页 | 27.39 MB | 1 年前3
Hello 算法 1.0.0b5 C++版complement code」。如果我们先将原码转换为反码,并在反码 下计算 1 + (−2) ,最后将结果从反码转化回原码,则可得到正确结果 −1 。 第 3 章 数据结构 hello‑algo.com 55 1 + (−2) → 0000 0001 (原码) + 1000 0010 (原码) = 0000 0001 (反码) + 1111 1101 (反码) = 1111 1110 (反码) 1.8 以来,当 HashMap 内数组长度达到 64 且链表长度达到 8 时,链表会被转 换为红黑树以提升查找性能。 Python 采用开放寻址。字典 dict 使用伪随机数进行探测。 Golang 采用链式地址。Go 规定每个桶最多存储 8 个键值对,超出容量则连接一个溢出桶;当溢出桶过多时, 会执行一次特殊的等量扩容操作,以确保性能。 6.3 哈希算法 在上两节中,我们了解了哈希0 码力 | 377 页 | 30.69 MB | 1 年前3
Conan 1.42 DocumentationPackaging Existing Binaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 7.5 Understanding Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . provide additional build flags (typically dependent on the settings). 7.4. Packaging Existing Binaries 55 Conan Documentation, Release 1.42.2 The default package_info() applies as follows: it defines headers the bundle: "pkga/0.1@#f096d7d54098b7ad7012f9435d9c33f3": { "packages": [{ "package_id": "3475bd55b91ae904ac96fde0f106a136ab951a5e", "lockfiles": { "app1_windows.lock": [ "3" ], "app2_windows.lock":0 码力 | 841 页 | 7.12 MB | 1 年前3
Conan 1.40 DocumentationPackaging Existing Binaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 7.5 Understanding Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . provide additional build flags (typically dependent on the settings). 7.4. Packaging Existing Binaries 55 Conan Documentation, Release 1.40.4 The default package_info() applies as follows: it defines headers the bundle: "pkga/0.1@#f096d7d54098b7ad7012f9435d9c33f3": { "packages": [{ "package_id": "3475bd55b91ae904ac96fde0f106a136ab951a5e", "lockfiles": { "app1_windows.lock": [ "3" ], "app2_windows.lock":0 码力 | 823 页 | 7.06 MB | 1 年前3
Conan 1.41 DocumentationPackaging Existing Binaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 7.5 Understanding Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . provide additional build flags (typically dependent on the settings). 7.4. Packaging Existing Binaries 55 Conan Documentation, Release 1.41.0 The default package_info() applies as follows: it defines headers the bundle: "pkga/0.1@#f096d7d54098b7ad7012f9435d9c33f3": { "packages": [{ "package_id": "3475bd55b91ae904ac96fde0f106a136ab951a5e", "lockfiles": { "app1_windows.lock": [ "3" ], "app2_windows.lock":0 码力 | 835 页 | 7.10 MB | 1 年前3
Conan 1.43 DocumentationPackaging Existing Binaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 7.5 Understanding Packaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . provide additional build flags (typically dependent on the settings). 7.4. Packaging Existing Binaries 55 Conan Documentation, Release 1.43.4 The default package_info() applies as follows: it defines headers the bundle: "pkga/0.1@#f096d7d54098b7ad7012f9435d9c33f3": { "packages": [{ "package_id": "3475bd55b91ae904ac96fde0f106a136ab951a5e", "lockfiles": { "app1_windows.lock": [ "3" ], "app2_windows.lock":0 码力 | 849 页 | 7.15 MB | 1 年前3
共 216 条
- 1
- 2
- 3
- 4
- 5
- 6
- 22













