RE: [ROOT] root(cint) and template

From: Philippe Canal (pcanal@fnal.gov)
Date: Fri May 11 2001 - 16:08:24 MEST


Hi Jacek,

I would actually recommend that you try to compile the header file and
provide a dictionary for Complex<double>.  The main advantage is that
you would then be able to pass the Complex<double> object back and forth
from the interpreter to compiled code.  [You have a problem when
the interpreter knows about an 'interpreted version' of the Complex<double>
class and the compiled code knows about a 'compiled version'.

Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Jacek M. Holeczek
Sent: Friday, May 11, 2001 2:28 AM
To: roottalk@pcroot.cern.ch
Subject: Re: [ROOT] root(cint) and template


Hi,
Thanks for your help. Indeed, replacing Complex by Complex<...> helped.
Now I get (root 3.00/06, RH6.1/i386) :
	root [0] {#include "Complex"}  
	root [1] Complex<double> a(1.0, 2.0)
	root [2] a                          
	(class Complex<double>)141923096
	root [3] cout << a                  
	Error: Unexpected EOF G__fignorestream():3 FILE:Complext.hxx LINE:144
	Advice: You may need to use +P or -p option
	((const int)0
	*** Interpreter error recovered ***
The code in question is :
	template <class _FLT> inline _FLT
	real (const Complex<_FLT>& x) __attribute__ ((const));
			// (a completely empty line 144 is here ...)
	template <class _FLT> inline _FLT
	real (const Complex<_FLT>& x)
	{
	  return x.real ();
	}
where (previously, in the same file) :
	#if ! defined (__GNUG__) && ! defined (__attribute__)
	#define __attribute__(foo) /* Ignore.  */
	#endif
What now ?
Thanks in advance,
Jacek.
P.S. What I try to do is to get the template version of Complex class in
     ROOT. The original code is taken from the GNU ANSI C++ Library. It
     was modified to make sure that the real and imaginary part are stored
     in contiguous elements of a two element array. This eliminates any
     padding between the real and imaginary parts, allowing the class to
     be later mapped correctly onto packed complex arrays (I hope). Jacek.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:45 MET