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
json data{
"chassis": {
"motor": {
"left": {
"prot": 1,
"isRevase": false,
"gear": 1
},
"right": {
"prot": 2,
"isRevase": true,
"gear": 1
},
},
}
staticvoidaction(void * ptr)
{
// if jsonType is bool flaot? How to Realize Automatic Judgment?long *p=static_cast<long*>(ptr);
*p=100;
std::cout<< json data["chassis"]["motor"]["left"]["prot"]<<std::endl; //output 100//I want to be able to pass the value pointer directly, without restricting the type.
json::autoType p=static_cast<json::autoType *>(ptr);
*p=100;
std::cout<< json data["chassis"]["motor"]["left"]["prot"]<<std::endl; //output 100
}
void test
{
long*a =data["chassis"]["motor"]["left"]["prot"].get_ptr<long *>();
action((void*)a);
//I want to be able to pass the value pointer directly, without restricting the type.auto *a=&data["chassis"]["motor"]["left"]["prot"];
action((void*)a);
// //I want to change JSON by a reference
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: