]> www.ginac.de Git - ginac.git/commitdiff
is_(ex_)(exactly_)of_type: macros fixed, simplfied and documented.
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Sun, 18 Feb 2001 19:21:22 +0000 (19:21 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Sun, 18 Feb 2001 19:21:22 +0000 (19:21 +0000)
ginac/basic.h

index 1f7af71bb59d038d0bea6ee1729854ea62438351..a75f4c0b925a5d6586f072d6e34003377b953787 100644 (file)
@@ -195,28 +195,32 @@ extern int max_recursion_level;
 
 #ifndef NO_NAMESPACE_GINAC
 
+/** Check if OBJ is a TYPE, including base classes. */
 #define is_of_type(OBJ,TYPE) \
-       (dynamic_cast<TYPE *>(const_cast<GiNaC::basic *>(&OBJ))!=0)
+       (dynamic_cast<const TYPE *>(&OBJ)!=0)
 
+/** Check if OBJ is a TYPE, not including base classes. */
 #define is_exactly_of_type(OBJ,TYPE) \
        ((OBJ).tinfo()==GiNaC::TINFO_##TYPE)
 
+/** Check if ex is a handle to a TYPE, including base classes. */
 #define is_ex_of_type(OBJ,TYPE) \
-       (dynamic_cast<TYPE *>(const_cast<GiNaC::basic *>((OBJ).bp))!=0)
+       (dynamic_cast<const TYPE *>((OBJ).bp)!=0)
 
+/** Check if ex is a handle to a TYPE, not including base classes. */
 #define is_ex_exactly_of_type(OBJ,TYPE) \
        ((*(OBJ).bp).tinfo()==GiNaC::TINFO_##TYPE)
 
 #else // ndef NO_NAMESPACE_GINAC
 
 #define is_of_type(OBJ,TYPE) \
-       (dynamic_cast<TYPE *>(const_cast<basic *>(&OBJ))!=0)
+       (dynamic_cast<const TYPE *>(&OBJ)!=0)
 
 #define is_exactly_of_type(OBJ,TYPE) \
        ((OBJ).tinfo()==TINFO_##TYPE)
 
 #define is_ex_of_type(OBJ,TYPE) \
-       (dynamic_cast<TYPE *>(const_cast<basic *>((OBJ).bp))!=0)
+       (dynamic_cast<const TYPE *>((OBJ).bp)!=0)
 
 #define is_ex_exactly_of_type(OBJ,TYPE) \
        ((*(OBJ).bp).tinfo()==TINFO_##TYPE)