Improbable Icon

Map\list quick suggestion



Would be great to have basic functionality for spatial types provided by codegen

  • remove index from array (removes specified index in array)
  • override list value by key is missing


  • length of a map (returns int length)
  • keys of a map (rerturns all keys)
  • override value by key

those list\maps vars are strange without them


Thanks for your feedback @swdan90! I’ll move this to the feedback section, as it fits better it there; hope you don’t mind.


Just a little update on this: to get length of a map, you can use size() method, and to erase a particular element of a list, you can do list.erase(list.begin() + i). To get keys of a map, you’ll have to iterate over it. Hope this helps.


sure. however there are no built in (could not find em? o_O) functions. implementing by myself returned funny results. got workaround for now, but would be nice to have them in in the future.


Sorry for the delay @swdan90! And sorry if I’m misunderstanding your question, but there is a built in function for removing a list element (worker::List::erase()) and one for obtaining the length of a map (worker::Map<T, T>::size()). Is that what you were looking for?


yes. this one. wasted like week, still can’t get it working.


Would this help?

template <class T>
void remove(worker::List<T>& list, const T& item)
    list.erase(std::remove(list.begin(), list.end(), item), list.end());

template <class T>
void remove_at(worker::List<T>& list, const size_t index)
    list.erase(list.begin() + index);

template <class T>
void print(const worker::List<T>& list)
    std::cout << "size: " << list.size() << std::endl;

    for (const auto& value : list)
        std::cout << value << std::endl;

// Entry point
int main(int argc, char** argv) {
    worker::List<int> list;

    remove_at(list, 2);
    remove(list, 25);

    worker::Map<std::string, int> map;
    map["a"] = 0;
    map["b"] = 2;
    map["c"] = 4;

    worker::List<std::string> keys;
    for (const auto& value : map)

    remove<std::string>(keys, "a");


yep, thanks. tho i solved this in similar manner before saw your post.

also in the map. Emplace fails if key exists and there is no function that can modify value by key.
created my own :\

requesting this one as well


also override list value by key is missing