]> www.ginac.de Git - ginac.git/blobdiff - ginac/numeric.h
* Supplement some (now deprecated) macros by inlined template functions:
[ginac.git] / ginac / numeric.h
index b759d1aff42ac75a31c429719d591fddb02db699..d727fe35908bc3c4666c2fa1ffd2118c8f56b8f0 100644 (file)
@@ -285,11 +285,20 @@ ex CatalanEvalf(void);
 
 
 // utility functions
+
+/** Return the numeric object handled by an ex.
+ *  This is unsafe: you need to check the type first. */
 inline const numeric &ex_to_numeric(const ex &e)
 {
        return static_cast<const numeric &>(*e.bp);
 }
 
+/** Specialization of is_exactly_a<numeric>(obj) for numeric objects. */
+template<> inline bool is_exactly_a<numeric>(const basic & obj)
+{
+       return obj.tinfo()==TINFO_numeric;
+}
+
 } // namespace GiNaC
 
 #ifdef __MAKECINT__