Variant
The variant class acts as return value container for properties and methods. This class allows to store data of any type and convert between these types transparently. It can hold one value at a time (using containers you can hold multiple types e.g. std::vector<int>
). Remark that the content is copied into the variant class. Even raw arrays (e.g. int[10]
) are copied. When you would like to avoid copies, use pointer types or wrap your type in a std::reference_wrapper<T>
A typical usage is the following example:
using namespace rttr;
var = 23; // copy integer
var = "Hello World"; // var contains now a std::string (implicit conversion of string literals to std::string)
std::cout << var.to_int(); // convert std::string to integer and prints "42"
int my_array[100];
The array_range class provides a view into an underlying data structure with lower and upper limits.
Definition array_range.h:64
The variant class allows to store data of any type and convert between these types transparently.
Definition variant.h:199
Definition access_levels.h:34
Generated on Fri Jan 26 2024 00:00:00 for rttr - 0.9.7 by doxygen.