X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fconstant.h;h=bdd8d69e79d16b3a5e1612a167341d19b6786627;hp=bf85b382d6c5b38dc2e4ddc5ab89544c2209420d;hb=11c7f91bf740646e78ffa0711ef405aefca96705;hpb=f7a07ae7330a3543bb00aa7b659e2624d6c440c7 diff --git a/ginac/constant.h b/ginac/constant.h index bf85b382..bdd8d69e 100644 --- a/ginac/constant.h +++ b/ginac/constant.h @@ -46,7 +46,7 @@ public: constant(const std::string & initname, evalffunctype efun = 0, const std::string & texname = std::string()); constant(const std::string & initname, const numeric & initnumber, const std::string & texname = std::string()); - // functions overriding virtual functions from bases classes + // functions overriding virtual functions from base classes public: void print(const print_context & c, unsigned level = 0) const; int degree(const ex & s) const; @@ -80,11 +80,20 @@ extern const constant Catalan; extern const constant Euler; // utility functions + +/** Return the constant object handled by an ex. Deprecated: use ex_to(). + * This is unsafe: you need to check the type first. */ inline const constant &ex_to_constant(const ex &e) { return static_cast(*e.bp); } +/** Specialization of is_exactly_a(obj) for constant objects. */ +template<> inline bool is_exactly_a(const basic & obj) +{ + return obj.tinfo()==TINFO_constant; +} + } // namespace GiNaC #endif // ndef __GINAC_CONSTANT_H__