void Value::clear() { switch (mType) { case Type_String: stringPtr()->~String(); break; case Type_Map: mapPtr()->~Map<String, Value>(); break; case Type_List: listPtr()->~List<Value>(); break; case Type_Custom: customPtr()->~shared_ptr<Custom>(); break; default: break; } mType = Type_Invalid; }
inline void clear() { gk_list *l = listPtr(); cmds.clear(); l->ncmds = 0; l->cmds = nullptr; }
void updateList() { auto l = listPtr(); l->ncmds = cmds.size(); l->cmds = cmds.data(); }