![CompleteGuideToC++111600 | Embarcadero RAD Studio Delphi C++Builder Blogs completeguidetoc11 1600](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2024/01/CompleteGuideToC11_1600-4033856.jpg?resize=1140%2C694&ssl=1)
C++ is one of the most powerful programming languages and it is being improved by every new C++ standard. The “Modern C++” term started with the release of the C++11 standards, and then the C++14, C++17, and C++20 standards followed. In the future C++23 is on the horizon already. Modern C++ consists of a lot of features of previous C++ standards too and, of course, those of the C Programming language from which C++ evolved. Now let’s see how we start to develop modern C++ programs with C++11. In this post, we explain what was new with the C++11 standard.
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 treasure-trove of posts that are great for learning the features of modern C++ compilers with very simple explanations and examples.
Table of Contents
Where can I find beginner level C++ guides?
First of all, if you are a beginner and want to learn C++ programming, this article lists topics related to C++ 11 standard features that we can use in programming applications. The present C++11 guide may require moderate or advanced-level skills in programming. If you are new to C++ programming and want to migrate from building simple exe files to complex professional applications, we highly recommend these free Complete Guide volumes with many examples: Introduction Volume and Basic Volume may be enough to understand these C++11 features below.
In our previous “A Complete Guide to C++” series, we sorted most topics into learning levels. The first 2 volumes are about simple applications and basics of C++, mostly console apps or very simple GUI apps. I think the first 4 volumes are easy for everyone. The 5th volume may require a little bit more mathematics and physics. The 6th and 7th posts may require more advanced programming and engineering skills. Most of the posts are compatible with the latest RAD Studio, C++ Builder 11.2, Dev-C++, and others with CLANG-based C++ compilers. GUI-based posts are using VCL or FMX libraries which means they are only possible with C++ Builder. Here you can reach all of the free C++ tutorial volumes.
Also, we highly recommend using a professional C++ compiler with an advanced IDE from the start.
Where I can I learn C++ 11 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.
![LearnCpp22347623 | Embarcadero RAD Studio Delphi C++Builder Blogs learncpp2 2347623](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2022/10/LearnCpp2-2347623.jpg?resize=750%2C430&ssl=1)
In this guide there are many posts from the LearnCPlusPlus.org, we have more new articles with very simple examples. All these examples in these posts below can be used with these compilers:
RAD Studio’s C++ Builder, Delphi, and their free community editions C++ Builder CE, and Delphi CE are powerful tools for modern application development.
- 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++
Read the FAQ notes on the CE license and then simply fill out the form to download C++ Builder 11 CE.
A Complete Guide To List Of Features In C++ 11
This complete guide is not complete of course (there are a few feature sections that need to be added), but maybe this is the largest C++ 11 document online that you can use to improve yourself from a moderate level to a professional or advanced level. This complete guide is composed of the C++11 Features List at https://docwiki.embarcadero.com, and then we prepare regular online posts about each feature, as much as simple, we may easily update these online documents, and we can add new posts and topics about your requests. We hope all of you C++ developers enjoy this great guide which is built from a year of intense effort.
Here below, We list every feature under section titles with a brief description, then there is a link to more detailed posts that we released before. These links in every feature have more details about the feature, description, headers needed, syntax of it, and other technical details. In addition to technical details in the standard, there are very simple examples and full examples that you can try with any C++ compiler that supports C++11.
Most examples are compatible with other standards, such as C++14, C++17, and C++20. We should note that some features are removed or deprecated in later standards, some are improved and there are more new features related to these features. If you have an error in an example (feature might be deprecated or removed), to compile successfully, you should enable standard -std=C++11 in compiler options.
What are the features of C++ 11?
C99 preprocessor
The C++11 standard intends to resynchronize the preprocessor and translation phases of C++ with C99, to make the two standards more compatible. Predefined macros, pragma operators, and string literal concatenation are some areas in which changes were made. For more information on this feature, see C99 preprocessor Proposal document.
MOVE CONSTRUCTOR : Defining move special member functions
C++11 provides a way of defining move special member functions.
What Is A Move Constructor In Modern C++?
What Is A Typical Declaration Of A Move Constructor?
What is A Default (Forced) Move Constructor in Modern C++
What Is An Implicitly-defined Move Constructor in Modern C++?
What Is A Trivial Move Constructor In Modern C++?
What Is An Eligible Move Constructor In Modern C++?
What Is A Deleted Implicitly-declared Move Constructor In Modern C++?
What Is An Implicitly-declared Move Constructor In Modern C++?
What is The Move Assignment Operator In Modern C++?
Learn How To Use Non-Copyable Movable Types in C++ Templates
Learn How To Eliminate Unnecessary Copying In C++
Allowing move constructors to throw [noexcept]
The C++11 standard provides an alternative to std::move
, which is std::move_if_noexcept
, to solve some problematic interactions between move constructors, templates, and certain standard library member functions. std::move_if_noexcept(x)
grants permission to move x
unless it could throw and the type can be copied.
Allowing move constructors to throw with std::move_if_noexcept
COPY CONSTRUCTOR : Defining copy special member functions
C++11 provides a way of defining copy special member functions.
Learn about Declaration of a Copy Constructor
Learn about Forced Copy Constructor (Default Copy Constructor) in C++
This Is How Trivial Copy Constructors Work In A C++ App
What Is An Eligible Copy Constructor In C++ Software?
Learn about Implicitly-Declared Copy Constructor
Learn About Implicitly-Defined Copy Constructor
Learn about Deleted Implicitly-Declared Copy Constructor in C++
Learn about Deleted Copy Constructor (Avoiding Implicit Generation of the Copy Constructor)
TEMPLATE : Local and unnamed types as template arguments
The C++11 standard allows users to use local and unnamed types as template arguments.
What Is A Template In C++?
What Is A Function Template In C++?
What Are The Type Template Parameters In C++
Learn Type Parameters For Templates In C++
Learn To Use Type Template Parameter Pack In C++
Learn What Is A Variadic Template in C++
Learn How To Eliminate Pointers In Templates in C++
Learn What Is Template Instantiation in C++
Learn What Is Explicit Instantiation of a Template in C++
Learn What Is Implicit Instantiation Of A Template In C++
Alias templates
With the increased use of parameterized types in C++, the need for parameterized type aliases has grown. C++11 adds this feature to the standard.
Learn How To Use Alias Template In C++
Extern templates
Extern templates is a feature supported by both BCC32 and the Clang-enhanced C++ compilers.
Learn About Extern Templates In Modern C++
LAMBDA : Lambda Expressions
The C++11 standard adds lambda expressions.
The Step-by-Step Guide To Lambda Expressions In A C++ App
Learn To Use Powerful Lambda Expressions In C++ On Windows
The Pros And Cons Of Lambda Expressions In A C++ App
Learn To Use Generalized Lambda Captures In C++
Learn How To Use Generic Lambdas In Modern C++
THREAD : Multi-Thread operations
In modern C++, a concurrency support library is designed to solve problems in multi-thread operations. This library includes built-in support for threads (std::thread
), atomic operations (std::atomic
), mutual exclusion (std::mutex
), condition variables (std::condition_variable
), and many other features. The std::thread
class is a special class defined in <thread> header that comes with C++11, and it allows multiple functions to execute and represents a single thread of execution concurrently.
How To Use std::thread In Modern C++?
How To Use std::thread With std::vector In Multi-Thread C++ Operations
How To Use Lambda Expression With std::thread In C++?
How To Use Functor Object With std::thread In C++?
What Is A Data Race In Multi-threading C++ Apps And How To Avoid It
How To Solve Data Race Problems In Modern C++?
ATOMIC : Atomic operations
C++11 adds atomic types and operations to the standard. Atomic types and operations provide a way of writing multi-threaded applications without using locks.
What Is Atomic (std::atomic) In Modern C++?
What Are Atomic Logic Operations In Modern C++?
What Are Useful Atomic Load And Store Operations In C++?
What Are Atomic Add And Sub Operations In C++?
Important To Learn std::memory_order In C++ Atomic Operations
Allow atomics use in signal handlers
C++11 allows the use of atomics in signal handlers.
How To Allow Atomics Use In C++ Signal Handlers
How to Use Atomic_flag In Modern C++?
Mutual exclusion Mutex
C++11 added the std::mutex class that its object prevents multiple threads from accessing the same shared resource simultaneously.
What Is A Mutex Mutual Exclusion In Modern C++
Strong Compare and Exchange
C++11 provides both weak and strong compare-and-exchange operations. Compare-and-exchange operation is an atomic operation used in multi-threaded applications to achieve synchronization.
Learn Strong Compare and Exchange In Modern C++
What Is Weak Compare and Exchange In Modern C++?
Bidirectional Fences
A fence is a primitive that enforces ordering between preceding loads or stores and subsequent loads or stores. C++11 improves the support for bidirectional fences.
Learn Useful Bidirectional Fences In Modern Multi-threading C++ Apps
Rvalue references description
rvalue references is a feature supported by both BCC32 and the Clang-enhanced C++ compilers.
Learn About Using C++ rvalue References In The C++Builder BCC32 Compiler
Rvalue references for *this
rvalue references for *this
is a C++11 feature that is intended to extend the benefits of move semantics to the implicit *this
parameter.
Initialization of class objects by rvalues
C++11 standard introduces the ability to initialize class objects by rvalues, to write clear, concise, and efficient code. This means that temporaries are now initialized directly from the entire rvalue object, instead of calling a constructor to copy the object into the temporary.
Learn The Initialization Of Class Objects By Rvalues When Building Windows Apps In C++
Non-static data member initializers
C++11 introduces the possibility of initializing non-static data members within the class declaration. The initializers for non-static data members are limited to =initializer-clause
and {initializer-list}
.
What Is Aggregate Member Initialization In C++?
Variadic templates
Variadic templates refer to class or function templates that can have a variable number of parameters. In order to achieve this, C++11 introduces parameter packs to represent a list of zero or more parameters.
Learn What Is A Variadic Template in C++
Extending variadic template template parameters
During real-world experimentation with variadic templates, some limitations regarding template template parameters were uncovered. C++11 standard extends the variadic template template parameters in order to resolve this issue.
Learn To Use Type Template Parameter Pack In C++
Initializer lists
Initializer lists is a feature that has been extended in C++11 standard. An initializer list represents a list of ordered arguments, in curly brackets, that is used to initialize structures, classes, and arrays. Until C++11, only classes that conformed to the Plain Old Data (POD) definition could be initialized using initializer lists. Now, classes like std::vector
can also be initialized using initializer lists. This is done by using a template named std::initializer_list<>
that can be passed as an argument to constructors or other functions.
How To Learn initializer_list (std::initializer_list) In Modern C++
Static assertions
Static assertions is a feature supported by both BCC32 and the Clang-enhanced C++ compilers.
What Is Static Assertion And How To Use static_assert In C++?
Auto-typed variables (auto keyword)
auto-typed variables is a C++11 feature that allows the programmer to declare a variable of type auto
, the type itself being deduced from the variable’s initializer expression. The auto
keyword is treated as a simple type specifier (that can be used with *
and &
), and its semantics are deduced from the initializer expression.
Learn What auto And Auto-Typed Variables Are In Modern C++
New function declarator syntax
This C++11 feature changes the semantics of auto
and introduces syntax for function declarators. The auto
type-specifier signifies that the type of a variable being declared shall be deduced from its initializer expression or specified explicitly at the end of a function declarator.
Declared type of an expression
The declared type of an expression is a feature supported by both BCC32 and the Clang-enhanced C++ compilers.
What Is Decltype (auto) In Modern C++ And How To Use It?
Incomplete return types
The requirement for a function call expression’s type to be complete, when used as a decltype
parameter is not just unnecessary, but harmful too.
In C++11, when the parameter of a decltype
expression is a function call expression returning a class type, the type is not required to be complete. Also, a temporary object is not introduced for the return value, saving storage space, and not invoking the destructor.
What Does The decltype Type Specifier Mean In C++?
Right angle brackets
In the Clang-enhanced C++ compilers, two consecutive right angle brackets no longer generate an error, and these constructions are treated according to the C++11 standard.
What Is The ‘>>’ Right-Angle Bracket Support In C++?
Default template arguments for function templates
The impossibility of setting default template arguments for function templates has been limiting the programming style for a long time. In C++11, such default arguments can be used.
Solving the SFINAE problem for expressions
C++11 standard solves the substitution failure is not an error (SFINAE) problem for expressions. This is done by allowing fully general expressions with the condition that most errors generated by these expressions are treated as SFINAE failures instead of errors.
Null pointer constant
C++11 introduces nullptr
, the null pointer constant, in order to remove the ambiguity between 0 and a null pointer. Although the NULL
macro exists, it is insufficient because it cannot be distinguished from the integer 0 in a call to a function that has one overload with an int
parameter and another with a char*
parameter. Therefore, nullptr
is now a reserved word. The integer 0 will not be implicitly converted to any pointer type. The null pointer can only be converted to any pointer type.
Learn What A Null Pointer Constant (nullptr) Is In Modern C++
Strongly-typed enums
Strongly-typed enums is a feature supported by both BCC32 and the Clang-enhanced C++ compilers.
Everything You Need To Know About Strongly Typed Enums In Modern C++
Forward declarations for enums
Forward declarations for enums is a feature supported by both BCC32 and the Clang-enhanced C++ compilers.
What is a Forward Declaration enum Enumeration in C++?
Generalized constant expressions
C++11 standard generalizes the notion of constant expressions to include calls to simple functions (constexpr functions) and objects of user-defined types that are constructed from simple constructors (constexpr constructors).
What Are Generalized Constant Expressions (constexpr) In C++?
Alignment support
The C++11 standard intends to extend the standard language and library with alignment-related features, known as alignment support. These alignment features include:
- The alignment specifier
alignas
for declarations. - The
alignof
expression to retrieve alignment requirements of a type. - Alignment arithmetic by library support (
aligned_storage
,aligned_union
). - std::align standard function for pointer alignment at run time.
What Is The alignas Alignment Specifier In Modern C++?
What Is The alignof Expression In Modern C++?
What Is aligned_alloc In Modern C++?
What is aligned_storage in Modern C++
What is aligned_union in Modern C++
How To Use std::align In Modern C++
Delegating constructors
C++11 introduces the possibility of delegating constructors. This means that class constructors can be invoked within other constructors of the same class. This is a very useful feature that helps programmers to write less and more expressive code.
What Are Delegating Constructors In Modern C++?
Explicit conversion operators
With C++11, explicit-qualified conversion functions work in the same context as explicit-qualified constructors and produce diagnostics in the same contexts as constructors do. This is done in order to avoid situations when the compiler uncomplainingly accepts code that is not semantically correct.
What Is An Explicit Conversion Operator In Modern C++?
New character types
C++11 introduces new character types to manipulate Unicode character strings.
Learn Unicode Character Types and Literals in Modern C++
Unicode string literals and raw string literals
C++11 introduces new character types to manipulate Unicode string literals and raw string literals.
Everything You Need To Use String Literals in Modern C++
Universal character names in literals
In order to make the C++ code less platform-dependent, C++11 lifts the prohibitions regarding control and basic source universal character names within character and string literals. Prohibitions against surrogate values in all universal character names are added.
User-defined literals
C++11 introduces new forms of literals using modified syntax and semantics in order to provide user-defined literals. Using user-defined literals, user-defined classes can provide new literal syntax.
Learn How To Use User Defined Literal Operators In Modern C++
Standard Layout Types
C++11 separates trivial special member requirements from layout requirements in order to create a cleaner specification. POD (Plain Old Data) types are now defined in terms of two new categories: trivial types and standard-layout types. In C++11 standard-layout types are allowed to have base classes. However, the base classes are not allowed to have virtual members or virtual bases. Also, standard-layout types are allowed to have access control.
Defaulted functions
A defaulted function is a function that contains =default;
in its prototype. This construction indicates that the function’s default definition should be used. Defaulted functions are a C++11 specific feature.
What Is Defaulted Function or Method In Modern C++ Now?
Deleted functions
A deleted function is a function that contains =delete;
in its prototype. This construction, introduced with C++11, indicates that the function may not be used. This construction can be used to forbid the usage of default language facilities (like default constructors or default operators) or problematic conversions.
What Is A Deleted Function In Modern C++?
Extended friend declarations
C++11 extends the current language to support a wider range of friend
declarations.
What Is An Extended Friend Declaration in Modern C++?
Extending sizeof
C++11 extends the functionality of sizeof
so that class members can be sent as parameters even if no object has been instantiated.
What Is An Extended sizeof In Modern C++?
Inline namespaces
C++11 standard allows the inline
keyword in a namespace-definition
. This is done in order to specify that members of the namespace can be defined and specialized as though they actually belong to the enclosing namespace.This construction is called inline namespace and solves the problem where templates could only be specialized in their actual namespace, and not in the namespace they have been imported.
What Is The Inline Namespace Feature In Modern C++?
Unrestricted unions
The C++11 standard loosens up the restriction regarding members of unions. So, in Clang-enhanced C++ compilers, all types can be union members, except reference types.
What Is The Unrestricted Unions Feature In Modern C++?
Local and unnamed types as template arguments
The C++11 standard allows users to use local and unnamed types as template arguments.
Range-based for
Range-based is a feature introduced by the C++11 standard. In Clang-enhanced C++ compilers, you can create for
loops that iterate through a list or an array without computing the beginning, the end, or using an iterator.
What is a range-based for loop in modern C++?
Explicit virtual overrides
Regarding virtual overrides, C++11 tends to tighten the rules, to detect some problems that often arise.To achieve this goal C++11 introduces two new contextual keywords:
- final specifies that a method cannot be overridden or a class cannot be derived.
- override specifies that a method overrides a virtual method declared in one of its parent classes.
Learn How To Use The Final Specifier In Modern C++
Learn How To Use The Override Specifier In Modern C++
What Is An Explicit Virtual Override in Modern C++?
What Is A Virtual Function Specifier In Modern C++?
What Is The Explicit Specifier In Modern C++?
Propagating exceptions
The C++11 standard offers the possibility of moving an exception from one thread to another. To do that, some modifications have been made to the <exception>
header.
How To Use Propagating Exceptions In Modern C++?
Callable Object (Functor)
One of the features from C11 is functor, an early function object in C++. The functor function objects are callable objects. A functor or function object is any object for which the function call operator is defined.
What Is A Function Object Functor In C++?
__func__ predefined identifier
This feature is used to capture function names as string literals and to assist diagnostic libraries.
Learn To Use Predefined Identifier __func__ In C++
long long type
To be more compatible with C99, C++11 standard introduces the long long integral type.
What Is The Long Long Int Type In C++?
![IoTContestDetailspng | Embarcadero RAD Studio Delphi C++Builder Blogs | Embarcadero RAD Studio Delphi C++Builder Blogs cbuilder 11 512x5121x 5814924 9843627](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2024/01/CBuilder_11_512x5121x-5814924-9843627.png?w=750&ssl=1)
C++ Builder is the easiest and fastest C and C++ IDE for building applications. 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.
You can download the free C++ Builder Community Edition here: https://www.embarcadero.com/products/cbuilder/starter.
Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. Please visit https://www.embarcadero.com/products/cbuilder.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition