What's the purpose of the map in the chuck_array struct?
Hello, I've been trying to find how find() and erase() worked for arrays. I saw in chuck_lang.cpp array_find and array_erase, but they were given a string as an input. Which I thought was pretty bizarre, but I tested it out, and when I write arr.erase("foo"); it compiles (same with find), even when arr is an int array, but it doesn't really do anything (find always returns 0, which I assume means "I can't find anything"). It doesn't even do anything if arr is a string array. I eventually found the implementations in chuck_oo.(h|cpp). There is a chuck_array struct, and two of the member function are erase and find. These functions just run erase and find on the struct's public map. And the input for the functions is the key, which is always a string. But why is there a map in the structs? Like, it seems like the vector is what holds the data (whether it's 4, 8, 16, 24, or 32 bit data), but what does the map hold? Is it supposed to be internal stuff a user shouldn't have access to? Then why is there erase() and find() which uses the map? And why is the key always a string? I do not understand.
participants (1)
-
Michael Golub