Tag: std::variant

C++17: std::variant<>

Written by on November 5, 2017 in C++, Programming with 0 Comments
C++17: std::variant<>

C++17 introduces a new type-safe union in the form of std::variant. At any time, it can store a single value from one of many types. We need to include <variant>┬áto use this feature. Let us look at a simple example to get started: First, we define a variant object v1 to hold either an int […]

Continue Reading