The PImpl idiom and the C++26 std::indirect type
Summary
The article explains the PImpl idiom for C++ and compares implementations using a raw pointer, std::unique_ptr, and the new C++26 std::indirect type. It provides a Widget example, discusses const-correctness and moved-from states, and highlights GCC 16 support for std::indirect along with related resources. It emphasizes how std::indirect can improve encapsulation while preserving value-like semantics.