+class symbolset {
+ exset s;
+ void insert_symbols(const ex &e)
+ {
+ if (is_a<symbol>(e)) {
+ s.insert(e);
+ } else {
+ for (const ex &sube : e) {
+ insert_symbols(sube);
+ }
+ }
+ }
+public:
+ explicit symbolset(const ex &e)
+ {
+ insert_symbols(e);
+ }
+ bool has(const ex &e) const
+ {
+ return s.find(e) != s.end();
+ }
+};
+