用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节:
A capture followed by an ellipsis is a
pack expansion (14.5.3). [ Example:06001
— end example ]
原文地址:https://www.jb51.cc/c/113545.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。