]> www.ginac.de Git - ginac.git/blobdiff - ginac/constant.h
* Supplement some (now deprecated) macros by inlined template functions:
[ginac.git] / ginac / constant.h
index bf85b382d6c5b38dc2e4ddc5ab89544c2209420d..4c928765fd044c705c3e626520856aee8beb8318 100644 (file)
@@ -80,11 +80,20 @@ extern const constant Catalan;
 extern const constant Euler;
 
 // utility functions
+
+/** Return the constant object handled by an ex.
+ *  This is unsafe: you need to check the type first. */
 inline const constant &ex_to_constant(const ex &e)
 {
        return static_cast<const constant &>(*e.bp);
 }
 
+/** Specialization of is_exactly_a<constant>(obj) for constant objects. */
+template<> inline bool is_exactly_a<constant>(const basic & obj)
+{
+       return obj.tinfo()==TINFO_constant;
+}
+
 } // namespace GiNaC
 
 #endif // ndef __GINAC_CONSTANT_H__