看程序总结几点
1.MfwTestSuite<MTTD::FriendServicePrx>
很少用到类模板,看到这个,陌生的感觉,就是MTTD::FriendServicePrx这种类型的一个类,看模板里面
template <typename T>
T get(const string &key, const T &def = T())
{
string &val = m_opts[key];
if (val.empty())
{
return def;
}
return UtilString::strto<T>(val);
}
string get(const string &key, const string &def = "")
{
return get<string>(key, def);
}
上面就是函数模板,没什么纠结的,下面是针对T是string类型的函数模板特化
2.#define iscmd(x, ...) test.iscmd(x, ##__VA_ARGS__)
这是什么,我看的一脸懵逼,查了之后发现曾经还是了解过的
...:表示宏的参数不定,变参宏
__VA_ARGS__:系统预定义宏,自动替换成参数列表