Lambda is deduced to std::function if template has no variadic arguments

前端 未结 2 1409
有刺的猬
有刺的猬 2021-02-07 22:08
template
void foo(std::function callback)
{}

template
voi         


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-07 22:32

    You don't have any deduction for the type parameters of bar, they are fully specified.

    You still have the tail of the pack to deduce in foo, and that fails because the lambda isn't a std::function.

提交回复
热议问题