Associative Array, get value instead of poiter using `if (auto ..)`, possible?
ryuukk_
ryuukk.dev at gmail.com
Sat Aug 31 13:48:52 UTC 2024
On Saturday, 31 August 2024 at 13:00:42 UTC, Steven Schveighoffer
wrote:
> On Saturday, 31 August 2024 at 12:47:25 UTC, ryuukk_ wrote:
>> ```D
>> void main()
>> {
>> int[string] test;
>>
>> test["hello"] = 42;
>>
>> if (auto it = "hello" in test)
>> {
>>
>> }
>>
>> }
>> ```
>> Is there a way to get the value instead of a pointer? while
>> keeping the conciseness (one line)
>
> Maybe if(auto it = test.get(“hello”, 0))
>
> -Steve
Now i can't use 0 as a value, that's not a solution
More information about the Digitalmars-d-learn
mailing list