浅墨浓香

想要天亮进城,就得天黑赶路。

导航

2020年5月29日

摘要: 9.5 Afternotes 9.5 后记 The organization of source code in header files and CPP files is a practical consequence of various incarnations of the one-defi 阅读全文

posted @ 2020-05-29 14:51 浅墨浓香 阅读(462) 评论(1) 推荐(0) 编辑

摘要: 9.4 Decoding the Error Novel 9.4 破译大篇幅错误信息 Ordinary compilation errors are normally quite succinct and to the point. For example, when a compiler says 阅读全文

posted @ 2020-05-29 14:50 浅墨浓香 阅读(831) 评论(0) 推荐(0) 编辑

2020年5月22日

摘要: 9.3 Precompiled Headers 9.3 预编译头文件 Even without templates, C++ header files can become very large and therefore take a long time to compile. Templates 阅读全文

posted @ 2020-05-22 21:08 浅墨浓香 阅读(458) 评论(1) 推荐(0) 编辑

摘要: 9.2 Templates and inline 9.2 模板和内联 Declaring functions to be inline is a common tool to improve the running time of programs. The inline specifier was 阅读全文

posted @ 2020-05-22 21:04 浅墨浓香 阅读(268) 评论(0) 推荐(0) 编辑

摘要: 第9章 在实践中使用模板 Template code is a little different from ordinary code. In some ways templates lie somewhere between macros and ordinary (nontemplate) de 阅读全文

posted @ 2020-05-22 21:03 浅墨浓香 阅读(334) 评论(0) 推荐(0) 编辑

2020年5月16日

摘要: 8.5 Compile-Time if8.5 编译期if Partial specialization, SFINAE, and std::enable_if allow us to enable or disable templates as a whole. C++17 additionally 阅读全文

posted @ 2020-05-16 17:29 浅墨浓香 阅读(707) 评论(1) 推荐(0) 编辑

摘要: 8.4 SFINAE (Substitution Failure Is Not An Error) 8.4 SFINAE(替换失败并不是错误) In C++ it is pretty common to overload functions to account for various argume 阅读全文

posted @ 2020-05-16 17:26 浅墨浓香 阅读(725) 评论(0) 推荐(0) 编辑

摘要: 8.3 Execution Path Selection with Partial Specialization 8.3 偏特化的执行路径选择 An interesting application of a compile-time test such as isPrime() is to use 阅读全文

posted @ 2020-05-16 17:18 浅墨浓香 阅读(250) 评论(0) 推荐(0) 编辑

摘要: 8.2 Computing with constexpr8.2 使用constexpr计算 C++11 introduced a new feature, constexpr, that greatly simplifies various forms of compile-time computa 阅读全文

posted @ 2020-05-16 17:16 浅墨浓香 阅读(847) 评论(0) 推荐(0) 编辑

摘要: Chapter 8:Compile-Time Programming 第8章 编译期编程 C++ has always included some simple ways to compute values at compile time. Templates considerably increa 阅读全文

posted @ 2020-05-16 17:13 浅墨浓香 阅读(551) 评论(0) 推荐(0) 编辑

2020年5月3日

摘要: 7.6 Recommended Template Parameter Declarations 7.6 推荐的模板参数声明方法 As we learned in the previous sections, we have very different ways to declare paramet 阅读全文

posted @ 2020-05-03 21:21 浅墨浓香 阅读(371) 评论(0) 推荐(0) 编辑

摘要: 7.5 Dealing with Return Values 7.5 处理返回值 For return values, you can also decide between returning by value or by reference. However, returning referen 阅读全文

posted @ 2020-05-03 15:59 浅墨浓香 阅读(263) 评论(0) 推荐(0) 编辑

摘要: 7.4 Dealing with String Literals and Raw Arrays 7.4 处理字符串常量和原生数组 So far, we have seen the different effects for templates parameters when using string 阅读全文

posted @ 2020-05-03 11:39 浅墨浓香 阅读(307) 评论(0) 推荐(0) 编辑

2020年5月2日

摘要: 7.3 Using std::ref() and std::cref() 7.3 使用std::ref()和std::cref() Since C++11, you can let the caller decide, for a function template argument, whethe 阅读全文

posted @ 2020-05-02 17:50 浅墨浓香 阅读(643) 评论(0) 推荐(1) 编辑

2020年4月29日

摘要: 7.2 Passing by Reference 7.2 按引用传递 Now let’s discuss the different flavors of passing by reference. In all cases, no copy gets created (because the pa 阅读全文

posted @ 2020-04-29 23:14 浅墨浓香 阅读(340) 评论(0) 推荐(0) 编辑

2020年4月27日

摘要: Chapter 7: By Value or by Reference? 第7章 按值传递或按引用传递? Since the beginning, C++ has provided call-by-value and call-by-reference, and it is not always e 阅读全文

posted @ 2020-04-27 00:19 浅墨浓香 阅读(400) 评论(0) 推荐(0) 编辑

2020年4月26日

摘要: 6.5 Using Concepts to Simplify enable_if<> Expressions 6.5 使用Concepts简化enable_if<>表达式 Even when using alias templates, the enable_if syntax is pretty 阅读全文

posted @ 2020-04-26 00:34 浅墨浓香 阅读(392) 评论(0) 推荐(0) 编辑

2020年4月25日

摘要: 6.4 Using enable_if<> 6.4 使用enable_if<> We can use enable_if<> to solve our problem with the constructor template introduced in Section 6.2 on page 95 阅读全文

posted @ 2020-04-25 23:12 浅墨浓香 阅读(769) 评论(0) 推荐(0) 编辑

摘要: 6.3 Disable Templates with enable_if<> 6.3 使用enable_if<>来禁用模板 Since C++11, the C++ standard library provides a helper template std::enable_if<> to ign 阅读全文

posted @ 2020-04-25 20:28 浅墨浓香 阅读(1006) 评论(0) 推荐(0) 编辑

摘要: 6.2 Special Member Function Templates 6.2 特殊成员函数模板 Member function templates can also be used as special member functions, including as a constructor, 阅读全文

posted @ 2020-04-25 18:24 浅墨浓香 阅读(319) 评论(0) 推荐(0) 编辑