摘要: 拖尾返回类型:当模板函数的返回值取决于特定的模板形参时,可以使用 auto 关键字指定返回类型,然后在函数头的 -> 后使用 decltype 操作符来定义返回类型。 decltype(..)是获得一个表达式的结果值的类型。->后的是函数的返回类型。 阅读全文
posted @ 2019-08-31 15:41 htj10 阅读(156) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <cstdarg> int sum(int count, ...) {//接收数量不定的参数 if (count <= 0) return 0; va_list argList; va_start(argList, count); int sum = 0; for (int i = 0; i < count; ++i) { sum += v 阅读全文
posted @ 2019-08-31 10:49 htj10 阅读(171) 评论(0) 推荐(0) 编辑
TOP