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

resolveCall from class fcf::TypeInfo

Property: resolveCall

Type: fcf::ResolveSpecificator::CallType

Class: fcf::TypeInfo

Package: fcfBasis

File: bits/PartType/TypeInfoDefinition.hpp

Available from version: 1.0.1

A function pointer for the "resolve" specificator for fast access.

Example:

#include <iostream> #define FCF_BASIS_IMPLEMENTATION #include <fcfBasis/basis.hpp> int main() { fcf::Variant variant = "some string"; const fcf::TypeInfo* ti = fcf::Type< fcf::Variant >().typeInfo(); // We get information about the stored object in the variant object fcf::ResolveData resolveData = ti->resolveCall(&variant); // The index of the stored type std::cout << "Type index: " << resolveData.typeIndex << std::endl; // The name of the stored type std::cout << "Type name: " << fcf::getTypeInfo(resolveData.typeIndex)->name << std::endl; // Indicating that the given container may contain a random type of data std::cout << "Invariant state: " << resolveData.invariant << std::endl; // The pointer for the stored data std::cout << "Data: " << *(std::string*)resolveData.data << std::endl; return 0; }

Output:

Type index: 30 Type name: std::string Invariant state: 1 Data: some string