C++0x and the Lack of Polymorphic Lambdas - Why?

Posted by Dominar on Stack Overflow See other posts from Stack Overflow or by Dominar
Published on 2011-01-10T01:34:36Z Indexed on 2011/01/10 1:53 UTC
Read the original article Hit count: 512

Filed under:
|
|
|
|

I've been reviewing the draft version of the upcoming C++0x standard. Specifically the section on lambdas, and am confused as to the reasoning for not introducing polymorphic lambdas.

I had hoped we could use code such as the following:

template<typename Container>
void foo(Container c)
{
   for_each(c.begin(),c.end(),[](T& t) { ++t; });
}

What were the reasons:

  • Was it the committee ran out of time?

  • That polymorphic lambdas are too hard to implement?

  • Or perhaps that they are seen as not being needed by the PTB?

© Stack Overflow or respective owner

Related posts about c++

Related posts about lambda