Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++CodeIDERAD Studio

A Complete Guide To The List Of Features In C++ 14

A Complete Guide To The List Of Features In C++ 14

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 extended further with the C++14, C++17, and C++20 standards. In the future C++23 is already on the horizon. 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. We released before about to develop modern code with the C++11 standard. In this post, we explain what is new in C++14.

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.

How to use this C++14 guide? 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++ 14 standard features that we can use in programming applications. The present C++14 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++14 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 volumes free.

Also, we highly recommend using a professional C++ compiler with an advanced IDE from the start.

We also released a complete guide to the list of features in C++ 11 before. If you want to learn C++ standards deeply, we recommend you start with C++11 features.

Where I can I learn C++ 14 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.

learncpp2 2347623
RAD Studio IDE with C++ Builder

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++ BuilderDelphi, and their free community editions C++ Builder CE, and Delphi CE are powerful tools for modern application development.

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++ 14

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++ 14 document online that you can use to improve yourself from a moderate level to a professional or advanced level. This complete guide is composed from C++14 features at https://www.open-std.org, and then we prepare daily 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 half of 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++14.

Most examples are compatible with other standards, such as 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++14 in compiler options.

What are the features of C++ 14?

Binary Literals

C++14 brings us fewer but useful features to modern C++ than the standards preceding it. The creator of C++, Bjarne Stroustrup says that improvements in C++14 were deliberately lower in quantity compared to C++11. One of the small but useful features is the introduction of “Binary Literals”.

Learn How To Use Binary Literals In Modern C++

Digit Separators

C++14 comes with the digit separators feature. In C++14 and above, we can use the digit separator  to separate integer numbers such as unsigned int m = 128'000'000;

Learn To Use Digit Separators In Modern C++

Boolean and Integer Literals

A programming language consists of a lot of expressions in our source code. One of elements of expressions in C++ are literals. A more specific type of literal is Integer Literals. Integer literals are primary expressions that allow values of integer types (i.e., decimal, octal, hexadecimal) to be used in expressions directly. They are further improved by the boolean literals (binary digits) in C++14. 

Learn The Useful Integer Literals In Modern C++

The Gets Function Was Removed

 In C++14, the gets function was removed, while fgets or other input functions remain there. If you have older C++ code that uses the gets() functions your C++14 version compiler will not compile it.

Why Was The Gets Function Removed In C++14?

What Does Deprecated Mean And How To Use Deprecated Attribute In C++?

Generic Lambdas

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

Learn How To Use Generic Lambdas In Modern C++

Generalized Lambda Captures

C++14 standard introduced the generalized lambda capture (init capture) that allows you to specify generalized captures, it allows 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

Learn To Use Generalized Lambda Captures In C++

Auto Return Type Deduction

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.

What Is Auto Return Type Deduction In C++?

Aggregate Member Initialization

The Aggregate Member Initialization is one of the features of C++. This feature is improved and modernized with C++11, C++14 and C++20. With this feature, objects can initialize an aggregate member from braced-init-list.

What Is Aggregate Member Initialization In C++?

Variable Templates

The template is one of the great features of modern C++. They are a simple and very powerful statement in C++ that defines the operations of a class or function. The C++14 standard and above allows the creation of variables that are templated. In this article, we will explain variable templates

How To Use Variable Templates In Modern C++

Relaxed Constexpr Restrictions

In C++, the constexpr specifier is used to declare a function or variable to evaluate the value of at compile time, which speeds up code during runtime. This useful property had some restrictions in C++11, these are relaxed in C++14 and this feature is known as Relaxed Constexpr Restrictions

What Are The Relaxed Constexpr Restrictions In C++?

The make_unique (std::make_unique)

Allocating memory and freeing it safely is hard if you are programming a very big application. In Modern C++ there are smart pointers that help avoid the mistake of incorrectly freeing the memory addressed by pointers. Smart pointers make it easier to define and manage pointers, they came with C++11. The most used types of C++ smart pointer are unique_ptrauto_ptrshared_ptr, and weak_ptr. In C++14, there is make_unique (std::make_unique) that can be used to allocate memory for the unique_ptr smart pointers.

What Is make_unique And How To Use With unique_ptr In C++

The std::exchange algorithm

One of the many useful features that come with the C++14 standard is the std::exchange algorithm that is defined in the utility header. The std::exchange algorithm copies the new value to a given object and it will return the old value of that object.

How To Use std::exchange In C++

New And Delete Elisions

In modern C++, we have the new and delete operators that are used to allocate and free objects from memory, and there is the new and delete methods in C++14 and above. When we develop code that requires in-place construction, we need to use new and, possibly, delete operations. They are useful, in a memory pool, as an allocator, as a tagged variant, as a buffer, or as a binary message to a buffer.

Learn How to Use New And Delete Elisions In C++

Decltype (auto) 

The auto keyword arrives with the new features of the C++11 and the standards above. In C++14, there is a new decltype that is used with auto keyword. In modern C++, the decltype(auto) type-specifier deduces return types while keeping their references and cv-qualifiers, while auto does not.

What Is Decltype (auto) In Modern C++ And How To Use It?

Quoted Strings ( std::quoted )

In C++14 and above, there is a std::quoted template that allows handling strings safely where they may contain spaces and special characters and it keeps their formatting intact. The std::quoted template is included in <iomanip> header, and it is used to handle strings (i.e. “Let’s learn from ”LearnCPlusPlus.org!” “) safely where they may contain spaces and special characters and it keeps their formatting intact. 

What Is std::quoted Quoted String In Modern C++?

Shared mutexes and locking

A concurrency support library is designed to solve problems in modern C++ that arise with multi-thread development. 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. In C++14, in addition to mutex, there is a shared_mutex which is an instance of the class located in <shared_mutex> header. 

Learn About Useful Shared Mutexes Locking In Modern C++

What Are The Differences Between Mutex And Shared Mutex In C++?

Tuple Addressing Via Type

The tuple ( std::tuple) is a class template a fixed-size collection of different types of values like floats, integers, texts, etc. and it is defined in the tuple header. In another term tuple stores the different types of elements, it also supports empty lists. This template has been available since C++11 and improved in C++14, and C++20 standards.

How To Use Tuple Addressing Via Type In C++14 And Beyond

Heterogeneous Lookup In Associative Containers

The C++ Standard Library defines four different main container types and one of them is associative containers such as std::map, and std::set. These class types allow us to use the look-up method “find()” by a value based on a value of that type. C++14 introduced the “Heterogeneous Lookup In Associative Containers” feature that allows the lookup to be done via an arbitrary type, so long as the comparison operator can compare that type with the actual key type. 

What Is Heterogeneous Lookup In Associative Containers In C++?

The Standard User-Defined Literals

C++11 introduced new forms of literals using modified syntax and semantics to provide User-Defined Literals (UDL) also known as Extensible Literals. While there was the ability to use them the standard library did not use any of them. In C++14, the commission added some standard literals. 

What Are The Standard User-Defined Literals In C++14?

integral_constant And integral_constant () Operator

Modern C++ has base class features that can be used with other modern features of C++. The std::integral_constant is the base class for the C++ type traits in C++11, and in C++14, std::integral_constant gained an operator () overload to return the constant value.

What Are Integral_constant And () Operator In C++?

The is_final Type Trait

In C++11, the final specifier is used for a function or for a class that cannot be overridden by derived classes, and there was no way to check if that class or method is the final. In C++14, there is a std::is_final type trait that can be used to detect if a class or a method is marked as a final or not.

How Can We Use The is_final Type Trait In C++ 14?

The new begin – end iterators ( rbegin – rend, crbegin – crend)

In C++11, the begin() and end() iterators are used to define the start of iteration and the end of the iteration, mostly used in the for loops.n C++14 , there are new additions to the global std::begin – std::end functions, they were augmented with reverse iterators,  std::rbegin and std::rend. These are available in C++17 too.

What Are The New Begin End Iterators In C++14?

The Integer Sequence (std::integer_sequence)

In modern programming sometimes we want to use a sequence of integers that are created at compile-time. In C++14, the std::integer_sequence is a class template for the sequence of integers that is generated at compile-time. In this post, we explain what integer sequence (std::integer_sequence) is in modern programming.

What Is The Integer Sequence (std::integer_sequence) In C++ 14

The Member Initializers And Aggregates

One of the great features of C++14 was the member initializers and aggregates feature that a class with default member initializers may now be an aggregate. With the new C++14, a class or struct with default member initializers may now be an aggregate in definition.

What Are The Member Initializers And Aggregates Features in C++14?

The New Overloads For Ranges

In C++14, there are pretty good new overloads of std::equalstd::mismatch, and std::is_permutation that can be used to take a pair of iterators for the second range.

What Are The New Overloads For Ranges In C++ 14?

Discourage rand()

The rand() random number generator found as a low-quality random number facility from the C library and it is discouraged in favour of the <random> library. It is recommended to use the Mersenne Twister is a pseudorandom number generators, such as mt19937 or mt19937_64 random number generators.

What Are The Differences Between std::rand() And std::mt19937 In Modern C++?

What Is The mt19937 Random Generator In Modern C++?

cbuilder 11 512x5121x 5814924 9843627

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.

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.