MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / ExternSTLMapErase

Function ExternSTLMapErase

test/externref/ExternrefTest.cpp:233–242  ·  view source on GitHub ↗

Host function to erase std::map by key.

Source from the content-addressed store, hash-verified

231
232// Host function to erase std::map<std::string, std::string> by key.
233WasmEdge_Result ExternSTLMapErase(void *, const WasmEdge_CallingFrameContext *,
234 const WasmEdge_Value *In, WasmEdge_Value *) {
235 // Function type: {externref, externref} -> {}
236 void *Ptr0 = WasmEdge_ValueGetExternRef(In[0]);
237 void *Ptr1 = WasmEdge_ValueGetExternRef(In[1]);
238 auto &Map = *reinterpret_cast<std::map<std::string, std::string> *>(Ptr0);
239 auto &Key = *reinterpret_cast<std::string *>(Ptr1);
240 Map.erase(Key);
241 return WasmEdge_Result_Success;
242}
243
244// Host function to insert a key into std::set<uint32_t>.
245WasmEdge_Result ExternSTLSetInsert(void *, const WasmEdge_CallingFrameContext *,

Callers

nothing calls this directly

Calls 2

eraseMethod · 0.80

Tested by

no test coverage detected