FCF 2.0 development in progress...
> > > > > >
[News] [C++ Libraries API] [C++ Downloads] [Donate to the project] [Contacts]

converters from class fcf::TypeInfo

Property: converters

Type: fcf::TypeInfo::ConvertersType

Class: fcf::TypeInfo

Package: fcfBasis

File: bits/PartType/TypeInfoDefinition.hpp

Available from version: 1.0.1

Map of conversion functions for converting FROM this type.

The key is the integer type identifier, and the value is the conversion function fcf::ConvertFunction

Example:

#include <iostream> // Define an implementation macro to include the implementation section in header files #define FCF_BASIS_IMPLEMENTATION #include <fcfBasis/basis.hpp> int main() { const fcf::TypeInfo* ti = fcf::Type<int>().typeInfo(); int intValue = 5; std::string strValue; fcf::ConvertFunction convertFunction = ti->converters.find(fcf::Type< std::string >().index())->second; convertFunction(&strValue, &intValue, 0); std::cout << "Converted string value: '" << strValue << "'"<< std::endl; return 0; }

Output:

Converted string value: '5'