Articles & Books

Requires-clause--Andrzej KrzemieĊ„ski

Learn about the close future.

Requires-clause

by Andrzej Krzemieński

From the article:

In this post we will talk about another C++20 feature related to constraining templates: requires-clause. Although C++20 is due to be published this year, it is not there yet; so we are talking about the future. However, this can already be tested in trunk versions of GCC and Clang online in Compiler Explorer...

C++20: Coroutines - A First Overview--Rainer Grimm

They will change a lot of things.

C++20: Coroutines - A First Overview

by Rainer Grimm

From the article:

C++20 provides four features that change the way we think about and write modern C++: concepts, the ranges library, coroutines, and modules. I already wrote a few posts to concepts and the ranges library. Let's have a closer look at coroutines...

C++20: Python's map Function--Rainer Grimm

The series continue.

C++20: Python's map Function

by Rainer Grimm

From the article:

Today, I finish my experiment writing beloved Python functions in C++. So far, I implemented the Python functions filter, range, and xrange. Today, I have a closer look at the map function and combine the functions map and filter into one function...

Literal classes as non-type template parameters in C++20 -- Kevin Hartman

Using user-defined literal classes as non-type template parameters in C++20.

Literal classes as non-type template parameters in C++20

by Kevin Hartman

 

From the article:

/**
* Prints whether or not a value was provided for "maybe" WITHOUT branching smile
*/
template<OptionalInt maybe>
void Print() {
    if constexpr(maybe.has_value) {
        std::cout << "Value is: " << maybe.value << std::endl;
    } else {
        std::cout << "No value." << std::endl;
    }
}

[intermediate][C++20]