[omniORB] &operator[] problem

Attila Pletyak attila.pletyak@anemo.com
Mon, 23 Jul 2001 09:40:49 +0200


Why don't you try a CORBA::release( arref[1] ); before the new value is 
assigned to it?

Sincerely,

Attila Pletyak
Anemo Ltd.

Makay Geza wrote:

>Hi,
>
>I am new to Corba, this might be a dumb question, but I simply cannot
>resolve it.
>
>I have a problem using an array of objects. I use operator[] for indexing
>which is fine for using it in a one-machine non-Corba environment. I have
>the operator[] return a reference to my class, since I want to use the
>returned value on the left hand side of an assignment. On the other hand,
>if I have the array object on the server side referenced from the client
>side, and would like to use one element of the array on the client side on
>the left hand side of an assignment, then operator[] must return a
>reference. On the other hand, if it is a reference, then it will not be
>released (deleted) after using it. Say the following code:
>
>...
>Array_var arref = Array::_narrow(obj);
>arref[1] = (some new array element value);
>...
>
>Then arref[1] must be of type Array_var& in this setup, which is not on
>the client side before using operator[], but after that it will not be
>freed, since it is only a reference.
>
>Sorry if this is a trivial question, but again: I am new to Corba. Could
>someone point me in the right direction? Say: an example using this setup?
>
>Thanks in advance.
>
>Geza
>
>
>