Are you trying to conserve RAM for some reason? If lots of searches will be taking place (e.g. some translation-based memory game), it makes more sense to
read everything once at startup/initialization, as suggested by jonnin. Once it's in random-access memory, the searches will be fast, e.g. O(1) if exists or O(log n) to determine it doesn't for the already-sorted std::map.
You don't want too much RAM being used? Then consider making a subset of the full dictionary with the most common, e.g. conversational, words used with their translations. But first try with the full dictionary and see if it really is a problem.
As dhayden said, reading files is slow. You really only want to do this once.
Once you've created your dictionary completely (and it will no longer change), you can binary serialize/deserialize with Boost. Might be faster than manually reading it back in.
Side note: while you may use Windows XP, this is not realistic for most users, since even Windows 7 is about to get deprecated "for realz". I still use Win7 at home but will soon be changing that once I get a new processor. If it's a desktop app, you can expect 64-bit for most OS. But really, how much memory space would a
map<string, vector<string>>
, where most of the value translations have one item, with a couple million items even take up? If
https://stackoverflow.com/questions/720507/how-can-i-estimate-memory-usage-of-stdmap is any indication, with 2million items you're looking at maybe 200MB usage.