Am Tue, 06 Oct 2015 21:39:28 +0000
schrieb Fusxfaranto <[email protected]>:
> Additionally, just like associative arrays, if you need to access
> the value, you can get a pointer to it with the in operator (and
> if the key doesn't exist, it will return a null pointer).
>
> const(JSONValue)* p = "key" in root;
> if (p)
> {
> // key exists, do something with p or *p
> }
> else
> {
> // key does not exist
> }
And you could go further and write
if (auto p = "key" in root)
{
// key exists, do something with p or *p
}
else
{
// key does not exist
}
--
Marco