X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Frelational.cpp;h=86e2c2e8399bde1fbea5eb4db966e69aa2870f27;hb=73081e1cccfec32a9e9dab6a5e4b063b3fa0e7fb;hp=87acde42fe24b89e975167da4dd243716d411fe3;hpb=96af2609db413ddf70371e0423e6c07ecb5ee813;p=ginac.git diff --git a/ginac/relational.cpp b/ginac/relational.cpp index 87acde42..86e2c2e8 100644 --- a/ginac/relational.cpp +++ b/ginac/relational.cpp @@ -164,7 +164,14 @@ ex relational::op(size_t i) const ex relational::map(map_function & f) const { - return (new relational(f(lh), f(rh), o))->setflag(status_flags::dynallocated); + const ex &mapped_lh = f(lh); + const ex &mapped_rh = f(rh); + + if (!are_ex_trivially_equal(lh, mapped_lh) + || !are_ex_trivially_equal(rh, mapped_rh)) + return (new relational(mapped_lh, mapped_rh, o))->setflag(status_flags::dynallocated); + else + return *this; } ex relational::eval(int level) const