June 24th Updates, News, Plans, C++20 no_unique_address and Polymorphic Allocator, Extra

Hi

Last week and this week were quite "big" for C++ Lambda Story. I announced a new update last Friday and till today around 75 new books were sold! On Tuesday the book got even on the front page at the Leanpub website :)

Here's the main blog post that explained the latest changes and the plans for the book (one more update, plus a Kindle Direct Publishing version)

The C++ Lambda Story Book

Plans

I must admit that I entered the "flow" when I worked on this last book update and it's sometimes hard to break and do something else :) But fortunately after the update, I found some time for some other topics.

Next time, on Monday, I hope to release a blog post about polymorphic allocators from C++17.

A few weeks ago I saw that Jason Turner published a cool video about getting super speed with polymorphic allocators and that motivated me to play with this topic.

Have a look at Jason's video:

C++ Weekly - Ep 222 - 3.5x Faster Standard Containers With PMR! - YouTube

And here's my playground for allocators:

http://coliru.stacked-crooked.com/a/f7b205ca12d43be6

The code prepares a buffer on the stack and passes it to std::pmr::monotonic_buffer_resource. However, when the buffer is full, the allocator then reaches the default allocator. That's why we can hack the code and prepare a custom code for the aligned new.

I hope to expand on this idea in my next post.

C++20

It was a while since my last short description of new C++20 features, but today I have something for you :)

In C++20, we'll have a bunch of new attributes, and one of them is [[no_unique_address]]. To be honest, I didn't know what's the purpose of this thing... it's quite a low-level technique and probably not that popular. However, it plays a crucial part in STL as it allows us to have much smaller types (for example, stateless deleters, stateless allocators).

Have a look in the attachment.

And let me know if you like the content. I was really impressed how unique_ptr managed to reduce the memory consumption when the deleter is stateless!

Let's talk!

Just a reminder that we have a Discord server! Join the chat rooms and have a talk about C++... and some other things :)

Let's discuss C++ techniques, news, new article ideas, and hang around.

Thank you all who already joined! 

You can access the server through Patreon App integration Page. Check it out here:

https://www.patreon.com/settings/apps

Best Regards 

Bartek

Become a patron to

137
Unlock 137 exclusive posts
Be part of the community
Get discounts to an online store
Connect via private message