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
Hello,
I try to use the following code to get a boolean subkey. bool switch = !config["Function"]["Enable"].is_null() ? config["Function"]["Enable"] : true;
But the build process failed with the "Expected unqualified-id" message.
I'm using Xcode with c++14 support.
BTW, what's the correct way to read arbitrary key value(no matter in what level) to a variable? Thanks!
The text was updated successfully, but these errors were encountered:
switch is a C++ keyword. You cannot use this as a name for a variable.
To deduct the type of the variable, all branches need to return the same type. true is bool, but config["Function"]["Enable"] is json. The latter can be converted as follows:
Hello,
I try to use the following code to get a boolean subkey.
bool switch = !config["Function"]["Enable"].is_null() ? config["Function"]["Enable"] : true;
But the build process failed with the "Expected unqualified-id" message.
I'm using Xcode with c++14 support.
BTW, what's the correct way to read arbitrary key value(no matter in what level) to a variable? Thanks!
The text was updated successfully, but these errors were encountered: