[omniORB] omni3.0.2: string sequence _var lacks constoperator[]

randy.shoup@tumbleweed.com randy.shoup@tumbleweed.com
Wed, 27 Dec 2000 09:47:09 -0800


I did a little research on my own, and it looks like this is a bug.  

In section 6.19.1 of "Advanced CORBA Programming in C++", it claims that
the _var class of a sequence<T> should contain both of the following
methods:

	T & operator[](CORBA:ULong);
	const T & operator[](CORBA::ULong) const;

randy.shoup@tumbleweed.com wrote:
> 
> We have been using omni2.* for a while, and now we are looking into
> moving to omni3.  I encountered the following problem:
> 
> We have the following in our IDL:
>         typedef sequence<string> StringArray;
> 
> omni2 mapped StringArray in the following way:
>   typedef _CORBA_Unbounded_Sequence<CORBA::String_member > StringArray;
>   typedef _CORBA_Sequence_Var<StringArray, CORBA::String_member >
> StringArray_var;
> 
> StringArray_var ended up with an operator[] const.  And we made use of
> the fact in our code that we could extract elements from a const
> StringArray_var.
> 
> However, omni3 maps these types to new classes:
>   class StringArray : public _CORBA_Unbounded_Sequence__String {
>         ...
>   class StringArray_var {
>         ...
> 
> and does not generate an operator[] const.  The only
> StringArray_var::operator[] is
>     inline _CORBA_String_element operator [] (_CORBA_ULong s) {
>       return (*_pd_seq)[s];
>     }
> 
> which is non-const.
> 
> Because it seems to use the StringArray directly, and *that* class has
> an operator[] const, why does the StringArray_var not have an operator[]
> const?
> 
> Is this a bug, or a CORBA 2.3 mapping change?
> 
> Thanks,
> -- Randy
> _________________________________________________________________
> Randy Shoup                                     (650)216-2038
> Senior Architect                                rshoup@tumbleweed.com
> Tumbleweed Communications Corporation


-- 

-- Randy
_________________________________________________________________  
Randy Shoup                                     (650)216-2038  
Senior Architect                                rshoup@tumbleweed.com  
Tumbleweed Communications Corporation