In article <dq*************@news.t-online.com>,
Rolf Magnus <ra******@t-online.de> wrote:
Is there any way I can declare a const or static map and fill it such
that this isn't done at run-time (at least, not on each construction of
the object)? There are about 20 entries, not hundreds.
No, this isn't possible. You may want to try something like gperf. See
http://www.gnu.org/software/gperf/
If I have a class with a static map, won't that initialize at run time
but before the main body of the program? Even that would be a bonus.
Is the following possible in a class (this is nearly pseudo code,
derived from a "codecomments.com article):
pair<string, string> a[] = {
pair<string, string>("a","apple"),
pair<string, string>("b","banana"),
}
map<string, string> myMap(a, a + sizeof(a) / sizeof(a[0]) );
where a and myMap are declared static in the header? the strings were
char cont * in the original article, does this make a difference?