Home
Barry's C++ Blog
Cancel

Getting in trouble with mixed comparisons

Andrzej has a great new post about the difficulty that arises when the language or the library tries to make assumptions about programmer intent. He brings up two examples of this difficulty: should CTAD wrap or copy? how should optional’s mixed comparison behave? I’ve touched on the first...

span: the best span

This post is a response to RangeOf: A better span, which has many problems worth addressing in detail. While most of this post will deal with specifically std::span<T> (which is indeed the best span), the last section will also discuss a recent addition to the standard library: std::ranges:...

Improvements to <=>

Last week, the C++ Standards Committee met in San Diego to work on C++20. One of my own main goals was to discuss two papers I wrote making improvements to a new language feature for C++20: operator <=>, also known as the three-way comparison operator but better known as the spaceship opera...

Declarations using Concepts

One of my all-time favorite C++ talks is Ben Deane’s Using Types Effectively from CppCon 2016. I like it for a lot of reasons, but for the purposes of this post - I really like the game Ben plays (starting at around the 29m mark) where he gives a function signature of a total function template - ...

Higher Order Fun

… in C++. That seems like a fundamentally wrong statement to make right? C++ has been greatly improving over the last few standards in its direct support for a more functional style of programming. But it’s still much more verbose than necessary to write a simple lambda, it’s surprisingly tricky...

Quirks in Class Template Argument Deduction

Before C++17, template deduction [basically] worked in two situations: deduction function parameters in function templates and deducing auto for variables/return types in functions. There was no mechanism to deduce template parameters in class templates. The result of that was— whenever you used...

optional<T&> - Yes, we need it

Read it on Medium.

Should Span Be Regular

Read it on Medium.

Non-Ownership and Generic Programming and Regular types, oh my!

Read it on Medium.

Without form and void

Read it on Medium.