The Third Edition of my book, Modern C++ Programming Cookbook (ISBN 978-1835080542) has been published by Packt. The book can be ordered from Amazon and Packt. The book is organized in recipes, much like a cookbook. These recipes, in turn, are organized in sections that introduce you to the topic, list any necessary pre-requisites and…
Tag: C++23
Notes on std::optional’s monadic operations
The C++23 standard includes several new functions to the std::optional class: and_then, transform, or_else. These are monadic operations and are intended to simplify the chaining of several operations that may or may not produce a value. In this post, I want to briefly present these functions and to make some observations on them. A starting…
How to make chunks of a range in C++23
Last year, I wrote a blog post about new C++23 range adaptors for joining and zipping. The C++23 standard includes a longer lists of range adapters (you can find a list here). Among them, there are several adaptors used for creating views consisting of chunks or “windows” of the elements of a given range. In…
The C++23 standard break-down
A break-down of the most important features of C++23 with description and links to learning resources.
Three new utility functions in C++23
Some time ago I wrote a blog post called Three C++23 features for common use. In this article, I want to continue on that idea and discuss three new utility functions that were added to C++23.
Using the C++23 std::expected type
The C++23 standard will feature a new utility type called std::expected. This type either contains an expected value, or an unexpected one, typically providing information about the reason something failed (and the expected value could not be returned). This feature is, at this time, supported in GCC 12 and MSVC 19.33 (Visual Studio 2022 17.3)….
Three C++23 features for common use
C++23 is the current working version of the C++ standard. No major feature has been included so far, but a series of smaller ones as well as many defect reports have made it already to the standard. Many of these new features are small improvements or things you probably wouldn’t use on a regular basis. However, I want to point here to three C++23 features that, in my opinion, stand out among the others as more likely to be used more often.
The Evolution of Functions in Modern C++
In programming, a function is a block of code that performs a computational task. (In practice, people write functions that perform many tasks, which is not very good, but it’s a topic beyond the purpose of this article). Functions are a fundamental concept of programming languages and C++ makes no exception. In fact, in C++ there is a large variety of functions that has evolved over time. In this article, I will give a brief walkthrough of this evolution starting with C++11. Since there are many things to talk about, I will not get into too many details on these topics but will provide various links for you to follow if you want to learn more.
The little functions that matter
Starting with C++20, some very useful functions for searching have been added to some standard containers, such as std::map, std::set, and std::string. These have been required for a long time and it’s good to see that the committee finally agreed upon their value. I hope this is the beginning of some wonderful additions.