I have generated a sorted list of about 117000 English words, which I have put into a std::vector<std::string>
in a C++ header file, like so:
#ifndef WORDS_HPP
#define WORDS_HPP
#include <vector>
#include <string>
const std::vector<std::string> words{
"a",
"a\'s",
"aa",
"aa\'s",
"aaa",
/* >100k lines omitted */
"zyuganov",
"zyuganov\'s",
"zzz"
};
#endif
When including this monstrosity in a .cpp file and compiling the thing with g++ (Debian 4.9.2-10) 4.9.2, the compiler causes my system to run out of memory. I only have 4 GB, unfortunately.
I would like to have the vector compiled statically into my executable (toy project, FYI), but obviously I can't get it to work. How do I solve this?