在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