]> www.ginac.de Git - ginac.git/blobdiff - ginac/power.h
* Supplement some (now deprecated) macros by inlined template functions:
[ginac.git] / ginac / power.h
index d13463af714df83e7a167fee4265f752e69b0d16..23a7a4eb4407991748ee1bea11ca7af70b72b48a 100644 (file)
@@ -92,11 +92,20 @@ protected:
 };
 
 // utility functions
+
+/** Return the power object handled by an ex.
+ *  This is unsafe: you need to check the type first. */
 inline const power &ex_to_power(const ex &e)
 {
        return static_cast<const power &>(*e.bp);
 }
 
+/** Efficient specialization of is_exactly_a<power>(obj) for power objects. */
+template<> inline bool is_exactly_a<power>(const basic & obj)
+{
+       return obj.tinfo()==TINFO_power;
+}
+
 // wrapper functions
 
 /** Symbolic exponentiation.  Returns a power-object as a new expression.