Another question on move semantics from the cheap seats...

See my code here: http://dpaste.dzfl.pl/995c5af59dd6
There are indeed three questions, all marked in the code, so the rest of the text here is maybe redundant... but just in case and for summary:

I try to model a inner class of some outer one. Then, as I learned from the docu, there is a implicit pointer to the outer class from the inner one by ".outer" key word. So far so good.
My outer class has an associative array of the inner objects.
Now, I try to apply a move action to the inner objects between two outer objects.

The first (minor) question is:
I have to initialize some dummy inner objects, before I can apply the move action. Is this really necessary? It won't be that problem I think, if it is so, but it would be nicer, if I could just perform the move operation.

The second question is:
Following my code, the inner object I moved does not disappear from the array in the source outer object. Why? I tried it without, with an empty and with a non empty destructor, the result was the same.

And the third, main, question is:
After I moved the inner object to the new outer object, the pointer to the outer object remains in the old state, to the source outer object. This is not what I expected! Well, yes this is some subjective expectation, but shouldn't an implicit pointer update itself to not break the logic of what it points to?

The third question has some more meaning in my case: I would like to compose some immutable classes, which are inner classes. The only mutable value therein should be the pointer to the outer class. I know, I could manage this by some map (+ an array, optionally) construct, and I'm on my way to implement this approach. But then, I noticed the nested class section and the implicit pointers, which are not present in C++, for example, and I wanted to try this solution.
Is there maybe an error somewhere in my code?

Reply via email to