[GiNaC-devel] Best way to iterate through an expression

Vladimir V. Kisil kisilv at maths.leeds.ac.uk
Tue May 9 11:41:45 CEST 2017


	Hi, Jan,

	Did you check the section "5.5 Applying a function on
  subexpressions" from the tutorial?

  Best wishes.
  Vladimir
-- 
Vladimir V. Kisil                 http://www.maths.leeds.ac.uk/~kisilv/
  Book:     Geometry of Mobius Transformations     http://goo.gl/EaG2Vu
  Software: Geometry of cycles          http://moebinv.sourceforge.net/
>>>>> On Mon, 8 May 2017 20:06:14 +0200, Jan Rheinländer <jrheinlaender at gmx.de> said:

    JR> Hi,

    JR> my code has a lot of statements of this kind:

    JR> if (is_a<mul>(some_ex)) { for (const auto& m : some_ex) { // Do
    JR> something with m } } else { // Do something with some_ex }

    JR> Is there a more elegant way of iterating through an expression
    JR> that avoids having to write the "Do something" part twice?

    JR> Thanks,

    JR> Jan

    JR> _______________________________________________ GiNaC-devel
    JR> mailing list GiNaC-devel at ginac.de
    JR> https://www.cebix.net/mailman/listinfo/ginac-devel



More information about the GiNaC-devel mailing list