On Jun 27, 2:09 pm, red floyd <[EMAIL PROTECTED]> wrote: > > You error is on 23. sizeof(pairs) is much larger than the number of > entries, so you're running off the end of pairs[]. You either need to > use sizeof(pairs)/sizeof(mypair_t), or since it's a run-time value: >
Yes, thank you. I had seen the array_size template function before, but it didn't occur to me that having an invalid pointer would cause the problem I saw. I used it and it all worked, I think. I was about to write another paragraph about how I still didn't get it, but I neglected to look down in the sources of insert_unique (std_tree.h: 996) where it's clear that the pointer changed because it was supposed to, and I just misinterpreted the gdb stacktrace. Now I'm clear about why the incorrect second iterator blew me up. > int main() > { > std::map<std::string, void(*)()> mymap(pairs, array_size(pairs)); > > } I think you meant std::map<std::string, void(*)()> mymap(paris, pairs +array_size(pairs))); right? The second (non-default, non-copy) map constructor takes two iterators, not an interator and a size. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus