X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Ffunction.cppy;h=789ca056c2dfa9dcebd7e0d86801b7a59e518ee9;hp=fb1d879192a4b0e1a42712f4776d5a730b1b0ca4;hb=ae6c004bd31e02dda37357d74b641c101b116c73;hpb=85f46b3d72dbafb6fe1fbb9bca32ec612cf8b480 diff --git a/ginac/function.cppy b/ginac/function.cppy index fb1d8791..789ca056 100644 --- a/ginac/function.cppy +++ b/ginac/function.cppy @@ -34,7 +34,6 @@ #include "power.h" #include "archive.h" #include "inifcns.h" -#include "tostring.h" #include "utils.h" #include "hash_seed.h" #include "remember.h" @@ -79,7 +78,7 @@ void function_options::initialize() set_name("unnamed_function", "\\\\mbox{unnamed}"); nparams = 0; eval_f = evalf_f = real_part_f = imag_part_f = conjugate_f = expand_f - = derivative_f = expl_derivative_f = power_f = series_f = 0; + = derivative_f = expl_derivative_f = power_f = series_f = nullptr; info_f = 0; evalf_params_first = true; use_return_type = false; @@ -229,7 +228,7 @@ function::function(unsigned ser) : serial(ser) // the following lines have been generated for max. @maxargs@ parameters +++ for N in range(1, maxargs + 1): function::function(unsigned ser, @seq('const ex & param%(n)d', N)@) - : exprseq(@seq('param%(n)d', N)@), serial(ser) + : exprseq{@seq('param%(n)d', N)@}, serial(ser) { } --- @@ -365,6 +364,10 @@ next_context: ex function::eval(int level) const { + if ((level == 1) && (flags & status_flags::evaluated)) { + return *this; + } + if (level>1) { // first evaluate children, then we will end up here again return function(serial,evalchildren(level)); @@ -386,7 +389,7 @@ ex function::eval(int level) const } } - if (opt.eval_f==0) { + if (opt.eval_f==nullptr) { return this->hold(); } @@ -793,8 +796,7 @@ ex function::power(const ex & power_param) const // power of function } } // No power function defined? Fall back to returning a power object. - return (new GiNaC::power(*this, power_param))->setflag(status_flags::dynallocated | - status_flags::evaluated); + return dynallocate(*this, power_param).setflag(status_flags::evaluated); } ex function::expand(unsigned options) const @@ -878,7 +880,7 @@ unsigned function::find_function(const std::string &name, unsigned nparams) return serial; ++serial; } - throw (std::runtime_error("no function '" + name + "' with " + ToString(nparams) + " parameters defined")); + throw (std::runtime_error("no function '" + name + "' with " + std::to_string(nparams) + " parameters defined")); } /** Return the print name of the function. */