...

/

The consteval Keyword

The consteval Keyword

Understand the use of the 'consteval' keyword in C++20.

We'll cover the following...

With C++20, we get two new keywords: consteval and constinit. Keyword consteval produces a function that is executed at compile time, and constinit guarantees that a variable is initialized at compile time. Now, you may have the impression that both specifiers are quite similar to constexpr. To make it short, you are right. Before I compare the keywords consteval, constinit, constexpr, and good old const, I have to introduce the new specifiers consteval and constinit.

Introduction

The consteval creates a ...