Hello fellow C++ Developers. This week we continue to explore features from the C++14 standard. One of the features that comes with C++14 is auto return type deduction,. We explain auto return type deduction with very simple examples including lambda and template examples. The Lambda Expression construct is introduced in C++ 11 and further developed in the C++14, C++17, and C++20 standards. In C++14, lambda expressions are improved by the generalized lambda (generic lambda) and we explain how you can use generalized lambda captures in modern C++.
Our educational LearnCPlusPlus.org site has a broad selection of new and unique posts with examples suitable for everyone from beginners to professionals alike. It is growing well thanks to you, and we have many new readers, thanks to your support! The site features a plethora of posts that are great for learning the features of modern C++ compilers with very simple explanations and examples.
Table of Contents
Where I can I learn C++ and test these examples with a free C++ compiler?
If you don’t know anything about C++ or the C++ Builder IDE, don’t worry, we have a lot of great, easy to understand examples on the LearnCPlusPlus.org website and they’re all completely free. Just visit this site and copy and paste any examples there into a new Console, VCL, or FMX project, depending on the type of post. We keep adding more C and C++ posts with sample code. In today’s round-up of recent posts on LearnCPlusPlus.org, we have new articles with very simple examples that can be used with:
- The free version of C++ Builder 11 CE Community Edition
- or a professional version of C++ Builder
- or free BCC32C C++ Compiler and BCC32X C++ Compiler
- or the free Dev-C++
How to use modern C++ with C++ Builder?
C++11 allowed lambda functions to deduce the return type based on the type of the expression given to the return statement. The C++14 standard provides return type deduction in all functions, templates, and lambdas. C++14 allows return type deduction for functions that are not of the form return expressions. In this post, we explain the auto keyword, what is an auto type deduction, and how we can use it in functions, templates, and lambdas. In the first post, explain what is auto return type deduction.
Lambda Expressions allow users to write an inline expression that can be used for short snippets of code in your C++ app which are not going to be reused and don’t require naming. The Lambda Expression construct is introduced in C++ 11 and further developed in the C++14, C++17, and C++20 standards. In C++14, lambda expressions are improved by the generalized lambda (generic lambda) or initialized lambda feature, and in the next post, we remember what lambda is and explain what a generic lambda is, and how we can use it.
C++14 standard introduced the generalized lambda capture (init capture) that allows you to specify generalized captures. It allows you to use move capture in lambdas. In C++14, lambda expressions are improved by the generalized lambda (generic lambda) and by this generalized lambda captures. In the next post, we explain how to use generalized lambda captures in modern C++.
If you are new to modern C++ and want to learn more about lambda expressions, we have a lot of examples about lambda operations in our educational LearnCPlusPlus.org site and all is free. We listed some of them below too.
How to learn modern C++ for free using C++ Builder?
LearnCPlusPlus.org has been producing full of educational daily articles about C and modern C++ that can be used with C++ Builder, C++ Builder CE, Dev-C++, BCC Compiler and some other compilers such as the GCC compiler. Here are our post picks for today.
Want to know more about lambdas? Here are some of our previously released posts,
We like to hear your feedback. You motivate us so much with your likes and comments on social media (find us on Facebook, LinkedIn, Reddit, Twitter / X and all over) and here on the blogs too. Thank you for your valuable comments and questions. All of them help improve the quality of our future posts.
We have a lot of unique posts waiting to come. We keep adding new topics every week about C++ in general and specific topics for C++ Builder, Dev-C++, and for the other C++ compilers. Please keep following our LearnCPlusPlus.org website for the latest posts and updates. Feel free to comment and share with your colleagues, students, members – knowledge is power, and knowledge shared is empowering.
Do you want to know some news about C++ Builder 12?
A few weeks ago, David Millington, Senior Product Manager of C++ Builder, released a new video about “Behind the Build: RAD Studio and C++Builder 12.0“. According to David Millington’s post, C++ Builder is aiming to include some amazing features and a lot of performance improvements in operations. C++Builder 12 plans to bring some massive improvements, the enhanced Clang toolchain and Visual Assist integration, substantial improvements across RTL, STL, debugging, and more. Here is the full presentation,
Here are a few of my notes,
- Comes with a special CLANG 15 Win64 compiler
– Win64 is a primary OS
– New Clang means support for C++20 and a lot of C++23 features
– Important to have more compatible standards and amazingly faster
– In memory allocation operations, it is 6 to 14% faster than the current CLANG Win64 compiler in C++ Builder
– In unordered map hashing, STL performance is 60 to 70% faster than the current CLANG Win64, and 40 to 70% faster than the current CLANG Win32 in C++ Builder
- Comes with a new Visual Assist in the IDE
– Fast code completion
– Navigation and refactoring
– and more
- Debugging will use PDB outputs within the IDE
- VCL and FMX have not adopted yet, this may take time
- This presentation is an early preview, unfiltered and incomplete, they do not promise these features to be in 12.0
Please note that all comments and statements about potential new features are subject to change and should not be relied on until the GA release of a product is available.
C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.
There is a free C++ Builder Commun