- reworked the lock code to remove the 255 locks limit and to allow it to automatically deinitialize.
This commit is contained in:
parent
982c622367
commit
17e053499e
5 changed files with 81 additions and 93 deletions
30
src/tarray.h
30
src/tarray.h
|
|
@ -943,6 +943,36 @@ public:
|
|||
return n->Pair.Value;
|
||||
}
|
||||
|
||||
VT &Insert(const KT key, VT &&value)
|
||||
{
|
||||
Node *n = FindKey(key);
|
||||
if (n != NULL)
|
||||
{
|
||||
n->Pair.Value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
n = NewKey(key);
|
||||
::new(&n->Pair.Value) VT(value);
|
||||
}
|
||||
return n->Pair.Value;
|
||||
}
|
||||
|
||||
VT &InsertNew(const KT key)
|
||||
{
|
||||
Node *n = FindKey(key);
|
||||
if (n != NULL)
|
||||
{
|
||||
n->Pair.Value.~VT();
|
||||
}
|
||||
else
|
||||
{
|
||||
n = NewKey(key);
|
||||
}
|
||||
::new(&n->Pair.Value) VT;
|
||||
return n->Pair.Value;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//
|
||||
// Remove
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue