Try this:
```
synchronized final class SyncAA(K, V)
{
        V opIndex(K key) { return sharedTable[key]; }
V opIndexAssign(V value, K key) { return sharedTable[key]=value; }
        const(K[]) keys() const { return unsharedTable.keys; }
        void remove(K key) { sharedTable.remove(key); }
        V get(K key, lazy V defaultValue=V.init)
        {
                auto p = key in sharedTable;
                return p ? *p : defaultValue;
        }
private:
        V[K] sharedTable;
        ref inout(V[K]) unsharedTable() inout
        {
                return *cast(inout(V[K])*)&sharedTable;
        }
}
void f(shared SyncAA!(string,string) a)
{
        a.keys();
        a["12"]="34";
        a.remove("12");
}
```

Reply via email to