浅墨浓香

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

导航

随笔分类 -  C++模板编程

《C++ Templates》second Edition 作为学习,试着翻译成中文。限于能力,错误在所难免,提供中英文对照版供大家自己甄别。
摘要:2.6 Partial Specialization 2.6 偏特化 Class templates can be partially specialized. You can provide special implementations for particular circumstances, 阅读全文

posted @ 2020-04-15 22:32 浅墨浓香 阅读(394) 评论(0) 推荐(0)

摘要:2.5 Specializations of Class Templates 2.5 类模板的特化 You can specialize a class template for certain template arguments. Similar to the overloading of fu 阅读全文

posted @ 2020-04-15 22:26 浅墨浓香 阅读(644) 评论(0) 推荐(0)

摘要:2.4 Friends 2.4 友元 Instead of printing the stack contents with printOn() it is better to implement toperator<< for the stack. However, as usual operat 阅读全文

posted @ 2020-04-15 22:23 浅墨浓香 阅读(261) 评论(0) 推荐(0)

摘要:2.3 Partial Usage of Class Templates 2.3 类模板的局部使用 A class template usually applies multiple operations on the template arguments it is instantiated fo 阅读全文

posted @ 2020-04-15 22:19 浅墨浓香 阅读(277) 评论(0) 推荐(0)

摘要:2.2 Use of Class Template Stack 2.2 类模板Stack的使用 To use an object of a class template, until C++17 you must always specify the template arguments expli 阅读全文

posted @ 2020-04-15 22:16 浅墨浓香 阅读(367) 评论(0) 推荐(1)

摘要:Chapter 2: Class Templates 第2章 类模板 Similar to functions, classes can also be parameterized with one or more types. Container classes, which are used t 阅读全文

posted @ 2020-04-14 11:33 浅墨浓香 阅读(528) 评论(0) 推荐(0)

摘要:1.6 But, Shouldn’t We …? 1.6 但是,难道我们不应该…? Probably, even these simple function template examples might raise further questions. Three questions are pr 阅读全文

posted @ 2020-04-14 11:21 浅墨浓香 阅读(353) 评论(0) 推荐(0)

摘要:1.5 Overloading Function Templates 1.5 重载函数模板 Like ordinary functions, function templates can be overloaded. That is, you can have different function 阅读全文

posted @ 2020-04-14 11:16 浅墨浓香 阅读(524) 评论(0) 推荐(1)

摘要:1.4 Default Template Arguments 1.4 默认模板参数 You can also define default values for template parameters. These values are called default template argumen 阅读全文

posted @ 2020-04-14 11:07 浅墨浓香 阅读(450) 评论(0) 推荐(0)

摘要:1.3 Multiple Template Parameters 1.3 多模板参数 As we have seen so far, function templates have two distinct sets of parameters: 到目前为止,我们己经看到函数模板具有两组不同的参数: 阅读全文

posted @ 2020-04-14 11:01 浅墨浓香 阅读(1236) 评论(0) 推荐(0)

摘要:1.2 Template Argument Deduction 1.2 模板参数的推导 When we call a function template such as max() for some arguments, the template parameters are determined 阅读全文

posted @ 2020-04-14 10:53 浅墨浓香 阅读(706) 评论(0) 推荐(2)

摘要:Chapter 1: Function Templates 第1章 函数模板 This chapter introduces function templates. Function templates are functions that are parameterized so that the 阅读全文

posted @ 2020-04-14 10:47 浅墨浓香 阅读(814) 评论(0) 推荐(1)