[GiNaC-list] Re: Problem compiling mystring.cpp

Alexei Sheplyakov varg at theor.jinr.ru
Mon Nov 12 19:07:35 CET 2007


Hello!

On Mon, Nov 12, 2007 at 05:29:51PM +0100, jros wrote:
> I have a problem compiling
> 
> http://www.ginac.de/viewcvs/GiNaC/doc/examples/mystring.cpp?rev=1.1

[snipped the error messages]

This example is for GiNaC version 1.4. If you want to compile it with
older version[s], apply the following patch:


--- mystring.cpp	2007-11-05 12:28:19.062020000 +0300
+++ mystring_o.cpp	2007-11-12 20:52:20.752501247 +0300
@@ -9,6 +9,9 @@
 #include <ginac/ginac.h>
 using namespace GiNaC;
 
+// Make sure this does not collide with other classes' TINFOs.
+static const unsigned TINFO_mystring = 666U;
+
 class mystring : public basic
 {
 	GINAC_DECLARE_REGISTERED_CLASS(mystring, basic)
@@ -29,9 +32,9 @@
   print_func<print_context>(&mystring::do_print))
 
 // ctors
-mystring::mystring() : inherited(&mystring::tinfo_static) { }
-mystring::mystring(const string &s) : inherited(&mystring::tinfo_static), str(s) { }
-mystring::mystring(const char *s) : inherited(&mystring::tinfo_static), str(s) { }
+mystring::mystring() : inherited(TINFO_mystring) { }
+mystring::mystring(const string &s) : inherited(TINFO_mystring), str(s) { }
+mystring::mystring(const char *s) : inherited(TINFO_mystring), str(s) { }
 
 // comparison
 int mystring::compare_same_type(const basic &other) const


Best regards,
	Alexei

-- 
All science is either physics or stamp collecting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-list/attachments/20071112/2f3e7c55/attachment.pgp


More information about the GiNaC-list mailing list