January 2023

CopperSpice: A Peek at C++23

New video on the CopperSpice YouTube Channel:

A Peek at C++23

by Barbara Geller and Ansel Sermersheim

About the video:

C++23 is about to be published and we selected five of the most interesting changes. Two of these are enhancements to Lambda Expressions and the other three add new functionality.

Watch our new video to find out how the C++23 standard can improve readability, maintainability, and performance.

Please take a look and remember to subscribe.

Argument-Dependent Lookup and the Hidden Friend Idiom -- Rainer Grimm

You've got to know where to find them, know how to bind them, know when to ask for help, from a hidden friend...

Argument-Dependent Lookup and the Hidden Friend Idiom

by Rainer Grimm

From the article:

Have you ever wondered why the following program works?

#include <iostream>

int main() {
    std::cout << "Hello world";

Why should the program not work? The overloaded output operator operator<< is defined in the std namespace. The question is, therefore: How is the appropriate overloaded output operator for std::string found? You may already assume it...

Making C++ primitive types meaningfully movable when they have sentinel values -- Raymond Chen

A little less primitive...

Making C++ primitive types meaningfully movable when they have sentinel values

by Raymond Chen

From the article:

C++ primitive types do not have special semantics for move constructor or move assignment. Their move operations are just copies. But what if you really want them to move, say, because they have a sentinel value that represents an "empty" state...?

Getting in trouble with mixed construction -- Barry Revzin

How do I construct thee? Let me count the ways...

Getting in trouble with mixed construction

by Barry Revzin

From the article:

Several years ago, I wrote a post about the complexities of implementing comparison operators for optional<T>Getting in trouble with mixed comparisons. That post was all about how, even just for ==, making a few seemingly straightforward decisions leads to an ambiguity that different libraries handle differently.

Now is a good time to circle back to that same idea, except this time instead of talking about equality comparison, we’re just going to talk about construction. This post is going to work through a bunch of cases of trying to construct an object of type X from an object of type Y...


PVS-Studio in 2022

It's January 2023, which means it's time to look back at our achievements in 2022. In this article, we'll tell you what we accomplished and show you what features appeared in PVS-Studio in 2022. Let's go.

PVS-Studio in 2022

by Polina Alekseeva

From the article:

Speaking of cross-platform. As of now, the analyzer runs on Windows, Linux, and macOS on the x86_64 architecture. It is currently impossible to run the analyzer natively on the same operating systems under ARM (except for C and C++ analyzer on ARM-based macOS: you can run it via Rosetta). We're wondering if there are many people among our readers who want to natively use the analyzer on ARM. How critical is the build and analysis of projects on the ARM architecture for you?

ACCU 2023 Registration is open -- ACCU

The registration for the upcoming ACCU 2023 conference from 2023-04-19 to 2023-04-22 has opened.

ACCU 2023 Registration is open


About the conference

Again we had the opportunity to assemble a great schedule by speakers from the community who want to share their experience!

Our this years keynote speakers are Björn Fahller, Dave Abrahams, Gail Ollis and Stephanie Brenham.

We have two days with full-day workshops before the conference by Mateusz Pusz, Mike Shah, Nico Josuttis, Peter Sommerlad and Vladimir Vishnevskii.

Again Gail Ollis will give an Early Career Day in colaboration with Chris Oldwood, Giovanni Asproni, Jez Higgins, Jon Skeet, Kevlin Henney and Roger Orr for a reduced fee.

Early bird rates apply until 23.59 GMT on Tuesday 28th February 2023.


Writing Functors with Boost.Lambda2 -- Richard Thomson

Utah C++ Programmers has released a new video:

Writing Functors with Boost.Lambda2

by Richard Thomson

From the video description:

Lots of standard algorithms require some sort of 'functor' or 'function object' in order to apply predicates and transforming functions to values. This makes the algorithms generic, but requires you to write your own function object classes or lambda functions, which can get a little noisy in the syntax.

Boost.Lambda2 is a library that allows you write lambda functions that look like simple expressions with placeholders for the arguments.

This month, Richard Thomson will give us a breakdown of the Lambda2 library in Boost that makes writing function objects simple and readable. We'll see how to use them with common standard algorithms before looking a little more deeply into how this library is implemented.


Partial function application -- Rainer Grimm

PortraintRound-1.jpgAre you a library person (std::function, std::bind, std::bind_front) or a language person (lambdas, auto, currying)? So many tools to get the job done...

Partial function application

by Rainer Grimm

From the article:

A few weeks ago, I had a discussion with a few of my readers. One reader said that I should write about Partial Function Applications. Another reader mentioned that C++ does not support function applications. This is wrong. C++ supports Partial Function Application. Consequently, I am writing today about std::function, std::bind, std::bind_front, lambdas, auto, and currying.

Let me start with a bit of theory...


Using perfect (and imperfect) forwarding to simplify C++ wrapper classes -- Raymond Chen

Perfectly imperfect:

Using perfect (and imperfect) forwarding to simplify C++ wrapper classes

by Raymond Chen

From the article:

There may be cases where you have a C++ class that wants to wrap another C++ class that is contained as a member. ... It’s annoying that there’s so much boilerplate to do the method forwarding, and that we have to keep looking up the parameters and return types so that each forwarder has the correct signature. Fortunately, we can use perfect forwarding to write most of them for us: ...