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…

New standard library features in Visual C++ 2017 RC

The new Visual C++ 2017, currently in release candidate phase, provides a series of updates and fixes to both the C++ compiler and the standard library. A comprehensive list of these improvements is available at What’s New for Visual C++ in Visual Studio 2017 RC. In this article, I want to shortly look at the…

Optional and Named Parameters in C# 4.0

So far, C#, unlike C++, did not support optional arguments. For instance, suppose you need a function to print log a message, that can add a new line or not after writing the message. Most of the times you want a new line, so you don’t want to specify that for most of the calls….