Skip to content

C++ reference

Basic types

TVariant

A container that can store objects of arbitrary types.

// declare variant types
using MyVariantType = TVariant<int, float, FOtherType>; // can store ints, floats, and FOtherType instances
// create
auto VariantVar = MyVariantType{TInPlaceType<FOtherType>(), FOtherType()};
// check type
VariantVar.IsType<FOtherType>();
// get the typed value
VariantVar.Get<FOtherType>(); // returns a reference to the contained value