Consider the following:
//--------------------------------------------------------------------
template<int Amount, typename Elem_t>
void foo(Elem_t(*func)(int)) {}
int bar(int i) { return i; }
int main()
{
foo<10>(bar); // Compiles
foo<10>([](int i)->int { return i; }); // Does not compile
foo<10, int>([](int i)->int { return i; }); // Compiles
}
//--------------------------------------------------------------------
(At least so with clang.)
With the regular old function, foo() can be called without having to
specify the second template parameter. However, with lambdas it has
to be specified. Why?
--- news://
freenews.netfront.net/ - complaints:
ne...@netfront.net ---