Problem with core::map

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
vincent-v
Posts: 10
Joined: Wed Jan 06, 2010 9:39 pm
Location: Valbonne, France

Problem with core::map

Post by vincent-v »

Hi everyone,

I declared a

Code: Select all

core::map<core::stringw, core::map<core::stringw, core::stringw> > m_data;
and then I try to retrieve a value in the second map

Code: Select all

const core::map<core::stringw, core::stringw>& set = m_data[group];
core::stringw retValue = set[key];
But it doesn't work...
INIFile.hpp:86: error: passing `const irr::core::map<irr::core::stringw, irr::core::stringw>' as `this' argument of `irr::core::map<KeyType, ValueType>::AccessClass irr::core::map<KeyType, ValueType>::operator[](const KeyType&) [with KeyType = irr::core::stringw, ValueType = irr::core::stringw]' discards qualifiers
I guess this happens because of the const qualifier but the reference needs to be const qualified.

Any help is welcome :D

[EDIT]

I found a workaround using a pointer

Code: Select all

core::map<core::stringw, core::map<core::stringw, core::stringw>* > m_data;
But I'm still wondering if there is a way to solve my problem without pointers usage.
Post Reply