tld - Loading a map only once in application life cycle by reading a file in c++ -


i want load map reading file in application startup, , want utilize map in other class particular string , execute logic.

loading of map should done once in application life cycle.

would know best approach declare map , access in other logic.

best approach load once

const std::map<key_type,value_type>& themap = loadmap(); 

and pass const reference other functions:

 std::map<key_type,value_type>::const_iterator   find_key(key_type key, const std::map<key_type,value_type>& map) {      return map.find(key);  } 

Comments

Popular posts from this blog

android - questions about switching from C2DM to GCM -

c++ - Qt setGeometry: Unable to set geometry -

batch file - How to extract all multi-volume RAR archives from subfolders of a folder? -