Mercurial > octave
changeset 32936:0b5f3219b650
eliminate all uses of base_list<T> template
The base_list<T> template is mostly a wrapper around std::list<T> with
an append method that is an alias for push_back. So instead of using
this custom class, use std::list<T> directly.
Replace all uses of "base-list.h" with <list>. Change all uses of
base_list<T> to std::list<T>. Rename uses of append to push_back.
Rename uses of length to size.
* base-list.h: Including this file now warns that its use is
discouraged and recommends using <list> instead.
* comment-list.h, comment-list.cc (comment_list::dup): Simplify.
* pt-classdef.h, pt-classdef.cc (tree_classdef_body::append):
Return pointer to this.
* oct-parse.yy (base_parser::append_classdef_properties_block,
base_parser::append_classdef_methods_block,
base_parser::append_classdef_events_block,
base_parser::append_classdef_enum_block): Append to body instead of
calling append_list.
line wrap: on
line diff
--- a/libinterp/corefcn/call-stack.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/corefcn/call-stack.cc Tue Feb 06 00:28:21 2024 -0500 @@ -1142,7 +1142,7 @@ symbol_info syminf (nm, value, is_formal, is_global, is_persistent); - symbol_stats.append (syminf); + symbol_stats.push_back (syminf); } else symbol_names.push_back (nm);
--- a/libinterp/corefcn/regexp.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/corefcn/regexp.cc Tue Feb 06 00:28:21 2024 -0500 @@ -30,7 +30,6 @@ #include <list> #include <sstream> -#include "base-list.h" #include "oct-locbuf.h" #include "quit.h" #include "lo-regexp.h"
--- a/libinterp/corefcn/stack-frame.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/corefcn/stack-frame.cc Tue Feb 06 00:28:21 2024 -0500 @@ -1155,7 +1155,7 @@ symbol_info syminf (sym.name (), value, sym.is_formal (), is_global (sym), is_persistent (sym)); - symbol_stats.append (syminf); + symbol_stats.push_back (syminf); } return symbol_stats;
--- a/libinterp/corefcn/syminfo.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/corefcn/syminfo.cc Tue Feb 06 00:28:21 2024 -0500 @@ -169,7 +169,7 @@ octave_value symbol_info_list::varval (const std::string& name) const { - for (const auto& syminfo : m_lst) + for (const auto& syminfo : *this) { if (name == syminfo.name ()) return syminfo.value (); @@ -183,7 +183,7 @@ { std::list<std::string> retval; - for (const auto& syminfo : m_lst) + for (const auto& syminfo : *this) retval.push_back (syminfo.name ()); return retval; @@ -193,7 +193,7 @@ symbol_info_list::map_value (const std::string& caller_function_name, int nesting_level) const { - std::size_t len = m_lst.size (); + std::size_t len = size (); Cell name_info (len, 1); Cell size_info (len, 1); @@ -207,7 +207,7 @@ std::size_t j = 0; - for (const auto& syminfo : m_lst) + for (const auto& syminfo : *this) { octave_scalar_map ni; @@ -334,7 +334,7 @@ symbol_info_list::display (std::ostream& os, const std::string& format) const { - if (! m_lst.empty ()) + if (! empty ()) { std::size_t bytes = 0; std::size_t elements = 0; @@ -345,7 +345,7 @@ octave_stdout << "\n"; - for (const auto& syminfo : m_lst) + for (const auto& syminfo : *this) { syminfo.display_line (os, params); @@ -403,7 +403,7 @@ // Calculating necessary spacing for name column, // bytes column, elements column and class column - for (const auto& syminfo : m_lst) + for (const auto& syminfo : *this) { std::stringstream ss1, ss2; std::string str; @@ -511,7 +511,7 @@ int first = param.first_parameter_length; int total = param.parameter_length; - for (const auto& syminfo : m_lst) + for (const auto& syminfo : *this) { octave_value val = syminfo.value (); std::string dims_str = val.get_dims_str ();
--- a/libinterp/corefcn/syminfo.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/corefcn/syminfo.h Tue Feb 06 00:28:21 2024 -0500 @@ -28,10 +28,9 @@ #include "octave-config.h" +#include <iosfwd> +#include <list> #include <string> -#include <iosfwd> - -#include "base-list.h" #include "ov.h" @@ -88,7 +87,7 @@ bool m_is_persistent; }; -class OCTINTERP_API symbol_info_list : public base_list<symbol_info> +class OCTINTERP_API symbol_info_list : public std::list<symbol_info> { public:
--- a/libinterp/corefcn/text-engine.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/corefcn/text-engine.h Tue Feb 06 00:28:21 2024 -0500 @@ -28,10 +28,10 @@ #include "octave-config.h" +#include <list> #include <memory> #include <string> -#include "base-list.h" #include "caseless-str.h" #include "dMatrix.h" @@ -104,14 +104,14 @@ }; class OCTINTERP_API text_element_list - : public text_element, public base_list<text_element *> + : public text_element, public std::list<text_element *> { public: OCTAVE_DEFAULT_CONSTRUCT_COPY_MOVE (text_element_list) text_element_list (text_element *e) - : text_element (), base_list<text_element*> () + : text_element (), std::list<text_element*> () { push_back (e); }
--- a/libinterp/octave-value/ov-classdef.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/octave-value/ov-classdef.cc Tue Feb 06 00:28:21 2024 -0500 @@ -656,7 +656,7 @@ { octave::tree_parameter_list *ret_list = uf->return_list (); - if (ret_list && ret_list->length () == 1) + if (ret_list && ret_list->size () == 1) return (ret_list->front ()->name () == nm); } }
--- a/libinterp/octave-value/ov-fcn-handle.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/octave-value/ov-fcn-handle.cc Tue Feb 06 00:28:21 2024 -0500 @@ -2693,7 +2693,7 @@ tree_statement_list *b = f->body (); - panic_if (b->length () != 1); + panic_if (b->size () != 1); tree_statement *s = b->front ();
--- a/libinterp/octave-value/ov-oncleanup.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/octave-value/ov-oncleanup.cc Tue Feb 06 00:28:21 2024 -0500 @@ -54,7 +54,7 @@ { octave::tree_parameter_list *pl = uptr->parameter_list (); - if (pl != nullptr && pl->length () > 0) + if (pl != nullptr && pl->size () > 0) warning ("onCleanup: cleanup action takes parameters"); } }
--- a/libinterp/octave-value/ov-usr-fcn.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/octave-value/ov-usr-fcn.cc Tue Feb 06 00:28:21 2024 -0500 @@ -218,7 +218,7 @@ m_lead_comm (), m_trail_comm (), m_location_line (0), m_location_column (0), m_system_fcn_file (false), - m_num_named_args (m_param_list ? m_param_list->length () : 0), + m_num_named_args (m_param_list ? m_param_list->size () : 0), m_subfunction (false), m_inline_function (false), m_anonymous_function (false), m_nested_function (false), m_class_constructor (none), m_class_method (none) @@ -504,7 +504,7 @@ octave_user_function::special_expr () { panic_unless (is_special_expr ()); - panic_if (m_cmd_list->length () != 1); + panic_if (m_cmd_list->size () != 1); octave::tree_statement *stmt = m_cmd_list->front (); return stmt->expression (); @@ -516,8 +516,8 @@ bool retval = false; if (Voptimize_subsasgn_calls && m_param_list && m_ret_list - && m_param_list->length () > 0 && ! m_param_list->varargs_only () - && m_ret_list->length () == 1 && ! m_ret_list->takes_varargs ()) + && m_param_list->size () > 0 && ! m_param_list->varargs_only () + && m_ret_list->size () == 1 && ! m_ret_list->takes_varargs ()) { octave::tree_identifier *par1 = m_param_list->front ()->ident (); octave::tree_identifier *ret1 = m_ret_list->front ()->ident (); @@ -721,7 +721,7 @@ tree_parameter_list *m_param_list = ufcn->parameter_list (); - retval = (m_param_list ? m_param_list->length () : 0); + retval = (m_param_list ? m_param_list->size () : 0); if (ufcn->takes_varargs ()) retval = -1 - retval; } @@ -843,7 +843,7 @@ tree_parameter_list *m_ret_list = ufcn->return_list (); - retval = (m_ret_list ? m_ret_list->length () : 0); + retval = (m_ret_list ? m_ret_list->size () : 0); if (ufcn->takes_var_return ()) retval = -1 - retval;
--- a/libinterp/parse-tree/bp-table.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/bp-table.cc Tue Feb 06 00:28:21 2024 -0500 @@ -305,7 +305,7 @@ "condition is not empty, but has nothing to evaluate"); else { - if (stmt_list->length () == 1 + if (stmt_list->size () == 1 && (stmt = stmt_list->front ()) && stmt->is_expression ()) {
--- a/libinterp/parse-tree/comment-list.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/comment-list.cc Tue Feb 06 00:28:21 2024 -0500 @@ -37,12 +37,7 @@ comment_list * comment_list::dup () const { - comment_list *new_cl = new comment_list (); - - for (const auto& elt : *this) - new_cl->append (elt); - - return new_cl; + return new comment_list (*this); } OCTAVE_END_NAMESPACE(octave)
--- a/libinterp/parse-tree/comment-list.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/comment-list.h Tue Feb 06 00:28:21 2024 -0500 @@ -28,10 +28,9 @@ #include "octave-config.h" +#include <list> #include <string> -#include "base-list.h" - OCTAVE_BEGIN_NAMESPACE(octave) extern std::string get_comment_text (); @@ -106,19 +105,23 @@ bool m_uses_hash_char; }; -class comment_list : public base_list<comment_elt> +class comment_list : public std::list<comment_elt> { public: OCTAVE_DEFAULT_CONSTRUCT_COPY_MOVE_DELETE (comment_list) void append (const comment_elt& elt) - { base_list<comment_elt>::append (elt); } + { + push_back (elt); + } void append (const std::string& s, comment_elt::comment_type t = comment_elt::unknown, bool uses_hash_char = false) - { append (comment_elt (s, t, uses_hash_char)); } + { + push_back (comment_elt (s, t, uses_hash_char)); + } comment_list * dup () const;
--- a/libinterp/parse-tree/oct-parse.yy Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/oct-parse.yy Tue Feb 06 00:28:21 2024 -0500 @@ -2528,7 +2528,7 @@ static LIST_T * list_append (LIST_T *list, ELT_T elt) { - list->append (elt); + list->push_back (elt); return list; } @@ -3453,7 +3453,7 @@ int l = for_tok->line (); int c = for_tok->column (); - if (lhs->length () == 1) + if (lhs->size () == 1) { tree_expression *tmp = lhs->remove_front (); @@ -3882,7 +3882,7 @@ if (! cmds) cmds = new tree_statement_list (); - cmds->append (end_script); + cmds->push_back (end_script); symbol_scope script_scope = m_lexer.m_symtab_context.curr_scope (); @@ -4036,7 +4036,7 @@ if (! body) body = new tree_statement_list (); - body->append (end_fcn_stmt); + body->push_back (end_fcn_stmt); octave_user_function *fcn = new octave_user_function (m_lexer.m_symtab_context.curr_scope (), @@ -4784,28 +4784,28 @@ base_parser::append_classdef_properties_block (tree_classdef_body *body, tree_classdef_properties_block *block) { - return list_append (body, block); + return body->append (block); } tree_classdef_body * base_parser::append_classdef_methods_block (tree_classdef_body *body, tree_classdef_methods_block *block) { - return list_append (body, block); + return body->append (block); } tree_classdef_body * base_parser::append_classdef_events_block (tree_classdef_body *body, tree_classdef_events_block *block) { - return list_append (body, block); + return body->append (block); } tree_classdef_body * base_parser::append_classdef_enum_block (tree_classdef_body *body, tree_classdef_enum_block *block) { - return list_append (body, block); + return body->append (block); } octave_user_function* @@ -4997,10 +4997,9 @@ if (expr->is_index_expression ()) { - tree_index_expression *tmp - = dynamic_cast<tree_index_expression *> (expr); - - retval = tmp->append (args, type); + retval = dynamic_cast<tree_index_expression *> (expr); + + retval->append (args, type); } else retval = new tree_index_expression (expr, args, l, c, type); @@ -5025,10 +5024,9 @@ if (expr->is_index_expression ()) { - tree_index_expression *tmp - = dynamic_cast<tree_index_expression *> (expr); - - retval = tmp->append (elt); + retval = dynamic_cast<tree_index_expression *> (expr); + + retval->append (elt); } else retval = new tree_index_expression (expr, elt, l, c); @@ -5054,10 +5052,9 @@ if (expr->is_index_expression ()) { - tree_index_expression *tmp - = dynamic_cast<tree_index_expression *> (expr); - - retval = list_append (tmp, elt); + retval = dynamic_cast<tree_index_expression *> (expr); + + retval->append (elt); } else retval = new tree_index_expression (expr, elt, l, c); @@ -5176,7 +5173,7 @@ std::string va_type = (type == tree_parameter_list::in ? "varargin" : "varargout"); - std::size_t len = lst->length (); + std::size_t len = lst->size (); if (len > 0) {
--- a/libinterp/parse-tree/pt-arg-list.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-arg-list.cc Tue Feb 06 00:28:21 2024 -0500 @@ -54,9 +54,9 @@ } void -tree_argument_list::append (const element_type& s) +tree_argument_list::push_back (const element_type& s) { - base_list<tree_expression *>::append (s); + std::list<tree_expression *>::push_back (s); if (! m_list_includes_magic_tilde && s && s->is_identifier ()) { @@ -100,7 +100,7 @@ string_vector tree_argument_list::get_arg_names () const { - int len = length (); + int len = size (); string_vector retval (len); @@ -145,7 +145,7 @@ new_list->m_simple_assign_lhs = m_simple_assign_lhs; for (const tree_expression *elt : *this) - new_list->append (elt ? elt->dup (scope) : nullptr); + new_list->push_back (elt ? elt->dup (scope) : nullptr); return new_list; }
--- a/libinterp/parse-tree/pt-arg-list.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-arg-list.h Tue Feb 06 00:28:21 2024 -0500 @@ -35,7 +35,6 @@ #include "str-vec.h" -#include "base-list.h" #include "pt-walk.h" OCTAVE_BEGIN_NAMESPACE(octave) @@ -47,7 +46,7 @@ // Argument lists. Used to hold the list of expressions that are the // arguments in a function call or index expression. -class tree_argument_list : public base_list<tree_expression *> +class tree_argument_list : public std::list<tree_expression *> { public: @@ -59,7 +58,7 @@ tree_argument_list (tree_expression *t) : m_list_includes_magic_tilde (false), m_simple_assign_lhs (false) - { append (t); } + { push_back (t); } OCTAVE_DISABLE_COPY_MOVE (tree_argument_list) @@ -83,7 +82,7 @@ return retval; } - void append (const element_type& s); + void push_back (const element_type& s); void mark_as_simple_assign_lhs () { m_simple_assign_lhs = true; }
--- a/libinterp/parse-tree/pt-args-block.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-args-block.h Tue Feb 06 00:28:21 2024 -0500 @@ -28,14 +28,14 @@ #include "octave-config.h" +#include <list> + #include "pt-arg-list.h" #include "pt-cmd.h" #include "pt-exp.h" #include "pt-id.h" #include "pt-walk.h" -#include "base-list.h" - // FIXME: We could maybe re-think the naming of some of these objects // before releasing a version that contains these new classes... @@ -153,16 +153,16 @@ }; class tree_args_block_validation_list - : public base_list<tree_arg_validation *> + : public std::list<tree_arg_validation *> { public: tree_args_block_validation_list () { } - tree_args_block_validation_list (tree_arg_validation *a) { append (a); } + tree_args_block_validation_list (tree_arg_validation *a) { push_back (a); } - tree_args_block_validation_list (const base_list<tree_arg_validation *>& a) - : base_list<tree_arg_validation *> (a) + tree_args_block_validation_list (const std::list<tree_arg_validation *>& a) + : std::list<tree_arg_validation *> (a) { } OCTAVE_DISABLE_COPY_MOVE (tree_args_block_validation_list)
--- a/libinterp/parse-tree/pt-array-list.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-array-list.cc Tue Feb 06 00:28:21 2024 -0500 @@ -69,7 +69,7 @@ symbol_scope& scope) { for (const tree_argument_list *elt : array_list) - append (elt ? elt->dup (scope) : nullptr); + push_back (elt ? elt->dup (scope) : nullptr); copy_base (*this); }
--- a/libinterp/parse-tree/pt-array-list.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-array-list.h Tue Feb 06 00:28:21 2024 -0500 @@ -28,7 +28,8 @@ #include "octave-config.h" -#include "base-list.h" +#include <list> + #include "pt-arg-list.h" #include "pt-exp.h" @@ -40,20 +41,20 @@ // Base class for cell arrays and matrices. class tree_array_list : public tree_expression, - public base_list<tree_argument_list *> + public std::list<tree_argument_list *> { public: - typedef base_list<tree_argument_list *>::iterator iterator; - typedef base_list<tree_argument_list *>::const_iterator const_iterator; + typedef std::list<tree_argument_list *>::iterator iterator; + typedef std::list<tree_argument_list *>::const_iterator const_iterator; protected: tree_array_list (tree_argument_list *row = nullptr, int l = -1, int c = -1) - : tree_expression (l, c), base_list<tree_argument_list *> () + : tree_expression (l, c), std::list<tree_argument_list *> () { if (row) - append (row); + push_back (row); } public:
--- a/libinterp/parse-tree/pt-cell.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-cell.cc Tue Feb 06 00:28:21 2024 -0500 @@ -57,7 +57,7 @@ }, tw.lvalue_list ()); tw.set_lvalue_list (nullptr); - octave_idx_type nr = length (); + octave_idx_type nr = size (); octave_idx_type nc = -1; Cell val;
--- a/libinterp/parse-tree/pt-check.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-check.cc Tue Feb 06 00:28:21 2024 -0500 @@ -85,7 +85,7 @@ if (lhs) { - int len = lhs->length (); + int len = lhs->size (); if (len == 0 || len > 2) errmsg ("invalid number of output arguments in for command",
--- a/libinterp/parse-tree/pt-classdef.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-classdef.h Tue Feb 06 00:28:21 2024 -0500 @@ -36,8 +36,6 @@ #include "pt-walk.h" #include "pt-id.h" -#include "base-list.h" - #include <list> OCTAVE_BEGIN_NAMESPACE(octave) @@ -165,16 +163,16 @@ bool m_neg; }; -class tree_classdef_attribute_list : public base_list<tree_classdef_attribute *> +class tree_classdef_attribute_list : public std::list<tree_classdef_attribute *> { public: tree_classdef_attribute_list () { } - tree_classdef_attribute_list (tree_classdef_attribute *a) { append (a); } + tree_classdef_attribute_list (tree_classdef_attribute *a) { push_back (a); } - tree_classdef_attribute_list (const base_list<tree_classdef_attribute *>& a) - : base_list<tree_classdef_attribute *> (a) + tree_classdef_attribute_list (const std::list<tree_classdef_attribute *>& a) + : std::list<tree_classdef_attribute *> (a) { } OCTAVE_DISABLE_COPY_MOVE (tree_classdef_attribute_list) @@ -212,7 +210,7 @@ }; class tree_classdef_superclass_list - : public base_list<tree_classdef_superclass *> + : public std::list<tree_classdef_superclass *> { public: @@ -220,11 +218,11 @@ tree_classdef_superclass_list (tree_classdef_superclass *sc) { - append (sc); + push_back (sc); } - tree_classdef_superclass_list (const base_list<tree_classdef_superclass *>& a) - : base_list<tree_classdef_superclass *> (a) + tree_classdef_superclass_list (const std::list<tree_classdef_superclass *>& a) + : std::list<tree_classdef_superclass *> (a) { } OCTAVE_DISABLE_COPY_MOVE (tree_classdef_superclass_list) @@ -319,16 +317,16 @@ std::string m_doc_string; }; -class tree_classdef_property_list : public base_list<tree_classdef_property *> +class tree_classdef_property_list : public std::list<tree_classdef_property *> { public: tree_classdef_property_list () { } - tree_classdef_property_list (tree_classdef_property *p) { append (p); } + tree_classdef_property_list (tree_classdef_property *p) { push_back (p); } - tree_classdef_property_list (const base_list<tree_classdef_property *>& a) - : base_list<tree_classdef_property *> (a) { } + tree_classdef_property_list (const std::list<tree_classdef_property *>& a) + : std::list<tree_classdef_property *> (a) { } OCTAVE_DISABLE_COPY_MOVE (tree_classdef_property_list) @@ -362,16 +360,16 @@ } }; -class tree_classdef_methods_list : public base_list<octave_value> +class tree_classdef_methods_list : public std::list<octave_value> { public: tree_classdef_methods_list () { } - tree_classdef_methods_list (const octave_value& f) { append (f); } + tree_classdef_methods_list (const octave_value& f) { push_back (f); } - tree_classdef_methods_list (const base_list<octave_value>& a) - : base_list<octave_value> (a) { } + tree_classdef_methods_list (const std::list<octave_value>& a) + : std::list<octave_value> (a) { } OCTAVE_DISABLE_COPY_MOVE (tree_classdef_methods_list) @@ -442,16 +440,16 @@ std::string m_doc_string; }; -class tree_classdef_events_list : public base_list<tree_classdef_event *> +class tree_classdef_events_list : public std::list<tree_classdef_event *> { public: tree_classdef_events_list () { } - tree_classdef_events_list (tree_classdef_event *e) { append (e); } + tree_classdef_events_list (tree_classdef_event *e) { push_back (e); } - tree_classdef_events_list (const base_list<tree_classdef_event *>& a) - : base_list<tree_classdef_event *> (a) + tree_classdef_events_list (const std::list<tree_classdef_event *>& a) + : std::list<tree_classdef_event *> (a) { } OCTAVE_DISABLE_COPY_MOVE (tree_classdef_events_list) @@ -527,16 +525,16 @@ std::string m_doc_string; }; -class tree_classdef_enum_list : public base_list<tree_classdef_enum *> +class tree_classdef_enum_list : public std::list<tree_classdef_enum *> { public: tree_classdef_enum_list () { } - tree_classdef_enum_list (tree_classdef_enum *e) { append (e); } + tree_classdef_enum_list (tree_classdef_enum *e) { push_back (e); } - tree_classdef_enum_list (const base_list<tree_classdef_enum *>& a) - : base_list<tree_classdef_enum *> (a) + tree_classdef_enum_list (const std::list<tree_classdef_enum *>& a) + : std::list<tree_classdef_enum *> (a) { } OCTAVE_DISABLE_COPY_MOVE (tree_classdef_enum_list) @@ -607,24 +605,28 @@ ~tree_classdef_body (); - void append (tree_classdef_properties_block *pb) + tree_classdef_body * append (tree_classdef_properties_block *pb) { m_properties_lst.push_back (pb); + return this; } - void append (tree_classdef_methods_block *mb) + tree_classdef_body * append (tree_classdef_methods_block *mb) { m_methods_lst.push_back (mb); + return this; } - void append (tree_classdef_events_block *evb) + tree_classdef_body * append (tree_classdef_events_block *evb) { m_events_lst.push_back (evb); + return this; } - void append (tree_classdef_enum_block *enb) + tree_classdef_body * append (tree_classdef_enum_block *enb) { m_enum_lst.push_back (enb); + return this; } std::list<tree_classdef_properties_block *> properties_list ()
--- a/libinterp/parse-tree/pt-decl.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-decl.h Tue Feb 06 00:28:21 2024 -0500 @@ -31,7 +31,6 @@ #include <list> #include <string> -#include "base-list.h" #include "oct-lvalue.h" #include "pt-cmd.h" #include "pt-id.h" @@ -105,13 +104,13 @@ tree_expression *m_expr; }; -class tree_decl_init_list : public base_list<tree_decl_elt *> +class tree_decl_init_list : public std::list<tree_decl_elt *> { public: tree_decl_init_list () { } - tree_decl_init_list (tree_decl_elt *t) { append (t); } + tree_decl_init_list (tree_decl_elt *t) { push_back (t); } OCTAVE_DISABLE_COPY_MOVE (tree_decl_init_list)
--- a/libinterp/parse-tree/pt-eval.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-eval.cc Tue Feb 06 00:28:21 2024 -0500 @@ -1050,7 +1050,7 @@ { tree_statement *stmt = nullptr; - if (stmt_list->length () == 1 + if (stmt_list->size () == 1 && (stmt = stmt_list->front ()) && stmt->is_expression ()) { @@ -2369,7 +2369,7 @@ (tree_parameter_list *ret_list, int nargout, const Cell& varargout) { octave_idx_type vlen = varargout.numel (); - int len = ret_list->length (); + int len = ret_list->size (); // Special case. Will do a shallow copy. if (len == 0) @@ -3626,7 +3626,7 @@ if (param_list) { takes_varargs = param_list->takes_varargs (); - max_inputs = param_list->length (); + max_inputs = param_list->size (); } if (! takes_varargs && nargin > max_inputs) @@ -3647,7 +3647,7 @@ if (ret_list && ! ret_list->takes_varargs ()) { - int max_outputs = ret_list->length (); + int max_outputs = ret_list->size (); if (nargout > max_outputs) { @@ -3702,7 +3702,7 @@ if (user_function.is_special_expr ()) { - panic_if (cmd_list->length () != 1); + panic_if (cmd_list->size () != 1); tree_statement *stmt = cmd_list->front (); @@ -4795,7 +4795,7 @@ unwind_protect_var<const std::list<octave_lvalue> *> upv (m_lvalue_list, nullptr); - int len = args->length (); + int len = args->size (); unwind_protect_var<int> upv2 (m_index_position); unwind_protect_var<int> upv3 (m_num_indices);
--- a/libinterp/parse-tree/pt-idx.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-idx.cc Tue Feb 06 00:28:21 2024 -0500 @@ -368,7 +368,7 @@ if (is_var && is_word_list_cmd ()) { bool maybe_binary_op = false; - if ((*p_args) && (*p_args)->length () > 0) + if ((*p_args) && (*p_args)->size () > 0) { // check if first character of first argument might be (the // start of) a binary operator @@ -393,7 +393,7 @@ tree_argument_list *al = *p_args; - if (al && al->length () > 0) + if (al && al->size () > 0) { unwind_action act ([&tw] (const std::list<octave_lvalue> *lvl) {
--- a/libinterp/parse-tree/pt-mat.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-mat.h Tue Feb 06 00:28:21 2024 -0500 @@ -33,7 +33,6 @@ class octave_value; class octave_value_list; -#include "base-list.h" #include "pt-array-list.h" #include "pt-exp.h" #include "pt-walk.h"
--- a/libinterp/parse-tree/pt-misc.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-misc.cc Tue Feb 06 00:28:21 2024 -0500 @@ -73,7 +73,7 @@ new_list->m_marked_for_varargs = m_marked_for_varargs; for (const tree_decl_elt *elt : *this) - new_list->append (elt->dup (scope)); + new_list->push_back (elt->dup (scope)); return new_list; }
--- a/libinterp/parse-tree/pt-misc.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-misc.h Tue Feb 06 00:28:21 2024 -0500 @@ -28,7 +28,8 @@ #include "octave-config.h" -#include "base-list.h" +#include <list> + #include "pt-decl.h" #include "pt-walk.h" @@ -42,7 +43,7 @@ // parameters in a function definition. Elements are identifiers // only. -class tree_parameter_list : public base_list<tree_decl_elt *> +class tree_parameter_list : public std::list<tree_decl_elt *> { public: @@ -59,13 +60,13 @@ tree_parameter_list (in_or_out io, tree_decl_elt *t) : m_in_or_out (io), m_marked_for_varargs (0) { - append (t); + push_back (t); } tree_parameter_list (in_or_out io, tree_identifier *id) : m_in_or_out (io), m_marked_for_varargs (0) { - append (new tree_decl_elt (id)); + push_back (new tree_decl_elt (id)); } OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (tree_parameter_list)
--- a/libinterp/parse-tree/pt-pr-code.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-pr-code.cc Tue Feb 06 00:28:21 2024 -0500 @@ -707,7 +707,7 @@ if (lhs) { - int len = lhs->length (); + int len = lhs->size (); if (len > 1) { @@ -781,7 +781,7 @@ } else { - int len = lst.length (); + int len = lst.size (); if (lst.takes_varargs ()) len++; @@ -817,7 +817,7 @@ } else { - int len = lst.length (); + int len = lst.size (); if (lst.takes_varargs ()) len++;
--- a/libinterp/parse-tree/pt-select.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-select.h Tue Feb 06 00:28:21 2024 -0500 @@ -28,7 +28,8 @@ #include "octave-config.h" -#include "base-list.h" +#include <list> + #include "comment-list.h" #include "pt-cmd.h" #include "pt-walk.h" @@ -86,13 +87,13 @@ comment_list *m_lead_comm; }; -class tree_if_command_list : public base_list<tree_if_clause *> +class tree_if_command_list : public std::list<tree_if_clause *> { public: tree_if_command_list () { } - tree_if_command_list (tree_if_clause *t) { append (t); } + tree_if_command_list (tree_if_clause *t) { push_back (t); } OCTAVE_DISABLE_COPY_MOVE (tree_if_command_list) @@ -201,13 +202,13 @@ comment_list *m_lead_comm; }; -class tree_switch_case_list : public base_list<tree_switch_case *> +class tree_switch_case_list : public std::list<tree_switch_case *> { public: tree_switch_case_list () { } - tree_switch_case_list (tree_switch_case *t) { append (t); } + tree_switch_case_list (tree_switch_case *t) { push_back (t); } OCTAVE_DISABLE_COPY_MOVE (tree_switch_case_list)
--- a/libinterp/parse-tree/pt-spmd.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-spmd.h Tue Feb 06 00:28:21 2024 -0500 @@ -28,7 +28,6 @@ #include "octave-config.h" -#include "base-list.h" #include "pt-cmd.h" #include "pt-walk.h"
--- a/libinterp/parse-tree/pt-stmt.h Mon Feb 05 14:22:55 2024 -0800 +++ b/libinterp/parse-tree/pt-stmt.h Tue Feb 06 00:28:21 2024 -0500 @@ -31,8 +31,8 @@ class octave_value_list; #include <deque> +#include <list> -#include "base-list.h" #include "bp-table.h" #include "pt.h" #include "pt-walk.h" @@ -136,7 +136,7 @@ // A list of statements to evaluate. -class tree_statement_list : public base_list<tree_statement *> +class tree_statement_list : public std::list<tree_statement *> { public: @@ -146,7 +146,7 @@ tree_statement_list (tree_statement *s) : m_function_body (false), m_anon_function_body (false), - m_script_body (false) { append (s); } + m_script_body (false) { push_back (s); } OCTAVE_DISABLE_COPY_MOVE (tree_statement_list)
--- a/liboctave/system/child-list.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/liboctave/system/child-list.cc Tue Feb 06 00:28:21 2024 -0500 @@ -40,7 +40,7 @@ void child_list::child_list::insert (pid_t pid, child::child_event_handler f) { - m_list.append (child (pid, f)); + m_list.push_back (child (pid, f)); } void
--- a/liboctave/system/child-list.h Mon Feb 05 14:22:55 2024 -0800 +++ b/liboctave/system/child-list.h Tue Feb 06 00:28:21 2024 -0500 @@ -30,9 +30,9 @@ #include <csignal> -#include <sys/types.h> +#include <list> -#include "base-list.h" +#include <sys/types.h> OCTAVE_BEGIN_NAMESPACE(octave) @@ -88,7 +88,7 @@ private: - base_list<child> m_list; + std::list<child> m_list; }; OCTAVE_END_NAMESPACE(octave)
--- a/liboctave/util/base-list.h Mon Feb 05 14:22:55 2024 -0800 +++ b/liboctave/util/base-list.h Tue Feb 06 00:28:21 2024 -0500 @@ -28,6 +28,8 @@ #include "octave-config.h" +#warning "using <base-list.h> is discouraged - use <list> instead" + #include <cstdlib> #include <list>
--- a/liboctave/util/lo-regexp.cc Mon Feb 05 14:22:55 2024 -0800 +++ b/liboctave/util/lo-regexp.cc Tue Feb 06 00:28:21 2024 -0500 @@ -48,7 +48,6 @@ #endif #include "Matrix.h" -#include "base-list.h" #include "lo-error.h" #include "oct-locbuf.h" #include "quit.h"
--- a/liboctave/util/lo-regexp.h Mon Feb 05 14:22:55 2024 -0800 +++ b/liboctave/util/lo-regexp.h Tue Feb 06 00:28:21 2024 -0500 @@ -34,7 +34,6 @@ #include "Array.h" #include "Matrix.h" -#include "base-list.h" #include "str-vec.h" OCTAVE_BEGIN_NAMESPACE(octave) @@ -194,16 +193,16 @@ double m_end; }; - class match_data : public base_list<match_element> + class match_data : public std::list<match_element> { public: match_data () - : base_list<match_element> (), m_named_pats () + : std::list<match_element> (), m_named_pats () { } match_data (const std::list<match_element>& l, const string_vector& np) - : base_list<match_element> (l), m_named_pats (np) + : std::list<match_element> (l), m_named_pats (np) { } OCTAVE_DEFAULT_COPY_MOVE_DELETE (match_data)