I need to update this map to include one more key-pair. The map is const std::map<char, std::shared_ptr<const TrieNode>> children_.
The const seems to block any method that is tried. Attempted code:
children_[]children_.insert()children_ = /* newly created map */
Why can I not override the existing map?
Example:
current_node->children_['c'] = std::make_shared<TrieNode>(TrieNode());
Getting errors:
No viable overloaded operator[] for type 'const std::map<char, std::shared_ptr<const TrieNode>>'clang(ovl_no_viable_subscript)
stl_map.h(512, 7): Candidate function not viable: 'this' argument has type 'const std::map<char, std::shared_ptr<const TrieNode>>', but method is not marked const
stl_map.h(492, 7): Candidate function not viable: 'this' argument has type 'const std::map<char, std::shared_ptr<const TrieNode>>', but method is not marked const