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

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -