Skip to content

Instantly share code, notes, and snippets.

@LegalizeAdulthood
Created November 15, 2017 22:49
Show Gist options
  • Save LegalizeAdulthood/77c08efe218aff375b2cfc1eb5b7c310 to your computer and use it in GitHub Desktop.
Save LegalizeAdulthood/77c08efe218aff375b2cfc1eb5b7c310 to your computer and use it in GitHub Desktop.
Compile-time JSON example
constexpr auto jsv = R"({
"feature-x-enabled": true,
"value-of-y": 1729,
"z-options": {
"a": null,
"b": "220 and 284",
"c": [ 6, 28, 496 ]
}
})"_json;
if constexpr (jsv["feature-x-enabled"]) {
// code for feature x
} else {
// code when feature x turned off
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment