> As I said, it does work with my compiler (egcs-1.0.3). This is pure luck. My compiler happens to compile (++i)*(++i) without formating the hard disk. Lucky me. This is not guaranteed either. > I also checked the > STL include files, and saw no reason why it shouldn't work. > The only question is whether there are different STL implementations in > which the above trick doesn't work ? [Is the map container is alway > implemented using a red-black tree?] NO! The Standard does not enforce any special implementation. > I've attached a small testing program. Try to find a compiler on which the > program fails. Even if every compiler happen to work correct, modifying map keys is not sane. ---------------------------- snip ------------------------------- In Simple Associative Containers, where the elements are the keys, the elements are completely immutable; the nested types iterator and const_iterator are therefore the same. Other types of associative containers, however, do have mutable elements, and do provide iterators through which elements can be modified. Pair Associative Containers, for example, have two different nested types iterator and const_iterator. Even in this case, iterator is not a mutable iterator: as explained above, it does not provide the expression *i = t. ---------------------------- snip ------------------------------- > First, it is not so small (you can have 20-40 insets in a paragraph). > Second, the whole point of using the map container (instead of list) was to > improve performance. If we delete/reinsert every element in the map, it will > be slower than using a list container. Then stick to lists. If the insets were storde in a vector sorted according to there position in the text, you could use binary search to access them... > I can put into the source code both the "slow" and "fast" ways of updating > the map keys (with an #ifdef FAST_MAP_UPDATE). We can also use the configure > script to run the testing program to check if the "fast" way works. Special "support" for non-standard behaviour? O tempora, o mores... Andre' -- It'll take a long time to eat 63.000 peanuts. André Pönitz ......................... [EMAIL PROTECTED]