c – lambda表达式的变体模板
发布时间:2020-12-16 05:51:13 所属栏目:百科 来源:网络整理
导读:用g做什么正确的方法? template typename F void g (F f);template typename ... A void h (A ... a);template typename ... A void f (A ... a) { g ([a] () { h (a...); }); // g++-4.6: error: parameter packs not expanded with ?...?} 解决方法 我想
用g做什么正确的方法?
template < typename F > void g (F f); template < typename ... A > void h (A ... a); template < typename ... A > void f (A ... a) { g ([&a] () { h (a...); }); // g++-4.6: error: parameter packs not expanded with ?...? } 解决方法
我想你也需要在捕获列表中扩展包,如下所示:
template < typename ... A > void f (A ... a) { g ([&,a...] () { h (a...); }); } 以下是C 0x最终委员会草案的相关文本,第5.1.2.23节:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |