New Features of C ++ 0x: lambda expressions

Source: Internet
Author: User

(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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.