Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Library plans for C++0x?

Tags:

c++

c++11

boost

qt

Lately I've been getting very excited about the support for lambdas in VC2010. I'm slowly starting to grasp the full potential this feature has in transforming C++ into something alot better.

But then I realized that this potential greatly depends on main stream support of lambdas in day to day libraries like boost and QT.
Does anyone know if there are plans to extend these libraries with the new features of C++0x?

lambdas practically replace the need for boost::lambda and everything in boost that interacts with it. QT could add support for lambdas in all of their container and maybe even as an alternative way of defining SLOTs

like image 467
shoosh Avatar asked Aug 03 '09 16:08

shoosh


3 Answers

Lambdas already fit very well into existing libraries - anywhere that a function accepts a function object of a type given by a template parameter.

This is one of the great things about them - they're a classic example of a language feature that codifies existing practice in a nifty syntax.

Obviously the boost lambda library becomes redundant, but that means it doesn't require any new features to be added to it.

like image 53
Daniel Earwicker Avatar answered Oct 05 '22 06:10

Daniel Earwicker


I don't see how usage of lambda depends on support by libraries. Lambdas eliminate the need to create many classes just to wrap different small algorithms and neatly fit together with other language/library features (std::function comes to mind). Wherever you used to pass either a function object or a function pointer, lambdas can be used, too.

So they mainly add another alternative for making use of existing code and libraries. The only way I can see for libraries to better support lambda is use more functional-style approaches.

like image 34
sbi Avatar answered Oct 05 '22 06:10

sbi


Chances are such libraries are going to wait until there's proper compiler support for the relevant C++0x features , and not bother much with it until the mainstream compilers do support it. Don't hold your breath.

like image 24
nos Avatar answered Oct 05 '22 06:10

nos