Default lambda as templated parameter of a function
问题 Consider the following code template<bool b, typename T> void foo(const T& t = []() {}) { // implementation here } void bar() { foo<true>([&](){ /* implementation here */ }); // this compiles foo<true>(); // this doesn't compile } In the case that doesn't compile I get the following errors: error C2672: 'foo': no matching overloaded function found error C2783: 'void foo(const T&)': could not deduce template argument for 'T' I think it's clear what I want to achieve: let foo be called with and