c++ - C++11 and the lack of polymorphic lambdas - why? -


i've been reviewing draft version of c++11 standard. section on lambdas, , confused reasoning not introducing polymorphic lambdas.

for example, amongst 100001 ways polymorphic lambdas used, had hoped use code such following:

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

what reasons:

  • was committee ran out of time?

  • that polymorphic lambdas hard implement?

  • or perhaps seen not being needed ptb?

note: please remember example above not one, , provided guide types of code. answers solely concentrate on providing workaround above piece of code not considered valid!

related sources:

the reason don't have polymorphic lambdas explained pretty in this posting.

it has concepts feature pulled c++11: essentially, polymorphic lambdas ordinary, unconstrained function templates , didn't know how typecheck concept-constrained template used unconstrained template. however, solving problem turns out easy shown here(dead link), don't think there's obstacle remaining.

the link cpp-next dead; relevant info can found here


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -