2013年2月15日

C++ 中的primitive type/fundamental type/conversion

摘要: 前两天在面试的时候其中遇到一个小问题:需要比较一个字符串str_value (value = "10") 和unsigned int int_value 10, 当时没细想就随手写了一个str_value == int_value.str(),对面指出unsigned int并不包含str()方法应该是过不了编译。 后来干脆从另一个方便用atoi把c style的字符串转化成int再和int_value比较 (atoi(str_value.c_str()) == int_value。和java中Interger类都有parse()的方法不同,C++中fundamental 阅读全文

posted @ 2013-02-15 09:50 梁霄 阅读(394) 评论(0) 推荐(0)

导航