ex();
~ex();
ex(const ex & other);
- const ex & operator=(const ex & other);
+ ex & operator=(const ex & other);
// other ctors
public:
ex(const basic & other);
ex evalf(int level = 0) const { return bp->evalf(level); }
ex diff(const symbol & s, unsigned nth = 1) const;
ex series(const ex & r, int order, unsigned options = 0) const;
- ex subs(const lst & ls, const lst & lr) const { return bp->subs(ls, lr); }
- ex subs(const ex & e) const { return bp->subs(e); }
+ bool match(const ex & pattern) const;
+ bool match(const ex & pattern, lst & repl_lst) const { return bp->match(pattern, repl_lst); }
+ ex subs(const lst & ls, const lst & lr, bool no_pattern = false) const { return bp->subs(ls, lr, no_pattern); }
+ ex subs(const ex & e, bool no_pattern = false) const { return bp->subs(e, no_pattern); }
exvector get_free_indices(void) const { return bp->get_free_indices(); }
ex simplify_indexed(void) const;
ex simplify_indexed(const scalar_products & sp) const;
unsigned return_type(void) const { return bp->return_type(); }
unsigned return_type_tinfo(void) const { return bp->return_type_tinfo(); }
unsigned gethash(void) const { return bp->gethash(); }
-
- ex exadd(const ex & rh) const;
- ex exmul(const ex & rh) const;
private:
void construct_from_basic(const basic & other);
void construct_from_int(int i);
}
inline
-const ex & ex::operator=(const ex & other)
+ex & ex::operator=(const ex & other)
{
/*debugmsg("ex operator=",LOGLEVEL_ASSIGNMENT);*/
GINAC_ASSERT(bp!=0);
GINAC_ASSERT(bp->flags & status_flags::dynallocated);
GINAC_ASSERT(other.bp!=0);
GINAC_ASSERT(other.bp->flags & status_flags::dynallocated);
+ // NB: must first increment other.bp->refcount, since other might be *this.
+ ++other.bp->refcount;
if (--bp->refcount==0)
delete bp;
- ++other.bp->refcount;
bp = other.bp;
#ifdef OBSCURE_CINT_HACK
update_last_created_or_assigned_bp();
inline ex series(const ex & thisex, const ex & r, int order, unsigned options = 0)
{ return thisex.series(r, order, options); }
+inline bool match(const ex & thisex, const ex & pattern, lst & repl_lst)
+{ return thisex.match(pattern, repl_lst); }
+
inline ex subs(const ex & thisex, const ex & e)
{ return thisex.subs(e); }