[Fwd: Re: Missing namespace qualification in GiNaC 1.0.12]

-------- Original Message -------- Subject: Re: Missing namespace qualification in GiNaC 1.0.12 Date: Wed, 30 Oct 2002 19:18:52 +0100 From: Christian Bauer cbauer@zino.physik.uni-mainz.de Reply-To: ginac-list@zino.physik.uni-mainz.de To: ginac-list@zino.physik.uni-mainz.de References: 3DC013C9.6080508@cs.unipr.it
Hi!
On Wed, Oct 30, 2002 at 06:15:53PM +0100, Roberto Bagnara wrote:
It seems the patch below was not included in 1.0.12.
#define is_ex_the_function(OBJ, FUNCNAME) \
! (GiNaC::is_exactly_aGiNaC::function(OBJ) && GiNaC::ex_toGiNaC::function(OBJ).get_serial() == function_index_##FUNCNAME)
#define is_ex_the_function(OBJ, FUNCNAME) \
! (GiNaC::is_exactly_aGiNaC::function(OBJ) && GiNaC::ex_toGiNaC::function(OBJ).get_serial() == GiNaC::function_index_##FUNCNAME)
The function_index_* are not necessarily in the GiNaC namespace (only for functions defined by GiNaC itself), so this patch would break is_ex_the_function() for user-defined functions. Forcing function_index_* into the GiNaC namespace doesn't seem to be possible in C++. I can't think of any solution that wouldn't break binary compatibility.
In GiNaC 1.1, the situation is slightly improved: the function_index_* are replaced by *_SERIAL classes which at least allows you to prefix the function name with a namespace qualifier when using is_ex_the_function(). The ideal solution would be to convert is_ex_the_function() into a proper template function (a la is_a<>() etc.), but this would require having classes with the same identifier as functions (e.g. "class sin" which in some way holds the serial number, and "sin()" which constructs a function object) which also doesn't appear to be possible (well, gcc 3.x didn't accept it...).
If you have any clever solution for this, I'd be happy to hear it.
Bye, Christian
participants (1)
-
Roberto Bagnara