octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about Array::index with resizing


From: John W. Eaton
Subject: Re: Question about Array::index with resizing
Date: Thu, 23 May 2013 00:39:35 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11

On 05/22/2013 10:06 PM, Michael Goffioul wrote:
Could anybody enlighten me about the implementation of

Array<T>
Array<T>::index (const Array<idx_vector>& ia,
                  bool resize_ok, const T& rfv) const

I'm trying to use it in the classdef branch, assuming this function
would resize the array is the given index is out of bound. In my case,
"ia" contains only scalars, so the variable "all_scalars" ends up being
true. But then the code does:

           if (all_scalars)
             return Array<T> (dim_vector (1, 1), rfv);

In other words, the code always return an array with a single element
being the resize_fill_value. No resizing or array indexing actually
takes place.

Is it intentional? Unimplemented? Or am I missing something?

I think it was intentional but probably also obsolete.

The index operation is const, so I'm not sure what it means to resize. Obviously, indexing can result in an array that is a different size than the array that is indexed.

I can't see where these functions are actually used with resize_ok = true. If that's actually the case, then I'd be happy to remove these arguments.

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]