[omniORB] Sequences/allocbuf/freebuf comment

Yan Pujante yan@corp.socialnet.com
Fri, 16 Feb 2001 08:02:47 -0800


Th"Gary D. Duzan" wrote:
> 
> In Message <3A8C6A61.6A28EFE4@research.att.com> ,
>    "Glenn A. Hochberg" <gah@research.att.com> wrote:
> 
> =>CSeq_var seq = new CSeq(n);    // allocates a sequence with enough room for n
> =>elements
> =>seq->length(n);    // set length
> =>// initialize each member using accessor
> =>for (CORBA::ULong i = 0; i < n; i++) {
> =>    (*seq)[i].foo = a;
> =>    (*seq)[i].bar = b;
> =>    ...
> =>}
> =>return seq._retn();
> 
>    Actually, if I remember correctly, you can use:
> 
>       seq[i].foo = a;
>       seq[i].bar = b;
> 
> when seq is a sequence_var, making it more readable.
> 

Thanks.

In my code, I cannot call the constructor myself, so the default constructor is
called. I didn't know that calling length(n) would simply allocate the space I
needed. And this fixes my problem. I still think that being able to reference
the type of T when having SeqT would be good.

Yan

-- 

http://eowyn.fr.eu.org/~yan/ | yan@corp.socialnet.com