Hi,
Is there a better way to test if a symbol is a vector? If not what is the simplest way to extend symbol?
I looked at the implementation of realsymb and have come to the conclusion that the current implementation of symbol is not extensible. Should we change domain to be a type_info class (or a lighter version if required)? This we we can make symbol extensible. For example class symbol_base : class basic { ... symbol_base(const std::string & initname, type_info* ti); ... type_info const& get_domain_type() const { return *pti; } ... private: type_info const* pti; ... }; template<class domain_type> class domain_symbol : public symbol_base { public: domain_symbol(const std::string & initname) : symbol_base(initname, typeid(domain_type)) { } }; struct real_domain {}; struct complex_domain {}; struct vector_domain {}; typedef domain_symbol<real_domain> real_symbol; typedef domain_symbol<complex_domain> complex_symbol; typedef domain_symbol<vector_domain> vector_symbol; typedef complex_symbol symbol; template<class domain_type> bool is_domain_a(const basic& obj) { if (obj.tinfo() != &symbol::tinfo_static) return false; return type_info(domain_type) == static_cast<const symbol &>(obj).get_domain_type(); } Now things like is_domain_a<real_domain>(e) is_domain_a<vector_domain>(e) makes sense. There is one thing I did not understand though. symbol definition has friend class realsymbol; If this is required my approach (so is any other solution) is doomed, as friend cannot be a template. Let me know if you think of any simpler alternatives. cheers, Krishna.