C TemplateCornerCases计算机等级考试

文章作者 100test 发表时间 2010:01:01 12:14:50
来源 100Test.Com百考试题网


  编辑特别推荐:

  全国计算机等级考试(等考)指定教材

  全国计算机等级考试学习视频

  全国计算机等级考试网上辅导招生

  全国计算机等级考试时间及科目预告

  百考试题教育全国计算机等级考试在线测试平台

  全国计算机等级考试资料下载

  全国计算机等级考试论坛

  Following are some corner cases of C template features. A lot of the text is simply extracted from "C Templates: The Complete Guide", with some of my personal understanding. These features are trivial and easily neglected, but you should have some impression to them in case you run into troubles caused by the neglect.
  I made my notes in English, and I dont bother to translate them into Chinese, forgive my laziness.
  0. use "typename" to extract type defined within a type parameter, like this: typename T::iterator itr. otherwise the itr is treated as a data member of T.
  1. zero initialization
  When using a var x of type T, we MUST initialize it like this: T x = T(). so that when T is a primitive type, x can also be initialized with 0, or NULL (when T is a pointer type). Of course we must make sure
  when T is a class type, it has a default constructor. Simply using T x. cant initialize x when T is a primitive type.
  2. .template
  The .template Construct
  A very similar problem was discovered after the introduction of typename. Consider the following example using the standard bitset type:
  template

相关文章


在rich:inplaceSelect中使用布尔型的0selectItem时碰到的问题计算机等级考试
Finereport制作详细过程计算机等级考试
利用数字签名超越JavaApplet的安全限制计算机等级考试
wince读取DSK容量计算机等级考试
C TemplateCornerCases计算机等级考试
Struts验证与测试计算机等级考试
Tomcat调优的方法计算机等级考试
EffectiveJavaItem5在可以重用对象的时候避免创建对象计算机等级考试
java实现jseval功能计算机等级考试
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛