Posts
Sandor Dargo's Blog
Cancel

C++26: Disallow Binding a Returned Reference to a Temporary

In short, thanks to P2748R5 by Brian Bi, it’s no longer possible to return a reference that binds to a temporary expression, and that’s just lovely. What exactly is changing? Often, a proposal mo...

What Makes a C++ Talk Stand Out in the Review Process?

Let’s talk about getting into conferences. I’ve already shared my path into conference speaking, and more recently, Andre Schau Knatten wrote about how to become a conference speaker. As the ques...

Three types of name lookups in C++

Let’s get back to some basics this week and talk about name lookups in C++. In other words: when you refer to a symbol in your code, how does the compiler find it? Essentially, we can differentiat...

Constructing Containers from Ranges in C++23

I’ve written plenty on this blog about standard algorithms, but far less about ranges. That’s mostly because, although I’ve had production-ready compilers with C++20 ranges since late 2021, the ori...

Declaring a friendship to self

Recently, I ran into some code where a class declared itself as a friend. I was quite surprised to see that and at a second glance, I realised that there were 2 characters difference in a relativel...

C++26: constexpr exceptions

In recent weeks, we’ve explored language features and library features becoming constexpr in C++26. Those articles weren’t exhaustive — I deliberately left out one major topic: exceptions. Startin...

C++26: more constexpr in the standard library

Last week, we discussed language features that are becoming constexpr in C++26. Today, let’s turn our attention to the standard library features that will soon be usable at compile time. One topic ...

C++26: more constexpr in the core language

Since constexpr was added to the language in C++11, its scope has been gradually expanded. In the beginning, we couldn’t even use if, else or loops, which were changed in C++14. C++17 added support...

Raw loops for performance?

To my greatest satisfaction, I’ve recently joined a new project. I started to read through the codebase before joining and at that stage, whenever I saw a possibility for a minor improvement, I rai...

Should you use final?

Today, let’s discuss the not-too-frequently-used final specifier. I think there aren’t many good reasons to use it — something the C++ Core Guidelines also suggests. And even when you could use it,...