Understanding std::any in Modern C++

Overview C++17 introduced three utility types commonly referred to as the "trio": std::optional, std::any, and std::variant. This article focuses on std::any, a type-safe container designed to hold a single value of any copy-constructible type. The class is defined in the <any> header: namespace std { class any; } Unlike templa ...

Posted on Fri, 08 May 2026 00:20:08 +0000 by saint4