bool Texture2D::ParseTextureAtlas(const string& fileName, const map<string, ImageDef>& imageMap){ imageMap["whatever"] = ImageDef(...); return true;}
[C++] Add map item passed in by reference
Why doesn't the following work? Searched everywhere. I want to pass the map in by reference so it doesn't copy it over. Why can't I add an item to the map?
Because you're using a const reference to the map. If you want to modify it, use a non-const reference.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement