#pragma once template mapValue* getMapValue(std::map& mmapData, const mapKey& key, bool bNew) { mapValue *pRe = 0; //std::map::iterator it = mmapData.find(key); //pj auto it = mmapData.find(key); if (it != mmapData.end()) { pRe = &it->second; } else if(bNew) { mapValue valueD; mmapData[key] = valueD; pRe = getMapValue(mmapData, key, false); } return pRe; } template mapValue* getMapValue(std::map >& mmapData, const mapKey1& key1, const mapKey2& key2, bool bNew) { mapValue *pRe2 = 0; { std::map *pRe1 = getMapValue >(mmapData, key1, bNew); if (pRe1) { pRe2 = getMapValue(*pRe1, key2, bNew); } } return pRe2; } template const mapValue* getMapValue_Const(std::map& mmapData, mapKey key) { const mapValue *pRe = 0; //std::map::const_iterator it = mmapData.find(key); auto it = mmapData.find(key); //pj if (it != mmapData.end()) { pRe = &it->second; } return pRe; } template const mapValue* getMapValue_Const(std::map >& mmapData, mapKey1 key1, mapKey2 key2) { const mapValue *pRe2 = 0; { const std::map *pRe1 = getMapValue_Const >(mmapData, key1); if (pRe1) { pRe2 = getMapValue_Const(*pRe1, key2); } } return pRe2; }