[GiNaC-list] Maps and sets of symbols?

John Pye john.pye at student.unsw.edu.au
Wed Sep 14 16:12:41 CEST 2005

Hi again,

I've got an application I'm working on which needs the ability to handle
STL maps and sets containing symbols. In order to be able to use these
classes, I have to define an ordering (a less-than operator) for
symbols. At the moment I use the 'get_name' method and then compare
symbol names as strings, but this isn't really ideal, since it takes a a
lot of processing, plus GiNaC is quite happy to tolerate more than one
symbol with the same name, so my map/set should be as well.

I notice that GiNaC's symbol class has a 'serial number' as one of its
properties. Is there any way I can access that value via a public
method? Or is there another method suggested for creating sets and maps
of symbols?

//// Ordering for symbols based on name (there should be a better way)/
*class* symbol_lt{
    bool *operator*()(const GiNaC::symbol &a, const GiNaC::symbol &b) const;



More information about the GiNaC-list mailing list