Home
Barry's C++ Blog
Cancel

Lambda Lambda Lambda

I like watching Conor Hoekstra’s videos, both because he’s generally an engaging presenter, and also because he talks about lots and lots and lots of programming languages. I don’t know that many languages, so it’s nice to get exposure to how different languages can solve the same problem. A rec...

Implementing span's comparisons

One of the new types in C++20 is std::span<T> (with its fixed- size counterpart std::span<T, N>). This is a very useful type, since it’s a type-erased view onto a contiguous range - but unlike more typical type erasure (e.g. std::function), there’s no overhead. I’ve previous written a...

The constexpr array size problem

Update from 2022: my proposal to address this problem, P2280 (Using unknown pointers and references in constant expressions ), has been adopted for C++23. This issue was first pointed out to me by Michael Park, and mostly explained to me by T.C. Let’s say I have an array, and I want to get its ...

Why were abbrev. lambdas rejected?

In November, 2017, I presented my proposal for abbreviated lambdas (P0573R2) to Evolution in Albuquerque. It was rejected (6-17), though the group was willing to consider future proposals for shorter lambdas which present new technical information (18-2). Since then, there’s been a lot of confus...

Named Template Arguments

C++, unlike many other programming languages, doesn’t have named function parameters or named function arguments. I hope it will someday, it’s a language feature that I find has large benefits for readability. Until then, in C++20, we actually have the ability to do a decent approximation not onl...

Declaratively implementing Function Objects

I like a declarative approach to programming. Ben Deane has given several good talks on what declarative programming is (such as this one from CppNow 2018), and if you haven’t seen them, you should. The idea is to try to write your logic using expressions and to make it correct by construction, r...

UFCS: Customization and Extension

In my previous post on the topic, I went through all the proposals we’ve had that were in the general space of unified function call syntax. That is, anything in which member function syntax might find a non-member function or non-member syntax might find a member function - with multiple sets of...

Enums, warnings, and default

This post describes a particular software lifetime issue I run into a lot, and a solution I use for it that I’m not particularly fond of. I’m writing this post in the hope that other people have run into the same issues and either have better ideas about how to solve it now, or better ideas of ho...

Comparisons in C++20

Now that the Cologne meeting is over and we’ve more or less finalized (at least before the NB comments come in) C++20, I wanted to take the time to describe in detail one of the new language features we can look forward to. The feature is typically referred to as operator<=> (defined in the...

What is unified function call syntax anyway?

One of the language proposals in the last few years that comes up fairly regularly is Unified Function Call Syntax, sometimes also called Unified Call Syntax. I’m going to use the former name, abbreviated as UFCS, because FLAs are the new TLAs. What makes this particular proposal confusing in th...