You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And it helps you to work with different types of tokens:
// Find out its type:uint8_t p1_type = p1->type; // INT type.// Serialize it:
std::string str = p1.str(); // "10"
std::cout << p3 << std::endl; // "{}" (an empty map)// Or even cast it between different compatible types:double p1_asDouble = p1.asDouble();
int p1_asInt = p1.asInt();
// If the cast is invalid, it throws an error:
std::string p1_asString = p1.asString();
Note that if your goal is to serialize a token p1.str() is the correct
way to do it, since asString() is a cast and would throw an error for tokens that are not strings.
TokenMap: The key-value container of packTokens
The TokenMap container is a very versatile object
with an intuitive API: