On Thu, Sep 15, 2005 at 01:08:45AM +1000, John Pye wrote:
I _really_ wanted to use
std::map<symbol, symbol>
What's a better idea then?
You can define ordering as struct symbol_is_less { inline const bool operator()(const symbol& a, const symbol& b) { return ex_is_less()(a, b); } }; and use std::map<symbol, symbol, symbol_is_less> Here is a simple example: #include <iostream> #include <iterator> #include <map> #include <ginac/ginac.h> using namespace std; using namespace GiNaC; struct symbol_is_less { inline const bool operator()(const symbol& x, const symbol& y) { return ex_is_less()(x, y); } }; typedef map<symbol, symbol, symbol_is_less> ssmap; int main(int argc, char** argv) { symbol x("x"); symbol y("y"); symbol z("z"); symbol t("t"); ssmap foo; foo[x] = z; foo[y] = t; for (ssmap::const_iterator i=foo.begin(); i!=foo.end(); ++i) cout << i->first << " ==> " << i->second << endl; return 0; } Is this good enough for your purpose? Best regards, Alexei -- All science is either physics or stamp collecting.