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 member to

272
Unlock 272 exclusive posts
Be part of the community
Get discounts to an online store
Connect via private message
Tiers
Up-to-date!
$3 per month
Thanks!

At this level you can stay up to date with the latest C++ news and C++ Stories. Here's what you'll get:
  • Access to my feed with weekly updates
  • Curated News and Article Descriptions
  • Access to exclusive Discord Server
  • My Book: C++ Lambda Story for free, see at https://leanpub.com/cpplambda/
Includes Discord benefits
Know & Learn since 2022
$6 per month
Amazing!

It looks like you want to get even more C++ content!
At this level you'll get everything from the "Up-to-date!" plan, plus:

  • Data Member initialization Book for free
  • Extended or exclusive articles (usually twice per month)
  • Extended C++20 ref Card
  • Early access to new blog posts
  • Access to all content from previous years
  • Additional Product Promotions
  • PDF version of recent blog posts
Stay at the Edge
$15 per month
You rock!

You'll get everything for the previous plan plus:

  • Free version of my C++17 in Detail book,
  • *OR* Free Print Version of Lambda Story (if reachable from Amazon.com)
  • Huge discounts for future projects (or even free access)
Includes Discord benefits
Recent Posts