Can lambda functions be templated?

前端 未结 11 2564
你的背包
你的背包 2020-11-28 01:44

In C++11, is there a way to template a lambda function? Or is it inherently too specific to be templated?

I understand that I can define a classic templated class/fu

11条回答
  •  猫巷女王i
    2020-11-28 01:52

    In C++20 this is possible using the following syntax:

    auto lambda = [](T t){
        // do something
    };
    

提交回复
热议问题