Mercurial > octave
changeset 31811:8e6a9cf412c1
maint: Deprecate obsolete idx_vector::bool() function.
* NEWS.9.md: Announce deprecation.
* ov-base-mat.h (set_idx_cache): Remove use of idx_vector::bool ().
* ov-range.h (set_idx_cache): Remove use of idx_vector::bool ().
* idx-vector.h (operator bool): Mark function with OCTAVE_DEPRECATED macro.
* Array-util.h (all_ok): Mark function with OCTAVE_DEPRECATED macro.
* Array-util.cc (all_ok): Add FIXME note about deprecation.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 02 Feb 2023 16:48:01 -0800 |
parents | ce32aca67acf |
children | 174a224a85ab |
files | etc/NEWS.9.md libinterp/octave-value/ov-base-mat.h libinterp/octave-value/ov-range.h liboctave/array/Array-util.cc liboctave/array/idx-vector.h |
diffstat | 5 files changed, 16 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/etc/NEWS.9.md Thu Feb 02 12:34:03 2023 -0800 +++ b/etc/NEWS.9.md Thu Feb 02 16:48:01 2023 -0800 @@ -38,6 +38,15 @@ Object | Property | Replacement -----------------|-------------|------------ +- Core + + * The `idx_vector::bool()` function is obsolete and always returns true. +Any uses can simply be removed from existing code with no loss of function. + + * The `all_ok(const Array<octave::idx_vector>&)` function in `Array-util.h` +is obsolete and always returns true. Any uses can simply be removed from +existing code with no loss of function. + The following features were deprecated in Octave 7 and have been removed from Octave 9.
--- a/libinterp/octave-value/ov-base-mat.h Thu Feb 02 12:34:03 2023 -0800 +++ b/libinterp/octave-value/ov-base-mat.h Thu Feb 02 16:48:01 2023 -0800 @@ -210,7 +210,7 @@ octave::idx_vector set_idx_cache (const octave::idx_vector& idx) const { delete m_idx_cache; - m_idx_cache = (idx ? new octave::idx_vector (idx) : nullptr); + m_idx_cache = new octave::idx_vector (idx); return idx; }
--- a/libinterp/octave-value/ov-range.h Thu Feb 02 12:34:03 2023 -0800 +++ b/libinterp/octave-value/ov-range.h Thu Feb 02 16:48:01 2023 -0800 @@ -486,7 +486,7 @@ octave::idx_vector set_idx_cache (const octave::idx_vector& idx) const { delete m_idx_cache; - m_idx_cache = (idx ? new octave::idx_vector (idx) : nullptr); + m_idx_cache = new octave::idx_vector (idx); return idx; }
--- a/liboctave/array/Array-util.cc Thu Feb 02 12:34:03 2023 -0800 +++ b/liboctave/array/Array-util.cc Thu Feb 02 16:48:01 2023 -0800 @@ -298,23 +298,14 @@ return true; } +// FIXME: Deprecated in Octave 9. bool all_ok (const Array<octave::idx_vector>& ra_idx) { - bool retval = true; - - octave_idx_type n = ra_idx.numel (); + octave_unused_parameter (ra_idx); - for (octave_idx_type i = 0; i < n; i++) - { - if (! ra_idx(i)) - { - retval = false; - break; - } - } - - return retval; + // idx_vector objects are always valid once constructed + return true; } bool
--- a/liboctave/array/idx-vector.h Thu Feb 02 12:34:03 2023 -0800 +++ b/liboctave/array/idx-vector.h Thu Feb 02 16:48:01 2023 -0800 @@ -552,6 +552,7 @@ // FIXME: idx_vector objects are either created successfully or an // error is thrown, so this method no longer makes sense. + OCTAVE_DEPRECATED (9, "idx_vector::bool () is obsolete and always returns true") operator bool () const { return true; } bool is_colon () const