Articles & Books

The Iterator Protocol -- Rainer Grimm

A C++ story, as-if ghostwritten by Frederick Forsyth...

The Iterator Protocol

by Rainer Grimm

From the article:

Here is the question I want to answer: What interface must a user-defined type support to be usable in a range-based for-loop. ...

Insights from the second year of running online C++ job fairs

Looking at the second year of Meeting C++ online job fairs

Insights from the second year of running online C++ job fairs

by Jens Weller

From the article:

An overview on the second year of organizing online job fairs for the C++ community.

In 2022 Meeting C++ organized 5 online job fairs for C++. Originally 4 were planned, but in May only one company could attend and two other companies approached Meeting C++ after the event wondering if another fair in June was possible. With better planning this could have been one fair. The next job fair is on March 14th & 15th.

Value Objects -- Rainer Grimm

PortraintRound-1.jpgFrom "Modernes C++":

Value Objects

by Rainer Grimm

From the article:

A value object is a small object whose equality is based on state, but not identity. Typical value objects are money, numbers, or strings. ...

...  For a user-defined type, you have to choose the appropriate equality semantics. ... In C++20, the compiler can auto-generate the equality operator and use it as a fallback for the inequality operator. The auto-generated equality operator applies value equality. To be more precise, the compiler-generated equality operator performs a lexicographical comparison. Lexicographical comparison means that all base classes are compared left to right and all nonstatic members of the class in their declaration order.

I have to add two important points:

Honestly, the example works as expected but does not seem right. ...

std::initializer_list in C++, Caveats and Improvements -- Bartłomiej Filipek

bw_photo_small.pngDelving into the "how it works" and "why use it" of std::initializer_list...

std::initializer_list in C++, Caveats and Improvements

by Bartłomiej Filipek

From the article:

In this article, you’ll learn why std::initializer_list has a bad reputation in C++...

... We can make the following conclusion:

std::initializer_list is a “view” type; it references some implementation-dependent and a local array of const values. Use it mainly for passing into functions when you need a variable number of arguments of the same type. If you try to return such lists and pass them around, then you risk lifetime issues. Use with care.

Let’s take on another limitation: ...

Abseil Strings Library -- Yury Fedorov

Let's talk a bit about one of the most used Abseil parts:

Abseil Strings Library

by Yury Fedorov

From the article:

Abseil is an open source solution from Google that implements many basic and very helpful construction blocks for C++. Thanks to Abseil you may create a great isolation layer from your version of C++ compiler. In this article I will focus on few common functions from one of the most used Abseil libraries: absl::strings.

Review of Embracing Modern C++ Safely (Lakos, Romeo, Khlebnikov, Meredith) -- Bartlomiej Filipek

embcpp_small.jpgThe "Safely Tome" has landed, and we have a review from the author of C++ Stories:

Review of Embracing Modern C++ Safely (Lakos, Romeo, Khlebnikov, Meredith)

by Bartlomiej Filipek

From the review:

C++11 has been around for around 11 years and C++14 for 8. From my experience, I see that even today, many companies struggle to use those standards in production in the most efficient way. As always, with new stuff came benefits, risks, and increased learning effort. Fortunately, with a new book written by top C++ Experts, we have a solid guide on what is safe and what might be problematic in Modern C++.

The book is called “Embracing Modern C++ Safely”.

Let’s see what’s inside...

Overload 173, February 2023

overload173cover.pngOverload #173 is now available!

Highlights include:

  • Floating-Point Comparison  WEB  PDF
    By Paul Floyd
    Comparing floating point values can be difficult. Paul Floyd shows how you should perform floating-point comparisons (and how not to do it).

 

  • Determining If A Template Specialization Exists  WEB  PDF
    By Lukas Barth
    How do you tell if a class or function template can be used with specific arguments? Lukas Barth details his approach.

 

  • Stack Frame Layout On x86-64  WEB  PDF
    By Eli Bendersky
    Stacks can have different layouts. Eli Bendersky describes the x86-64 layout in detail.

 

  • Value-Oriented Programming  WEB  PDF
    By Lucian Radu Teodorescu
    The research Val programming language uses value-oriented programming. Lucian Radu Teodorescu explores this paradigm.

C++23 “Pandemic Edition” is complete -- Herb Sutter

image.pngC++23 is done!

C++23 "Pandemic Edition" is complete (Trip report: Winter ISO C++ standards meeting, Issaquah, WA, USA)

by Herb Sutter

From the article:

On Saturday, the ISO C++ committee completed technical work on C++23 in Issaquah, WA, USA! We resolved the remaining international comments on the C++23 draft, and are now producing the final document to be sent out for its international approval ballot (Draft International Standard, or DIS) and final editorial work, to be published later in 2023...

... Per our published C++23 schedule, this was our final meeting to finish technical work on C++23. No features were added or removed, we just handled fit-and-finish issues and primarily focused on finishing addressing the 137 national body comments we received in the summer’s international comment ballot (Committee Draft, or CD). You can find a list of C++23 features here, many of them already implemented in major compilers and libraries. C++23’s main theme was “completing C++20,” and some of the highlights include module “std”, “if consteval,” explicit “this” parameters, still more constexpr, still more CTAD, “[[assume]]”, simplifying implicit move, multidimensional and static “operator[]”, a bunch of Unicode improvements, and Nicolai Josuttis’ personal favorite: fixing the lifetime of temporaries in range-for loops...

The Toggle Builder -- Marco Arena

The toggle builderThat little extra we might equip builder classes with:

The Toggle Builder

by Marco Arena

From the article:

If intended for general usage, the builder can result a bit uncomfortable when we go through some configuration object to toggle features. This often leads to a bunch of ifs..