From Jason Turner
Watch on YouTube

Summary

In this episode, Jason Turner explores an unconventional debugging technique: using the `explicit` keyword on copy constructors to identify unintended or accidental copies in C++ code. When a class's copy constructor is marked as `explicit`, all implicit copies of that class will fail to compile, forcing developers to explicitly show their intent when making copies. This technique can help identify unexpected copies of expensive objects that might hurt performance, though Jason notes it's more of a diagnostic tool than something you'd want in production code.

Resources

Tags