I think the apparent lack of a way to do it is a basic design error with map and
possibly other containers, that they've misunderstood logical constness.
The issue popped up some time ago when I was answering a question in
[alt.comp.lang.learn.c-c++],
Cheers & TIA.,
- Alf (if you delete an 'e', and type an 'e' again, is it the same 'e', eh?)
--
Due to hosting requirements I need visits to <url: http://alfps.izfree.com/>.
No ads, and there is some C++ stuff! :-) Just going there is good. Linking
to it is even better! Thanks in advance!
> - Alf (if you delete an 'e', and type an 'e' again, is it the same
> 'e', eh?)
No joke, I have had that exact same thought. It is probably a sign that I
am completely insane, but I have even followed the train of thought
further...
If I select/cut/paste an 'e', is it the same 'e'?
If I delete an 'e' and then "undo" the deletion, is it more the same 'e'
than it would have been if I had typed a new 'e'?
I understand every step that happens from the instant when the metal
contacts under my 'e' key touch each other to the dispatch of the
WM_KEYDOWN message to the application. Yet, somehow, I can't convince
myself that when you delete that 'e' and type a new one, it is the same
'e'.
Related question: If I gave you a rock composed of 10^20 atoms, along with
a list of every atom's exact <x,y,z> position in space, then destroyed that
rock completely, and then reassembled it to so that every atom's new
<x,y,z> was the same as it was originally, would it be the same rock?
> I think the apparent lack of a way to do it is a basic design
> error with map and possibly other containers, that they've
> misunderstood logical constness.
You're not alone in thinking this. It will be corrected in the
next version (where map<>::erase takes const_iterator's).
--
James Kanze (GABI Software) email:james...@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
> Alf P. Steinbach wrote:
>
>> - Alf (if you delete an 'e', and type an 'e' again, is it the same
>> 'e', eh?)
>
> No joke, I have had that exact same thought. It is probably a sign
> that I am completely insane, but I have even followed the train of
> thought further...
>
> If I select/cut/paste an 'e', is it the same 'e'?
>
> If I delete an 'e' and then "undo" the deletion, is it more the same
> 'e' than it would have been if I had typed a new 'e'?
>
> I understand every step that happens from the instant when the metal
> contacts under my 'e' key touch each other to the dispatch of the
> WM_KEYDOWN message to the application. Yet, somehow, I can't convince
> myself that when you delete that 'e' and type a new one, it is the
> same 'e'.
>
> Related question: If I gave you a rock composed of 10^20 atoms, along
> with a list of every atom's exact <x,y,z> position in space, then
Encoding exact position would need infinite precision and thus infinite
amount of memory. Besides, all atoms would have undetermined momenta
then, so most probably the rock would explode before you manage to
destroy it ;-)
> destroyed that rock completely, and then reassembled it to so that
> every atom's new <x,y,z> was the same as it was originally, would it
> be the same rock?
What you need is to save and restore the full quantum wave state of the
rock. This is what is studied in quantum teleportation. One could also
argue that the rock only manages to exist in time and space by the means
of a similar mechanism, by constantly remembering and restoring its
quantum state. The question now becomes whether this rock is the same
rock 10 nanoseconds later?
Paavo