摘要:
//参考 http://prglab.com/cms/pages/c-tutorial/advanced-concepts/templates.php函数模板( Function templates) 模板(Templates)使得我们可以生成通用的函数,这些函数能够接受任意数据类型的参数,可返回任意类型的值,而不需要对所有可能的数据类型进行函数重载。这在一定程度上实现了宏(macro)的作用。它们的原型定义可以是下面两种中的任何一个: template <class identifier> function_declaration; template <typename i 阅读全文
posted @ 2012-07-06 15:35
瑞尼书苑
阅读(3391)
评论(0)
推荐(0)
摘要:
#include <string>//使用C++标准库的string类时using namespace std;//同上#include <sstream>#include <iostream>#include <stdlib.h>//要将string类和int类型直接转换最好有这些包含, //因为自己写一个转换函数比较方便,函数定义参考如下:string getstring(const int n){std::stringstream newstr;newstr<<n;return newstr.str();}string转CStr 阅读全文
posted @ 2012-07-06 09:39
瑞尼书苑
阅读(236)
评论(0)
推荐(0)
浙公网安备 33010602011771号