(This article is taken from the reply to your post in the C ++ Forum .)
Gcc4.5 introduces this feature. If you are interested, compile and test the following code:
# Include <algorithm> # include <cmath> void abssort (float * X, unsigned N) {STD: Sort (x, x + N, [] (float, float B) {// note the square arc return STD: ABS (a) <STD: ABS (B );});}
For more information, see:
1) http://gcc.gnu.org/gcc-4.5/cxx0x_status.html
2) http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf
3) http://www.ibm.com/developerworks/cn/aix/library/au-gcc/
Note: You need to add the compiler option-STD = C ++ 0x or-STD = GNU ++ 0x.
The QT project can be used: qmake_cxxflags + =-STD = C ++ 0x
[Edit] Support for C ++ 0x in VC10:
C ++ 0x core language features in VC10: The table
Bytes:
Http://blogs.msdn.com/ B /vcblog/archive/2008/10/28/lambdas-auto-and-static-assert-c-0x-features-in-vc10-part-1.aspx
Http://www.kuqin.com/language/20090615/56815.html