2011年6月4日

怎样区分 const char* 和字符串文字量

摘要: 在一个面试中,猛然间一闪念,问到了 candidate 这个问题。无解……stl 中使用到了很多 traits 技术,只要懂得 traits ,这个问题就太简单了!以下是代码示例:软件工程中很多地方,如果采用直接的办法不能解决问题,增加一个间接层,问题即迎刃而解,type_traits 就是这样一种技术,这个代码示例是自包含的,除了 printf ,没有任何其它外部依赖。#include struct true_{};struct false_{};template struct isarray;templatestruct isarray { typedef true_ type; };t. 阅读全文

posted @ 2011-06-04 19:22 能发波 阅读(253) 评论(0) 推荐(0)

导航