C++17 In Detail

27 July 2020

See My Talk: Empty Base Class Optimisation, [[no_unique_address]] and other C++20 Attributes

no_unique_address, C++20, presentation

Last Tuesday, 21th July, I had a pleasure to talk about [[no_unique_address]] on our Cracow C++ User Group online meeting.

Here are the slides and additional comments from the presentation.

Some Issues

Our C++ Cracow User group:


We also experienced the problems related to COVID situation, and for two months - in March and April, we had to cancel our regular monthly meetings. Fortunately, we restarted in May with Google Meet and going online :)

So far, we had two presentations by Andrzej Krzemienski:

And in July I tried to present my material.

The online presentations have their issues (for example, it’s a bit harder to “see” the whole audience and interact easily), but this style also has some positives. For instance, we can record the meetings and put it online. Hopefully, in the future, when things get back to normal, we’ll be able to take advantages of both approaches.

Ok, but here’s my presentation…

The Talk

Some background:

Sometime in 2016, I wrote an article about custom deleters for smart pointers.

Bartek’s coding blog: Custom Deleters for C++ Smart Pointers

And there is an interesting property that if you have a unique_ptr and you provide a stateless functor, then the size of unique_ptr is just one pointer (not two when you use a function pointer). But at that time, I didn’t investigate what the exact reason behind this capability was.

Then in February 2020, I gave a presentation on our C++ User Group about all of the C++20 features. And among them, there’s a new attribute called [[no_unique_address]]. At that time, I also had no clear idea of what were the use cases for it.

But then I wanted to understand more of C++20 and somehow those two features: deleters for unique_ptr and [[no_unique_address]] started to “converge”.

As it appears with the new attribute from C++20, we can significantly simplify the code that leverages Empty Base Class Optimisation to create things like “compressed pairs” often used to store stateless callable objects like allocators or deleters.

At some point I compiled my investigation into a separate article for Patrons, and you can access it here: June 24th Updates, News, Plans, C++20 no_unique_address and Polymorphic Allocator, Extra | Bartłomiej Filipek on Patreon.

The Slides

Here are the slides

The Video

And, thanks to our Group main organiser, the talk was also recorded and then uploaded on YT:

(it’s my first online live thing!) :)


If you like to hear more from the Cracow User Group, please join our meetup page. Thanks to the online presence we hope to be more “open” and allow to join the meeting even if you’re not in Cracow :)


© 2017, Bartlomiej Filipek, Blogger platform
Disclaimer: Any opinions expressed herein are in no way representative of those of my employers. All data and information provided on this site is for informational purposes only. I try to write complete and accurate articles, but the web-site will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use.
This site contains ads or referral links, which provide me with a commission. Thank you for your understanding.