#include "lst.h"
#include "ncmul.h"
#include "utils.h"
+#include "debugmsg.h"
+
+#ifndef NO_GINAC_NAMESPACE
+namespace GiNaC {
+#endif // ndef NO_GINAC_NAMESPACE
//////////
// default constructor, destructor, copy constructor assignment operator and helpers
{
debugmsg("basic destructor",LOGLEVEL_DESTRUCT);
destroy(0);
- ASSERT((!(flags & status_flags::dynallocated))||(refcount==0));
+ GINAC_ASSERT((!(flags & status_flags::dynallocated))||(refcount==0));
}
basic::basic(basic const & other) : flags(0), refcount(0), tinfo_key(TINFO_BASIC)
bool basic::has(ex const & other) const
{
- ASSERT(other.bp!=0);
+ GINAC_ASSERT(other.bp!=0);
if (is_equal(*other.bp)) return true;
if (nops()>0) {
for (int i=0; i<nops(); i++) {
return subs(ls,lr);
}
-// compare functions to sort expressions canonically
-// all compare functions return: -1 for *this less than other, 0 equal, 1 greater
-
-/*
-int basic::compare(basic const & other) const
-{
- const type_info & typeid_this = typeid(*this);
- const type_info & typeid_other = typeid(other);
-
- if (typeid_this==typeid_other) {
- return compare_same_type(other);
- }
-
- // special rule: sort numeric() to end
- if (typeid_this==typeid_numeric) return 1;
- if (typeid_other==typeid_numeric) return -1;
-
- // otherwise: sort according to type_info order (arbitrary, but well defined)
- return typeid_this.before(typeid_other) ? -1 : 1;
-}
-*/
-
+/** Compare objects to establish canonical order.
+ * All compare functions return: -1 for *this less than other, 0 equal,
+ * 1 greater. */
int basic::compare(basic const & other) const
{
unsigned hash_this = gethash();
return 1;
}
- ASSERT(typeid(*this)==typeid(other));
+ GINAC_ASSERT(typeid(*this)==typeid(other));
int cmpval=compare_same_type(other);
if ((cmpval!=0)&&(hash_this<0x80000000U)) {
if (typeid_this!=typeid_other) return false;
- ASSERT(typeid(*this)==typeid(other));
+ GINAC_ASSERT(typeid(*this)==typeid(other));
return is_equal_same_type(other);
}
//////////
int max_recursion_level=1024;
+
+#ifndef NO_GINAC_NAMESPACE
+} // namespace GiNaC
+#endif // ndef NO_GINAC_NAMESPACE