摘要:
template<typename T,typename P> struct type_para { typedef T type; P p; ..... }; template<typename T,typename ...AK> auto create(AK&&... ak) { return 阅读全文
posted @ 2017-01-08 09:33
abelian
阅读(153)
评论(0)
推荐(0)
摘要:
一,判断在类中某个函数(也可以是变量或类型)是否存在 template<typename T> struct xxxx_detector { template<typename P,void (P::*)(void)> struct detector{}; template<typename P> 阅读全文
posted @ 2017-01-08 09:31
abelian
阅读(147)
评论(0)
推荐(0)
摘要:
一,判断在类中某个函数(也可以是变量或类型)是否存在 template<typename T> struct xxxx_detector { template<typename P,void (P::*)(void)> struct detector{}; template<typename P> 阅读全文
posted @ 2017-01-08 09:22
abelian
阅读(259)
评论(0)
推荐(0)
摘要:
首先我们的第一步当然是将tuple解包。tuple提供了一个get函数来获取第N个元素。例如: get<1>(make_tuple(...)); 要将一个tuple全部拆解,就可以使用通过多次调用这个函数来进行解析,例如: auto tup = make_tuple(..........); fun 阅读全文
posted @ 2017-01-08 09:06
abelian
阅读(358)
评论(0)
推荐(0)
摘要:
元组是一种长度固定的允许有不同类型元素的集合,根据元素的个数不同又分别称作一元组、二元组、三元组等。C++11中标准库增加了一个叫std::tuple的类模板,用于表示元组。 下面的代码演示了使用C++创建一个三元组。 auto tuple = std::make_tuple(1, 'A', "te 阅读全文
posted @ 2017-01-08 01:34
abelian
阅读(2099)
评论(0)
推荐(0)
浙公网安备 33010602011771号