value() [Variant class]

The value method is a template that returns a reference to the stored value of the variant. The allowable types are listed in Variant::Type. This can be done to either get or set a value.

template<typename T>
T& value();

template<typename T>
const T& value() const;

int value1 = variant1.value<int>();
bool value2 = variant2.value<bool>();
String value3 = variant3.value<String>();

See value, as, and to for when to use the value() vs. other accessors.