GiNaC/doc/tutorial ginac.texi

Pearu Peterson pearu at cens.ioc.ee
Mon Apr 9 23:54:49 CEST 2001



On Mon, 9 Apr 2001, Christian Bauer wrote:

> - added examples for specialized expression output by tree-traversal and
>   with the aid of archives

These examples are very useful for understanding GiNaC archive stuff
for GiNaC beginners like me. Thanks!

However, I might have found even simpler way to extract protected
attributes. Take, for example, indexed class that has protected attribute
`seq'. It can be read outside of the indexed class as follows:

class wrap_indexed: public indexed {
public:
  const exvector & get_seq(void) const { return this->seq; }
};

void somefunction (const indexed & obj) {
  const exvector & seq = ((const wrap_indexed &)obj).get_seq();
  /* Use `seq' for something */
}

Unfortunately it will not work for private attributes, of course.
Is there any reason why

    minkmetric::pos_sig
    color::representation_label
    tensepsilon::minkowski

could not be protected? Are they archived attributes?

Regards,
	Pearu




More information about the GiNaC-devel mailing list