Using std::variant in C++17: A Practical Guide

The std::variant class template, introduced in C++17, represents a type-safe union. An instance of std::variant holds a value of one of its specified alternative types at any given time, or it can be valueless under exceptional circumstances (via valueless_by_exception). It is a safer and more powerful alternative to traditional unions, support ...

Posted on Sun, 30 Aug 2026 16:39:09 +0000 by benjaminj88