在lambdas
答案: 在c 14
使用名称空间std;
auto u = make_unique
#include
(std :: suolide_ptr&p){返回std :: move(p); }); 断言(lambda()); 断言(!lambda()); } [2 模板 类Capture_impl { t x; f f; 民众: Capture_impl(T && X,F && f) :x {std :: forward (x)},f {std :: forward (f)} {} {} 模板 auto operator()(ts && ... args) - > decltype(f(x,std :: forward (args)...)){ 返回f(x,std :: forward (args)...); } 模板 auto operator()(ts && ... args)const - > decltype(f(x,std :: forward (args)...)){ 返回f(x,std :: forward (args)...); } }; 模板 capture_impl capture(t && x,f && f){ 返回captution_impl ( std :: forward (x),std :: forward (f)); } [2
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3