鱼C论坛

 找回密码
 立即注册
查看: 2459|回复: 0

《C++ Templates》中的一些代码问题

[复制链接]
发表于 2014-3-17 17:37:30 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
我在看《C++ Templates》时,遇到了如下代码在第74页
  1. ……
  2. template <typename T>
  3. void shell(T const& env)
  4. {
  5.         class ShallowChecks{
  6.                 void deref(T::Index ptr){//不是应该用typename T::Index ptr吗?
  7.                         ignore(ptr);
  8.                 }
  9.         };
  10.         typename T::Index I;
  11.         middle(I);
  12. }
复制代码
还有在第77页
  1. ……
  2. friend boll operator<(SortTracer const& a,SortTracer const& b){//这是什么意思?为什么friend还有函数体
  3.         ++n_compared;
  4.         ……
  5.         return a.value < b.value;
  6. }
  7. ……
复制代码
虽然我知道这本书有很多错误,比如经常写错变量名什么的,但是这几处错误就比较明显了吧。

如果不是错误,请高手解释,谢谢
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-9 09:43

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表