- Added `in` operator support
This commit is contained in:
Tristan B. Velloza Kildaire 2024-04-26 22:53:03 +02:00
parent c5c7a02ac0
commit fa80d17cd2
1 changed files with 4 additions and 1 deletions

View File

@ -279,7 +279,8 @@ public struct Registry
return potEntry;
}
public ConfigEntry* opBinary(string op, string)(string name)
public ConfigEntry* opBinaryRight(string op)(string name)
if(op == "in")
{
return getEntry0(name);
@ -489,6 +490,8 @@ unittest
reg["age"] = 25;
assert(cast(int)reg["age"] == 25);
ConfigEntry* ageEntry = "age" in reg;
// Should not be able to set entry it not yet existent
try
{