For some reason, I am having trouble editing values in my unordered_map, and am wondering what I'm doing wrong.
In the following code, parameteris a struct. For some reason, the following code is throwing a syntax error, not liking the [.
void MyClass::setParameter(string name, parameter param) {
if (this->param_name_to_data == nullptr) {
//create it lazily
this->param_name_to_data = new unordered_map<string, parameter>();
}
this->param_name_to_data->[name] = param;
}
The dictionary id declared in the corresponding .h file as:
private:
std::unordered_map<std::string, parameter> * param_name_to_data = nullptr;
What am I doing wrong?
unordered_map?