[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Array constructor backward compatibility problem
From: |
John W. Eaton |
Subject: |
Array constructor backward compatibility problem |
Date: |
Wed, 19 Jan 2011 15:04:03 -0500 |
Please see the following problem that was reported on the help list:
https://mailman.cae.wisc.edu/pipermail/help-octave/2011-January/044288.html
We apparently have a problem with backward compatibility regarding the
Array constructors
explicit Array (octave_idx_type m, octave_idx_type n)
explicit Array (octave_idx_type m, octave_idx_type n, const T& val)
Previously, we had
explicit Array (octave_idx_type n)
explicit Array (octave_idx_type n, const T& val)
And we did not have any Array constructors taking two dimension
arguments.
Note that
// Obsolete 1D ctor (there are no 1D arrays).
explicit Array (octave_idx_type n) GCC_ATTR_DEPRECATED
is already deprecated.
To avoid confusion and prevent a lot of frustration over programs that
previously worked an will now crash mysteriously, how about doing the
following:
Reinstate the
explicit Array (octave_idx_type n, const T& val)
constructor but mark it as deprecated.
Delete the new constructors
explicit Array (octave_idx_type m, octave_idx_type n)
explicit Array (octave_idx_type m, octave_idx_type n, const T& val)
Where these might be needed, can't they just be handled by calling
Array (dim_vector (m, n))
Array (dim_vector (m, n), val)
?
There is also
Array (const Array<T>& a, octave_idx_type nr, octave_idx_type nc);
which was not present previously. Anywhere this might be needed it
can be replaced by
Array (a, dim_vector (nr, nc))
so I'm not sure why this special case was needed.
Are there any objections to making this change?
jwe
Array constructor backward compatibility problem, John W. Eaton, 2011/01/19