# HG changeset patch # User Petter T. # Date 1686773376 14400 # Node ID ae588860b6fa2c7394c43d22b956def727256263 # Parent 0bce463a9b1a58631e257a378275f966faef75ee new function to get first element or undefined value from octave_value_list * ovl.h (octave_value_list::first_or_nil_ov): New function. diff -r 0bce463a9b1a -r ae588860b6fa libinterp/octave-value/ovl.h --- a/libinterp/octave-value/ovl.h Wed Jun 14 16:07:47 2023 -0400 +++ b/libinterp/octave-value/ovl.h Wed Jun 14 16:09:36 2023 -0400 @@ -172,6 +172,14 @@ void clear () { m_data.clear (); } + octave_value first_or_nil_ov () const + { + if (length ()) + return m_data.front (); + + return octave_value (); + } + private: std::vector m_data;