San Diego C++ Meetup #83: February 2026 Edition

Last night we held our 83rd San Diego C++ Meetup. It was a fantastic evening filled with deep technical discussions and a significant announcement regarding the future of our community infrastructure.

The Big Announcement: Moving to Luma

The biggest news from this meeting is that we are officially moving away from Meetup.com. To streamline our event management and provide a better experience for our members, we have transitioned to Luma.

We now have a dedicated San Diego C++ Meetup calendar on Luma where you can see all upcoming sessions, register for events, and sync them directly to your personal calendar.

Please register on our new platform here: https://luma.com/sdcppmu

The Main Presentation: Hidden Dangers in Static Polymorphism

I delivered a deep dive into the “Hidden Dangers in Static Polymorphism.

The event page on Luma.com: https://luma.com/24rt9aa0 (also on meetup: https://www.meetup.com/san-diego-cpp/events/313044656)

A major highlight of the talk was debunking the myth that static polymorphism is a “cure-all” for the issues found in dynamic polymorphism. Specifically, I demonstrated that slicing remains a significant threat in both worlds.

Slicing, CRTP, and std::tuple

We explored how slicing occurs when a derived object is copied into a base class storage, resulting in the loss of derived data and behavior. Even when using the Curiously Recurring Template Pattern (CRTP), developers can inadvertently trigger slicing if they aren’t careful with how objects are stored or passed.

I showed specific examples of how std::tuple can lead to slicing issues when attempting to store heterogeneous types that share a CRTP base. The talk covered:

  • Detection: How to use static_assert and deleted constructors to catch slicing at compile time.
  • Avoidance: Strategies for maintaining type identity without falling into the “value-based” slicing trap.

Modern C++ Solutions

The presentation moved beyond the “dangers” to show how modern C++ features provide safer alternatives for polymorphism:

std::apply and Variadic Templates: Powerful techniques for processing heterogeneous collections (like tuples) in a generic and type-safe manner.

C++20 Concepts: Using concepts to constrain template parameters, providing better error messages and ensuring that types satisfy the required interface without requiring a common base class.

std::variant and std::visit: An exploration of “closed” polymorphism where type safety is guaranteed and slicing is avoided by providing a type-safe union.

Recording

If you missed the live session or want to revisit the technical details, you can watch the full recording here:

Special Thanks to Our Sponsors

This community continues to thrive thanks to the generous support of our partners.

I would like to extend a huge thank you to JetBrains for their ongoing support in covering our meetup fees and dues. Their contribution ensures that our platform remains accessible to everyone.

I also want to thank Packt Publishing for partnering with us and providing excellent technical resources and books to our community members.

Closing Thoughts

It was great to see everyone and engage in such high-quality C++ discourse. Don’t forget to join our new Luma calendar to stay updated on our March meeting and beyond.

See you at #84!

Kobi

San Diego C++ Meetup #82 – January 2026 Edition

Hello everyone and Happy New Year!

I hope you all had a wonderful holiday season and are ready for another year of deep diving into our favorite language.

We kicked off 2026 this past Tuesday, January 13th, with our 82nd session. It was great to see everyone again; our community continues to grow, now reaching 1,874 members!

Our Supporters

Before we jump into the technical highlights, I want to take a moment to thank our sponsors who keep this community thriving.

A huge thank you to JetBrains for sponsoring our meetup fees. These costs aren’t small (reaching into the hundreds), and having their support allows us to focus entirely on the C++ content and our members.

We also want to acknowledge Packt Publishing. I’ve been spending my free time recently with a copy of Software Architecture with C++. It is a massive book – around 700 pages – and while the first few chapters cover the theoretical ground, it gets incredibly advanced from chapter five onwards. If you’re looking to push your boundaries in C++20 and beyond, I highly recommend it. Packt has been kind enough to provide a CPP20 discount code for the ebook if you want to check it out yourself!

The Main Event: C#-Style Properties in C++

Our special guest for the evening was our very own Martin Vorbrodt. Martin has been a staple of the C++ community for years, with a career spanning computer forensics, automated trading, and storage drivers.

Aside from his technical prowess, we also had something to celebrate: Martin is starting a new position next week! Congrats, Martin!

The Motivation

Martin’s talk was based on his recent work implementing C#-style properties in C++. The goal was simple but ambitious: provide the encapsulation of a getter/setter mechanism while maintaining the clean, intuitive syntax of a public data member.

We’ve all been told that public data members are a “big no-no” because you lose control over how data is accessed or modified. Martin’s implementation solves this by using a policy-based design that intercepts read and write operations without requiring the user to call get_x() or set_x() explicitly.

Implementation Highlights

Martin walked us through the <em>property.hpp</em> and <em>property.cpp</em> files from his blog repository. The implementation is a masterclass in modern C++20:

  • Policy-Based Design: The property<T> class template uses policies to control storage and access. The default policy stores the value in memory, but Martin demonstrated an FS Property (File System) policy where the value is actually stored and retrieved from disk.
  • C++20 Concepts: The code uses concepts heavily to enable or disable member methods and operators based on whether the underlying type is a primitive, a container, or a smart pointer.
  • Zero Overhead (Mostly): By default, sizeof(property<T>) is equal to sizeof(T). This is achieved by avoiding storing extra state inside the property itself when possible.
  • Event Dispatching: One of the “killer features” is the ability to register an update procedure. You can subscribe to a property, and whenever its value is modified, your lambda or function is triggered – much like property changed events in C#.
  • Explicit vs. Implicit Access: While it behaves like a variable, Martin specifically made the cast to a non-const reference explicit. This ensures that you don’t accidentally bypass the setter mechanism without meaning to.

Code: https://github.com/mvorbrodt/blog/blob/master/src/property.cpp

Q&A and Caveats

The session included some great discussion. One of the questions raised was about thread safety. Martin noted that the current event dispatching uses a static map, which isn’t thread-safe out of the box, though it could be adapted for thread-local storage or protected with a mutex if needed.

We also talked about “caching” for the File System policy. Currently, it reads/writes to disk on every access, but the beauty of the policy-based design is that a user could easily inherit from the policy to add a caching layer.

Resources and Wrap-up

f you missed the live session or want to revisit the details, you can find the event page, recording, and source code below:

Thank you again to Martin for sharing his work and to everyone who attended and asked questions. It’s a fantastic way to start the year.

See you all in February!

Kobi

San Diego C++ Meetup #81 – December 2025 Edition

Hello everyone!

Our final meeting of 2025, San Diego C++ Meetup #81, took place on Tuesday, December 9th. It was a fantastic session to wrap up the year, featuring a deep dive into the intersection of Modern C++, AI tooling, and functional programming interpreter design.

For those who couldn’t make it, the full recording is available on our YouTube channel:

A massive thank you to our sponsor, JetBrains, for their continued support of the San Diego C++ Meetup group. They just dropped a new release with some impressive features (including a constexpr debugger!), so be sure to check it out. We also have a special coupon code from Packt for the book Software Architecture with C++ – feel free to reach out if you missed it during the session.

The Talks

We were joined by Alfonso, who walked us through two of his comprehensive personal projects that bridge the gap between academic theory and practical systems programming.

1. Beyond the Paper: A Modular Workbench for Neural Code Analysis

The first talk introduced BERT Builder, a “batteries-included” pipeline designed to transform the theoretical work of Transformer architectures into a tangible workbench.

Implementing research papers is often messy, involving hardcoded paths and fragile scripts. Alfonso demonstrated a complete tooling ecosystem that allows users to own every step of the process.

Key Highlights:

  • End-to-End Pipeline: The system covers everything from automated Corpus Engineering (fetching and sanitizing GitHub repos) to tokenization, pre-training, and evaluation.
  • Modular Architecture: Designed for “plug-and-play” experimentation. You can swap out tokenizer strategies (Char, KeyChar, SentencePiece) or masking objectives (MLM, WWM) easily.
  • Scientific Rigor: Alfonso emphasized the importance of Specification-Driven Development (using “Speckit”) to ensure the tool meets rigorous academic standards while remaining hackable for the community.
  • AI-Assisted Development: Interesting insights were shared on using Gemini 2.5 to aid in generating the specs and code, including the challenges of enforcing Test-First Development with AI agents.

2. Building Expresso: A Purely Functional, Immutable REPL

The second part of the night explored Expresso, a lightweight, interactive REPL for evaluating expressions.

Unlike traditional interpreters that rely on mutable state, Expresso is built on a strict philosophy of immutability. Every user input is treated as a pure expression that evaluates to a new value without side effects.

Technical Details:

  • Hybrid Architecture: The core runtime and CLI are built with ANSI C17, while the robust lexing and parsing are handled by C++17 and ANTLR.
  • No-Assignment Constraint: The language enforces functional purity by disallowing variable assignment, a design choice that simplifies the mental model and prevents side effects.
  • Robust Testing: The project used detailed feature specifications to guide a Test-First Development process, ensuring edge cases like numeric overflow and operator precedence were verified before implementation.

It was a great evening of learning, from neural networks to compiler theory.

Thank you to everyone who attended and participated in the discussions. I wish you all a happy holiday season and a Happy New Year! See you in 2026!

Kobi

San Diego C++ Meetup #80 – November 2025 Edition – 2025-11-18

Hello all!

Our latest San Diego C++ Meetup took place on Tuesday, November 18th, 2025. This was the 80th meeting of our group!

It was a slightly shorter session than usual as I’ve been quite busy, but we managed to pack in some great discussions on Agentic AI, review some fascinating C++ news/blogs, and solve a tricky quiz.

A huge thank you to JetBrains for their continued sponsorship of our meetup group! Their support allows us to keep this community going.

Thank you Packt for providing coupons for the upcoming seminar by Patrice!

The meeting event page can be found here.

The Main Topic: Agentic AI and C++

I spent some time sharing my personal experience over the last nine months working with Agentic AI (specifically using tools like Cursor and Cloud Code).

We discussed how this is changing the way we write, document, and interact with code. My experience has been overwhelmingly positive—bordering on “science fiction” at times. We talked about the shift in workflow: writing less code manually but spending more time “planning” with the model and verifying the output.

Key takeaways discussed:

  • Planning is crucial: Spending time brainstorming and writing a “spec” (often in Markdown) with the AI before generating code leads to much better results.
  • Verification: You end up reading more code than you write. It is essential to understand what the AI generated to avoid technical debt.
  • Skillset Shift: Learning to interact with these models is a skill developers should start building now.

Links & Discussion Points

We reviewed several interesting articles and resources during the session:

  • Undo Agentic Debugging: We looked at a poster from CppCon regarding “Agentic Debugging”—using AI to explain backtraces or reverse-debugged states in plain English.
  • Free Functions Performance: An interesting analysis on whether free functions are faster than member functions. The conclusion? Generally, no difference, unless the this pointer push overhead is significant in very tight loops.
  • C++20 Concepts & Forward Declaration: A fascinating edge case blog post by Andreas Fertig. It explores how a forward-declared type interacts with Concepts and auto vs void return types.
  • Conan & Sanitizers: We discussed how to properly integrate sanitizers into your Conan 2.0 profiles.
  • C++26 Reflection: We touched on the massive potential of C++26 Reflection.
  • GenAI Skepticism/Pragmatism: Two posts by Kevlin Henney on the importance of thinking for yourself when using LLMs.

C++ Quiz

We tackled CppQuiz Question #400.

  • Topic discussed: Threads, std::jthread, and sequencing.
  • The Question: Does the increment of a non-atomic variable across threads cause a race condition or undefined behavior in this specific snippet?
  • The Answer: It outputs 2.
  • Why? The standard guarantees specific “happens-before” relationships between thread construction, lambda execution, and join(), ensuring a well-defined sequence of operations even without explicit atomics in this specific case.

Recording

For the full discussion, check out the recording on YouTube:

If you are in the San Diego area, feel free to reach out on Discord! I still have a few printed books to give away.

Thank you!

Kobi

tags: [C++, Meetup, San Diego, AI, Reflection, Conan]

San Diego C++ Meetup: Meeting #79 – October 2025 Edition – Hosting Hubert Liberacki!

Hello all!

This time, our 79th meeting Oct 22 2025, we were hosting Hubert Liberacki who gave a fantastic presentation on “Cracking Open the Black Box: Legally Testing the Privates in C++”.

A huge thank you to everyone who attended and participated in the discussion!

For those who couldn’t make it or would like to review the talk, the full recording is available on YouTube:

About the presentation: Cracking Open the Black Box: Legally Testing the Privates in C++

Introduction: Encapsulation is a cornerstone of C++, yet private members often pose challenges in real projects. When refactoring legacy code, working with third party libraries, or debugging complex systems, gaining access to internals can be necessary to establish tests and enable a test driven workflow. In these situations, developers inevitably face the question of how to “test the privates” without breaking the rules.

Relevance: This is not an edge case but a recurring scenario in production code. Developers frequently reach for shortcuts such as #define private public or memory layout tricks. Those shortcuts are mostly undefined behavior leading to portability problems, or even changes in object layout across compilers. There are well known examples in widely used projects where such hacks have caused failures. This talk brings these issues into focus with real world references and demonstrates safer alternatives.

What did Hubert cover in this session:

  1. Why developers sometimes need access to private members (legacy code, third party libraries, debugging, instrumentation, and refactoring with TDD).
  2. Common techniques to achieve the access.
  3. Showcase (live) the dangerous side-effects: macro leakage, ABI mismatches, portability failures.
  4. Discovering the standard loophole.
  5. Live coding: step by step demonstration of this technique in practice, with explanations of how it works under the hood.
  6. Q&A and open discussion with attendees.

Completion state: Implementation is ready as github library – cpp-member-accessor

Support materials:

  1. https://github.com/nlohmann/json/issues/913 – “error due to #define private public”
  2. https://godbolt.org/z/Pjs1Y4cdv – “macro leak, size difference”
  3. https://pvs-studio.com/en/blog/posts/0146/ – “Your code can break”
  4. https://eel.is/c++draft/macro.names#2 – “It’s UB”

and one more: https://bloglitb.blogspot.com/2010/07/access-to-private-members-thats-easy.html?m=1

About the presenter: Hubert Liberacki

Hubert Liberacki is a Lead Software Engineer with over a decade of experience in C++ development across automotive and robotics, focusing on performance-critical and distributed systems.

At Apex.AI he worked on automotive-grade software-defined vehicle frameworks, and he is currently working at HERE Technologies on maps and rendering in large-scale C++ projects. His current interests also include Rust and its applications in high-performance and distributed systems.

A special thanks to our sponsors:

  • JetBrains for their generous and continued sponsorship of the San Diego C++ Meetup group.
  • Packt for providing exclusive discount codes to our attendees for their vast library of C++ books and resources.

San Diego C++ Meetup: Meeting #78 – September 2025 Edition

Hello all!

Our latest San Diego C++ Meetup took place on Tuesday, September 24th, 2025. It was another great virtual session where we dove deep into some of the lesser-known features and types in Modern C++. A massive thank you to everyone who joined, participated in the quizzes, and contributed to the discussion!

For those who couldn’t make it or wish to review the topics, the full recording is available on YouTube:

  • Meeting Event Page: here

YouTube Recording:

Meeting Summary

The evening kicked off with a fun C++ quiz to warm up the brain(#360), followed by the main presentation which I titled: “C++ Esoterica: A Tour of Special Keywords & Features.”

Here is a brief overview of the C++ features we explored:

C++ Esoterica: A Tour of Special Keywords & Features

This talk was an exploration of lesser-used types, attributes, and language features that can significantly improve code safety, clarity, and expressiveness. We covered the following topics:

  • std::extent [00:11:00]: A type trait used to get the number of elements in a specific dimension of a C-style array at compile time, particularly useful in template metaprogramming.
  • std::valarray [00:13:00]: We looked at this container designed specifically for high-performance numerical computing and element-wise mathematical operations, noting its niche role compared to std::vector.
  • The Spaceship Operator ( <=>) [00:15:00]: A discussion on how this C++20 feature simplifies object comparison by generating all relational operators from a single definition.
  • std::monostate [00:17:00]: We explored this empty type from the <variant> header, primarily used to represent the “empty” or default state in a std::variant, and even showed an advanced pattern for creating custom RAII resource handles using std::monostate within a std::variant to manage a std::unique_ptr with a custom deleter.
  • std::nullptr_t [00:26:00]: A reminder that this is the distinct type of the nullptr literal, which prevents the pre-C++11 ambiguity that could occur when passing NULL (often defined as ) to overloaded functions.
  • std::intptr_t / std::uintptr_t [00:28:00]: We discussed these types for low-level pointer arithmetic and manipulation, emphasizing the use of the unsigned std::uintptr_t for memory addresses due to its defined wrap-around behavior.
  • std::ignore [00:30:00]: The placeholder object used with std::tie to discard unwanted elements when unpacking a tuple or pair.
  • std::enable_shared_from_this [00:32:00]: A crucial pattern for safely obtaining a std::shared_ptr to the current object from within its own member functions, thus preventing double deletion.
  • Ranges Placeholders ( std::ranges::dangling, std::ranges::empty_view) [00:34:00]: We looked at these C++20 range components that promote safer code by preventing the use of iterators into temporary ranges ( dangling) and providing a clean, standard way to return an empty sequence ( empty_view).
  • std::identity [00:38:00]: This simple C++20 function object returns its argument unchanged, making it an excellent default “projection” for generic algorithms.
  • [[fallthrough]] [00:42:00]: The C++17 attribute used inside a switch statement to explicitly declare an intentional fallthrough, suppressing compiler warnings and clarifying intent.
  • Experimental Features [00:44:00]: We briefly touched upon std::experimental::scoped_exit as a generalized RAII mechanism and std::experimental::propagate_const for addressing const-correctness loopholes with raw pointers inside class members.
  • std::bit_cast [00:48:00]: The modern, safe C++20 way to perform type punning, reinterpreting the bit pattern of an object while avoiding the undefined behavior associated with reinterpret_cast and strict aliasing rules.
  • Iterator Utilities ( std::next, std::prev, std::advance) [00:50:00]: A review of these iterator helpers, distinguishing between the “peekers” ( next/ prev) that return a new iterator, and the “mover” ( advance) that modifies the original iterator in place.

A special thanks to our sponsors:

  • JetBrains for their generous and continued sponsorship of the San Diego C++ Meetup group.
  • Packt for providing exclusive discount codes to our attendees for their vast library of C++ books and resources.

Thank You for reading!

Kobi.

San Diego C++ Meetup: Meeting #77 – August 2025 Edition

Hello all!

Our latest San Diego C++ Meetup took place on Tuesday, August 19th, 2025. It was another great session with engaging discussions on modern C++ features, standard library improvements, and a fascinating look into the world of AI-assisted development.

A huge thank you to JetBrains for their continued sponsorship of our meetup group. Their support is invaluable.

We’d also like to thank our partner, Packt, for providing our members with exclusive discounts on their extensive library of C++ books and courses.

For those who couldn’t make it or wish to review the topics, the full recording is available on YouTube:

Meeting Summary

We covered a lot of ground during this meeting. Here’s a brief overview of what we discussed:

First, we warmed up with a couple of C++ quizzes:

  • Quiz #153: We explored the intricacies of assigning a string literal to a non-const char*, a remnant from pre-C++11 days.
  • Quiz #342: This quiz sparked a discussion on the fundamental rule that references must always be initialized.

Next, we dove into the nuances of the constexpr and static keywords across different scopes: namespace/global, function, and class/struct. We referenced some excellent benchmarks from Jason Turner’s C++ Weekly series to guide our conversation and converged on the best practices for using these keywords for performance and clarity.

Following that, we explored a practical example of metaprogramming by building a simple compile-time TypeList using recursive structs. We also demonstrated how C++20 concepts can significantly clean up and constrain such constructs. This segment was inspired by a recent LinkedIn post from Hakan Gedek.

We then highlighted a significant safety improvement in libc++, which now produces a compile-time error when std::prev is used with an iterator category that doesn’t support it (like a forward iterator). This is a fantastic change that helps developers avoid stepping into Undefined Behavior.

Finally, the highlight of the evening was a live demonstration of using CLion’s AI assistance to build a complete, working “Game of Life” from scratch. I walked the group through the process I’ve been refining over the past six months, which has completely transformed how I build software. The key steps included:

  1. Planning & Brainstorming: Engaging with the AI in a “planning phase,” where I described the goal and let the model ask clarifying questions to build a robust design.
  2. Iterating on the Plan: Collaborating with the AI to refine the architecture, data structures, and logic, resulting in a detailed plan.md file.
  3. Implementation: Starting a new, clean session and feeding the plan.md to the AI to generate the full C++ implementation, complete with unit tests.

The result was a fully functional application, built in a single session, showcasing the incredible power of using AI as a development partner. This agentic approach, where the developer guides the high-level design and the AI handles the detailed implementation, is a paradigm shift in software creation.

Thanks to everyone who attended and participated in the great discussions. I look forward to seeing you at our next meeting!

Kobi

San Diego C++ meeting #76 – July 2025 edition

Hello everyone,

Last week we met for another San Diego C++ meetup session. I was super busy with tons of other obligations, so this blog post summary of the meetup session comes a bit late.

The meeting took place on July 15 2025, 5PM Pacific. Virtual meeting.

Meeting page can be found here.

Recording can be found here:

Agenda and items discussed:

  • I mentioned this website: https://cppdoctor.com/ that also published an ebook on C++ lambdas. Check it out!
  • We discussed C++ quiz #338 – “constexpr if” with branches that returns different types. Difficulty is marked as hard!
  • I mentioned https://mementum.github.io/cpp17-iterating-problems/ and showed few snippet of code from the blog. Check it out – This is published by “Daniel Rodriguez” and worth browsing!
  • We discussed C++26 compile-time reflection and discussed “Daniel’s L“. blog post Discover C++26’s compile-time reflection – Daniel Lemire’s blog – If you did not read it yet, I highly recommend doing so. It’s easy enough to read and realize the potential of C++26 reflection proposal. I’m looking forward to see what kind of utilities, and applications people would come up using this language feature! go std::meta!
  • We discussed “Enum-discriminated unions with nlohmann::json” by “Jakub Neruda“. Check this blog post here. It shows Deserialization of JSON using nlohmann::adl_serializer<> specialization. Nice trick that I personally was not aware of.
  • And last discussion was about padding. Inspired by this X/tweet. Here is a small peek at the padding structure that we showed during the meeting:

Couple thank you:

  • Thank you Packtpub for your generous coupons offers to the meetup attendees.
  • Thank you JetBrains for sponsoring the meetup! JetBrains has generously sponsoring the yearly Meetup fees!

Thank you!

Kobi

C++ Meetup Meeting #75 – hosting Mike Shah – Understanding large and unfamiliar codebases

Hello everyone!

On Tuesday, June 10th 2025, we were honored to host Mike Shah

The topic was “Understanding large and unfamiliar codebases“. A very interesting talk discussing and demonstrating multiple tools and techniques when working with large, unfamiliar code.

The meeting page can be found here

The recording can be found here:

Abstract of the talk: It’s your first day on the job as a new employee. You set up your workstation and then download a repository of over 1,000,000 lines of code. Even more intimidating, the code has been around for 20 years and has parts of it in legacy C++ and also using tentative C++ 26 features from various libraries. You feel overwhelmed! Don’t fret however! In this talk, I provide you a collection of tools to help software engineers of all levels understand what is going on in large unfamiliar codebases. The audience will leave this talk with a few simple and advanced tricks for navigating large and complicated codebases.

Bio: Mike Shah is currently a teaching faculty at Yale University with primary teaching interests in computer systems, computer graphics, and game engines. Mike’s research interests are related to performance engineering (dynamic analysis), software visualization, and computer graphics. Along with teaching and research work, Mike juggles occasional consulting work as a 3D Senior Graphics Engineer in C++ and producing programming content at his YouTube channel https://www.youtube.com/@MikeShah

Highlight of the discussion points:

  • How to approach a new code base, the challenges.
  • Conway’s low
  • Using debugger, reverse debugging like Undo, RR.
  • Tools like valgrind, callgrind, cloc and more …
  • Demonstrating the techniques using OpenTTD, approaching open source code and getting familiar with the codebase.

Check out the recording for more details!

Thank you JetBrains for sponsoring the group!

Thanks for reading and watching the recording!

Kobi

C++ Meetup Meeting #74 – Uninitialized is cool!

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

San Diego C++ Meetup #73 – RAII – How hard could it be?

Hello everyone!

Here is the summary of the last session, took place on Tuesday, April 15 2025.

The session had few topics discussed.

First, I’d like to announce that we have a new Sponsor to our meetup!

Jetbrains has generously agreed to sponsor the yearly Meetup fees!

It is super fun to have your favorite editor being the one sponsor it. Such a win win for me 🙂

Thank you Maria and the team from Jetbrains helping me on that!

Meetup page can be found here

The recording can be found here:

Discussion points in the meetup:

  1. What am I snacking – I talked a bit on Patrice Roy‘s new book “C++ Memory Management” which is an excellent book! Grab it!
  2. AI Assistant and vibe coding. Gave some insights from my experience working on multiple tools, evaluating multiple plugins to IDEs. And it’s fantastic. I’m so scared! The future is here and things IMO will only get better. Senior engineers will have super powers, Junior engineers would need to make sense of what is given to them and I’m afraid that w/o enough experience, this is a challenging part.
  3. Quiz How much impact RTTI (class types w/ or w/o virtual functions) has on typeid?
  4. RAII. Here is what we covered:
    • Simple RAII class
      • I realized after the meeting that I missed having =delete for the copy ctor so we do not mess up copying the handle and risking in double cleanup of the same handle.
      • Better to = delete your copy/op= so you are on the safe side.
    • Using simple SFINAE
    • Using simple concepts
    • Using static_assert
    • Why different instantiation of the RAII class fails.
      • Function pointers
      • References to functions
      • add_pointer_t
      • decltype(auto), return (x), decltype((x))
      • What did Scott Meyers had to say in his last book (Effective Modern C++: C++11/14)
      • Using https://cppinsights.io/ to decipher templates.
    • Using unique_ptr<> with custom deleter.
    • Using gsl::finally
    • Capture-less lambdas in un-evaluated context.

Patrice Roy’s book:

Thank you for reading!
Kobi

San Diego C++ Meetup #72 – Refactoring with C++

Hello everyone!

Tuesday March 18 2025 evening was all about Refactoring with C++ by Dmitry Danilov.

But before we dive to the summary – we’ll mention that there was a Job posting presented by Parker Lanning – Looking for Mid Sr. C++ Developer Role – contract role. Please feel free to contact Parker.

We also mentioned the following:

You can find the recording here:

Link to the meetup page.

I’ll start by saying that I really like Refactoring business, and especially in C++. A clear evidence that there is indeed something wrong with me. (Un?)Fortunately, Refactoring is part of our life. Code evolves, rotten and not maintained correctly. There is some joy in taking such code and making it better, more readable, modern, more maintainable and sometimes even faster!

The book is good. It has a lot of good information in Design choices, reasons for tech debt, how to avoid it, SOLID and more! Grab the book!

So what did we discuss?

  • First, checkout the variety of books available on this subject.
  • Checkout Refactoring.Guru – great site! also has the Design Patterns aspect.
  • We discussed clean code, technical debts, why this is happening, what happens with personal taste? How about the gaps in ones knowledge of the language, the libraries, good practices?
  • People who don’t know about the tool, have questions and concerns. How would I know that std::accumulate is actually doing the right thing and not shooting a rocket to the moon (well, as part of the accumulate operation?)
  • What is a boring but effective API? How about consistent API, const-correct API?
  • What is SOLID? Why it’s so important and not just a buzzword or a Software marketing term. (It’s not just marketing term, it’s super important foundation!). Also think about KISS!
  • How about C++ Core Guidelines ? Yes, these are good and important to know!
  • We discussesed Strategy Pattern, Dependency Injection, Interface Segregation and of course, I mentioned the C++ Design pattern bible of the modern days: C++ Software Design: Design Principles and Patterns for High-Quality Software, by Klaus Iglberger
  • We closed with some low hanging fruits for refactoring Legacy code.

There is no universe where we can cover everything in < 1hr. So please take a look at the book and other useful resources. Do it for yourself, future self and your team.

Oh yes – AI might save us and write better, more idiomatic code for us. I want to believe this would happen soon (well you could argue that it is already happening).

Thanks for reading,

Kobi

Debunking C++ Myths: Dispelling Misconceptions and Embracing Modern C++

San Diego C++ Meetup, February 14th 2025. yes, Valentine day, because we love C++ 🙂

Link to the meetup page here.

Recording uploaded to San Diego C++ Meetup (sdcppmu) YouTube channel:

Hello everyone!

February 2025 was dedicated to a new book from Packpub publication: “Debunking C++ Myths: Dispelling Misconceptions and Embracing Modern C++” by Alex Bolbaoca and Ferenc Deak.

Amazon link here.

During the meeting Alex and Ferenc shared their career stories, how they were introduced to C++, what other languages have influenced their work and answered various questions on the book., and their favorite chapters in the book.

Tune into the the recording to learn more about Alex, Ferenc and bunch of details from the book itself.

Enjoy the recording!

Kobi

San Diego C++ Meetup #70 – Decorator Pattern

Hello all,

I’m late on this report. I’ve been traveling a lot in the past week and did not have a chance to sit down and write this report.

The meeting info on meetup can be found here. Took place on Tuesday, January 14, 2025.

Recording is uploaded as usual to our sdcppmu Youtube channel:

Topics discussed during the meetup:

In this meeting, we’ve discussed the Decorator pattern.

This is heavily inspired by Klaus’ excellent book (which I consider is the bible of Modern C++ Design Patterns). The book can be found on Amazon/O’reilly as printed or soft copy. If you do not own a copy, run, don’t walk to grab one and read!

More things discussed… :

Packtpub publication announced 2 new C++ books which we mentioned (and had coupons to share):

Next, Rich Yonts, the author of a manning’s title 100 C++ Mistakes and How to Avoid Them, called for volunteers to participate in a study. Please contact Rich for more information (hopefully this is still applicable when you read this).

Quiz time – We looked at cppquiz-352 which demonstrates how typedef is not a … new type!

I went through the previous meetup content to clarify few things related to mapping runtime values to compile time, in order to be used as NTTP like in func<val>(). BTW – it’s really cool and you should probably check it out. Lots of fun!

The main talk was about “C++ Decorator Design Pattern”. This is an important and very useful Pattern. Few highlights:

  1. We looked at C++ decorator vs Python function decorator. Not related to each other, comparison was just for fun 🙂
  2. Gang Of Four Decorator Pattern – Structural design pattern used to dynamically add behavior to objects.
  3. Supports OCP and SRP! this is a huge bonus!
  4. We looked at specific use case of adding Decorator.
  5. Decorators can be thought of compositions of features/behavior. Think f(g(h(x))).
  6. C++17 STL allocators also implement such mechanism!

And of course, we always need to highlight shortcoming of this pattern:

  1. Every level in the hierarchy is another level of indirection. Perfs might be impacted but MEASURE!
  2. You could make silly mistakes like applying decorator twice.

That’s it for reading!

Kobi

San Diego C++ Meetup – Meeting #69

Hello all,

Summary of San Diego C++ Meetup – Meeting session number 69. Took place on December 10 2024.

This is the last session for 2024!

Event link can be found here.

Topics we covered:

  • Modern C++ Programming: A tutorial/training session by Federico Busato.
  • ADL and the  std::swap idiom: Including a mention of  std::ranges::swap(). The discussion covered ADL, anonymous namespaces, and the global namespace, highlighting the subtleties when mixing them.
  • Mapping a runtime value to compile time: More details on this topic are provided below.
  • Variadic templates and fold expressions: Exploring techniques to eliminate duplicate code.
  • Lightning talk by GC: GC’s slide deck on “Stateless Allocators and Memory Resources” can be found here.

How can I map a runtime value to a compile-time value?

This was the main topic. The idea was as follows: given something like:

How can I take a runtime value n and pass it to the function? func<n> would not work since n is not a compile-time value!

The original problem to solve was the following (values are just for the example, it could be anything): for a range [0…5] map to 128, [6…10] map to 256, [11…max] map to 512.

People attending the session immediately suggested using an array/map/hash-map (aka unordered_map). I did not have any material to demonstrate anything with these elements, but before I show the solution presented in the session, let’s try to solve it first with the unordered_map type (since people claim it has O(1) efficiency).

This obviously cannot work. The compiler will complain: “call to non-‘constexpr’ function ’ … “. CE link.

So, what about trying to embed some constants in the “value” part of the unordered_map?

So the problem is, what do we place instead of the ????

What is the actual type? Even if I use integral_constant, which can be used in constant expression contexts, I don’t have a way to provide the type. std::integral_constant<std::size_t, 128> is different from std::integral_constant<std::size_t, 256>.

The next attempt was using Jason Turner’s idea of a “constexpr map.” For reference, here is Jason’s C++ Weekly:

Here is a link to CE trying to get it working. But again, this only works with compile-time inputs. The requirement was runtime inputs!

Let’s take a look at the actual implementation presented in the session. For this, you need to be familiar with:

  • std::lower_bound: Given the values [5, 10, max] and a needle, we need lower_bound to find the correct item among the values. Note that lower_bound is not a must here; we could also use a linear search like find/ find_if.
  • std::integral_constant<>: An important ingredient in the overall solution. This is where we can actually pass a constant to the template NTTP!
  • std::variant<> + std::visit() + overloaded{} idiom: For more information, check out cppreference and cppstories.com, which has tons of great articles on these.

Here is a CE link to the overall solution. Thanks to GC for suggesting constexpr on the return of lower_bound when working with C++20! My solution needed to compile with C++17.

Here is a simple explanation of what’s going on:

We have an array of variants. The std::variant is of type:

Think of it as mapping some number to std::integral_constant<size_t, some_value>.

Given a needle, find the index in the array of variants. We use:

  • lower_bound
  • overloaded{} idiom
  • std::visit to extract the first value in the pair<>

Once we have the result of lower_bound, given the iterator return value, we can compute the index using std::distance(base, iter).

Invoke a call that takes the index. We use the index with the array: arr[n].

Since arr[n] yield a variant type, we can run std::visit, getting the value and extracting the integral_constant, which is the second type in the pair.

Now, we can pass it to an NTTP by calling func<p.second()>(). The magic happens with integral_constant<>! It can be used as an NTTP!

That’s it for this session. I bet there are some other cool ways to achieve something similar!

Thank you for reading!

Kobi

San Diego C++ Meetup #68 – The Art of Writing Efficient Programs – design choices for Performance (Nov 13 2024)

Hello all!

Here is the summary of the last San Diego C++ Meetup, virtual meeting, took place on Wednesday, Nov 13 2024.

Link to the meetup event page here.

Recording uploaded to the San Diego C++ Meetup channel (sdcppmu)

The agenda:

  1. cppquiz fun – C++ Quiz – 297 – std::async, future .wait() vs .get()
  2. Recommending YT channel – “C++Next by Alex Dathskovsky”
  3. The Art of Writing Efficient Programs – chapter 12 – Design choices for Performance.
  4. Tip: transparent comparator/operators.

More details:

First, Alex’s YT channel mentioned above is something you should checkout. It’s fun, short episodes and packed with good information.

We mentioned few Design choices as mentioned in Fedor G. Pikus book: “The Art of Writing Efficient Programs: An advanced programmer’s guide to efficient hardware utilization and compiler optimizations using C++ examples”:

Chapter 12 discuss “Design for Performance”. We mentioned:

  1. Choosing APIs for performance. operator[] vs iterator interface, std::deque as an example to have better performance using iterator vs operator[].
  2. Using std::set<> in conjunction with std::vector<>, using member vs non-member functions.
  3. Lock vs non-lock interfaces, runtime vs Template, policy based classes. Also, using decorators (inheritance in this case).
  4. Redundant get-ters/set-ters and when these are actually could be useful.
  5. 13:34 – we mentioned std::span<>! 🙂
  • Transparent operator – using std::less<> which is like std::less<void>, the benefit of using it, how can it save you from debugging subtle bugs.

This is for this session, thank you for reading!

Kobi

San Diego C++ Meetup – Data Structures and Algorithms with C++ STL (#67)

Hello all,

We had a fun evening on Tuesday October 15th, discussing C++ STL, Data structure and various modern techniques. The inspiration coming from a recently published book by John Farrier:

recording:

San Diego C++ Meetup recording

Event page here.

Hey everyone,

Here’s a quick recap of our discussion:

We kicked things off with cppquiz 167. It’s a tough one but packed with important modern C++ concepts like RValue, LValue, and what happens when you pass an RValue to a function. We also touched on std::move and std::forward. Give it a shot and make sure to read the explanation!

C++ Data Structures and STL:

  • We talked about getters and exposing internal data structures from your class. We also introduced alternatives like iterators and discussed how to write them in different ways.

SFINAE and std::void_t:

  • We covered how SFINAE tweaks the compiler’s function candidate list, mentioned C++20 concepts, and how std::void_t can help. We also discussed type_traits, if constexpr, static_assert(), declval, and how cppinsights.io can be useful.

Allocator Interface:

  • How to use it with STL containers.

std::span<> Example:

  • We went through an example of std::span<>.

Gotchas:

  • Comparing two strings or comparing pointers? Check out the last 2-3 minutes of the recording for the full details!

Book Recommendation:

  • I liked the book, though it was a bit basic for me. However, I think it’s great for newcomers to the language/STL to get familiar with various containers, algorithms, and other parts of the Standard Template Library.

Thanks for reading!

Kobi

San Diego C++ Meetup #66 – Modern CMake for C++

Hello everyone,

Last Tuesday (September 17, 2024), we gathered for the 66th meeting of The San Diego C++ Meetup.

The topic was CMake. Yes, CMake can be fun sometimes! 😊

The inspiration for this session came from the relatively new 2nd edition of “Modern CMake for C++” by Rafal Swidzinski.

First off, the book is fantastic! It’s packed with valuable material that can make your life easier if your build system is CMake. Despite considering myself quite knowledgeable about CMake, I learned a lot from it.

This wasn’t my first time giving a talk on CMake. I’ve had several opportunities in the past, ranging from one-hour to multi-hour sessions. It always feels like there’s so much to cover that even 1, 2, or 4 hours isn’t enough to touch on every aspect of CMake. CMake is extensive, and it’s crucial to understand and use it well. Otherwise, your build system can become difficult to improve, extend, and maintain, leading to a lot of frustration.

When discussing CMake (or any topic in a C++ session), my goal is for everyone to learn something new—at least one thing!

The meetup page link: here

And the recording:

San Diego C++ Meetup recording

BTW – We had an excellent session on July 11, 2023, with Alex Reinking, titled “Modern CMake Best Practices for Library Authors” at the San Diego C++ Meetup. It’s definitely worth watching!

Summary of our discussion:

  • Introduction to the book.
  • CMake’s popularity (based on 2023 surveys).
  • Overview of CMake: its purpose and stages (configuration, generation, and build).
  • Simple CMake files and FetchContent.
  • Generators: what they are and how to write agnostic command lines that work with any generator.
  • CMake Cache file (CMakeCache.txt): using the --force option, cache variables, and debugging/tracing CMake build generation with options like --trace, --log-context, --trace-expand, and --debug-output.
  • Cleaning with the --clean-first option.
  • Targets: what they are and how to build them.
  • Installation: a high-level overview (there’s much more to explore here).
  • Running CMake as a script with the -P option.
  • Brief mentions of CTest/CPack and other tools in the CMake suite.
  • CMakeConfigureLog.yaml (introduced in version 3.26) for advanced debugging of the configure stage.
  • Utility modules included with the CMake package, and projects like cmake-awesome and cmake-modules.
  • Find modules.
  • A slide on important elements of the CMake language (the book has an excellent chapter on this).
  • CLion and CMake: debugging CMake with CLion.

Additional topics covered in the book:

  • Generator expressions
  • Dependency graph and how to print it
  • CMake presets
  • Program analysis tools
  • C++20 modules
  • Testing frameworks
  • Generating documentation

Many thanks to Packtpub for their support providing me the material to review!

That’s it for this session!

Happy CMake-ing!

Kobi

San Diego C++ Meetup #65

Hello everyone,

Super late in writing this summary, can’t believe we are 1 week past the session. I’ve been super busy at work and with Family.

What did we have on the Agenda:

  1. Guo Ci, our guest speaker, presented 2 techniques that are being used to optimize C++ code. The first is doing binary searches with equal_range (in std::ranges and std) and the second is customizing the three-way comparison operator (<=>). Slides: guoci SDCPPMU presentation
  • bio: Guo Ci. Guo is a bioinformatician at the University of Michigan, working in labs doing proteomics and genomics research.
  1. Adding Default Constructor using =default; to your class type.

sdcppmu Youtube recording:

Event page from meetup.com

Summary of the discussions:

  1. From Guo Ci talk – demonstrated techniques related to spaceship/comparison operator
  2. Second item from Guo Ci talk – A more generic equal_range

Next part of the meeting talked about “Adding Default Constructor using =default; to your class type”. We compared aggregate changes between 17 and 20. For 20, an aggregate cannot have “user-declared or inherited constructors”. 17 could. So 20 is stricter. Examples in the slides from godbolt.

The last part of the session talked about top level const in function deceleration, why clang-tidy complains and the rational behind it.

Thanks for reading!

Kobi

San Diego C++ Meetup #64 – July 16 2024

Hello all!

Summary of the recent San Diego C++ meetup session, took place Tue, July 16 2024 5PM Pacific Time.

Agenda in this meeting:

  1. New C++ Book – C++ Brain Teasers! – by Anders Schau Knatten – image above.
  2. Discussion on Throwing destructors
  3. Yet another hard to find(?) bug

Meetup event page here.

Recording can be found here:

San Diego C++ #64 Meetup recording

Details:

  1. I introduce “C++ Brain Teasers” book by Anders Schau Knatten. The PragProg page has 3 items that can be accessed. Puzzles 2,3,14. We went over each and discussed it. Super fun book, very recommended! Amazon link if you’d like also the colored printed book.
  2. Throwing destructors Discussion – noexcept and C++11, is it a good idea to throw from destructors? what happens when you aggregate a type with “noexcept(false)” ? How to workaround such issue? What do Core Guidelines say? It triggered lots of good discussions.
  3. And finally, a very hard to find(?) bug related to temporaries and lifetime. I saw it in production code few times in the past few months and wanted to share it with the group. Lots of good discussions here as well!

That’s it for July 2024. Working on the agenda for the next meeting!

Thank you for reading!

Kobi