Update AMTL; replace AutoPtr/UniquePtr with STL.

This commit is contained in:
David Anderson
2020-05-18 18:19:16 -07:00
parent c2df49ee33
commit 7d7253c9cc
20 changed files with 78 additions and 58 deletions
+5 -3
View File
@@ -30,8 +30,10 @@
*/
#include <stdlib.h>
#include <memory>
#include "common_logic.h"
#include <am-autoptr.h>
#include <am-moveable.h>
#include <am-refcounting.h>
#include <sm_stringhashmap.h>
@@ -182,7 +184,7 @@ struct TrieSnapshot
}
size_t length;
ke::AutoPtr<int[]> keys;
std::unique_ptr<int[]> keys;
BaseStringTable strings;
};
@@ -557,7 +559,7 @@ static cell_t CreateTrieSnapshot(IPluginContext *pContext, const cell_t *params)
TrieSnapshot *snapshot = new TrieSnapshot;
snapshot->length = pTrie->map.elements();
snapshot->keys = ke::MakeUnique<int[]>(snapshot->length);
snapshot->keys = std::make_unique<int[]>(snapshot->length);
size_t i = 0;
for (StringHashMap<Entry>::iterator iter = pTrie->map.iter(); !iter.empty(); iter.next(), i++)
snapshot->keys[i] = snapshot->strings.AddString(iter->key.chars(), iter->key.length());