Hello Everyone!

Took me some time to write this post since I was on travel for few days.

We met on Tuesday May 13 2025 and discuss std::uninitialized_xyz() function family.

The Agenda:

  • Quiz
  • Uninitialized is actually good!
  • Constructing Objects Separately: Understanding `std::uninitialized_*
  • Efficiently Managing Object Lifetime in C++

Meetup page for the event is here.

Thank you CLion JetBrains for sponsoring San Diego C++ Community! Very much appreciated!

Details

  1. Quiz – we went over cppquiz #298 and #334. #298 highlighted the implicit noexcept of destructors, while #334 was about UB when you have a function that should return a value but it does not.
  2. CLion is free for non-commercial usage! no more need for my 100% free coupons 🙂
  3. I still have few hardcover books to give away, ping me if you want it.
  4. The main talk was discussing:
    • C++ Allocation vs Construction
    • How to work with Uninitialized memory? Can it boost performance in some cases?
    • Standard algorithms need constructed, existing objects (that have their lifetime started)
    • For example – the usage of std::copy() vs std::uninitialized_copy()
    • The motivation – avoiding wasted work!
    • Many code examples, mentioning all kinds of std::uninitialized_xyz() functions.
    • std::destroy(), std::destroy_at(), std::destroy_n()
    • Exception safety gurantee!
    • Using std::ranges::uninitialized_xyz()

The great book from Patrice is a great resource! read it!

Thank you for reading!

Kobi

Leave a Reply