X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginsh%2Fginsh_parser.ypp;h=3a8f06211e7b523bf97d30319415acfb4aaf1903;hp=2ef2408d25cd483e5b760f23881e6bc38ca78e92;hb=8f283de519668b70b2e675a7055c7f1bf7ba197c;hpb=2afa71937b3c12cdc70f01213baa8a92be4b604a;ds=sidebyside diff --git a/ginsh/ginsh_parser.ypp b/ginsh/ginsh_parser.ypp index 2ef2408d..3a8f0621 100644 --- a/ginsh/ginsh_parser.ypp +++ b/ginsh/ginsh_parser.ypp @@ -279,7 +279,7 @@ exp : T_NUMBER {$$ = $1;} | '[' matrix ']' {$$ = lst_to_matrix(ex_to($2));} ; -exprseq : exp {$$ = exprseq($1);} +exprseq : exp {$$ = exprseq{$1};} | exprseq ',' exp {exprseq es(ex_to($1)); $$ = es.append($3);} ; @@ -287,15 +287,15 @@ list_or_empty: /* empty */ {$$ = *new lst;} | list {$$ = $1;} ; -list : exp {$$ = lst($1);} +list : exp {$$ = lst{$1};} | list ',' exp {lst l(ex_to($1)); $$ = l.append($3);} ; -matrix : '[' row ']' {$$ = lst($2);} +matrix : '[' row ']' {$$ = lst{$2};} | matrix ',' '[' row ']' {lst l(ex_to($1)); $$ = l.append($4);} ; -row : exp {$$ = lst($1);} +row : exp {$$ = lst{$1};} | row ',' exp {lst l(ex_to($1)); $$ = l.append($3);} ; @@ -431,8 +431,8 @@ static ex f_find(const exprseq &e) exset found; e[0].find(e[1], found); lst l; - for (exset::const_iterator i = found.begin(); i != found.end(); ++i) - l.append(*i); + for (auto & i : found) + l.append(i); return l; } @@ -472,7 +472,7 @@ class apply_map_function : public map_function { public: apply_map_function(const ex & a) : apply(a) {} virtual ~apply_map_function() {} - ex operator()(const ex & e) { return apply.subs(wild() == e, true); } + ex operator()(const ex & e) override { return apply.subs(wild() == e, true); } }; static ex f_map(const exprseq &e) @@ -486,8 +486,8 @@ static ex f_match(const exprseq &e) exmap repls; if (e[0].match(e[1], repls)) { lst repl_lst; - for (exmap::const_iterator i = repls.begin(); i != repls.end(); ++i) - repl_lst.append(relational(i->first, i->second, relational::equal)); + for (auto & i : repls) + repl_lst.append(relational(i.first, i.second, relational::equal)); return repl_lst; } throw std::runtime_error("FAIL"); @@ -736,12 +736,9 @@ static ex f_ginac_function(const exprseq &es, int serial) namespace GiNaC { static void ginsh_get_ginac_functions(void) { - vector gfv = function::get_registered_functions(); - vector::const_iterator i = gfv.begin(), end = gfv.end(); unsigned serial = 0; - while (i != end) { - fcns.insert(make_pair(i->get_name(), fcn_desc(f_ginac_function, i->get_nparams(), serial))); - ++i; + for (auto & i : function::get_registered_functions()) { + fcns.insert(make_pair(i.get_name(), fcn_desc(f_ginac_function, i.get_nparams(), serial))); serial++; } }