cgv
|
#include <variant.h>
Static Public Member Functions | |
static T | get (const std::string &value_type, const void *value_ptr) |
convert the value pointed to by value_ptr of type value_type to type T and return it | |
static void | set (const T &value, const std::string &value_type, void *value_ptr) |
convert the first parameter of type T into value_type and store the value at the location pointed to by value_ptr | |
convenience template to access a value pointed to by a void pointer where the type of the value is given by a string as it results from cgv::type::info::type_name<T>::get_name(). The template argument T is the type into which the stored type is to be converted. With the get method the pointed to value can be read out and with the set method written. If type T is not equal to the stored type, an automatic conversion is performed. A specialization for std::string converts number types to strings with the help of atoi and atof.