25 Jul 08:34
Troubles getting reverse assignment right
From: Jörgen Tegnér <jorgen.tegner <at> telia.com>
Subject: Troubles getting reverse assignment right
Newsgroups: gmane.comp.lang.eiffel.smalleiffel
Date: 2008-07-25 06:37:21 GMT
Expires: This article expires on 2008-08-08
Subject: Troubles getting reverse assignment right
Newsgroups: gmane.comp.lang.eiffel.smalleiffel
Date: 2008-07-25 06:37:21 GMT
Expires: This article expires on 2008-08-08
Hi list,
I have troubles with reverse assignment and would appreciate some
advice.
class GENERAL_VECTOR[E_->NUMERIC]
inherit ARRAY[E_]
class REAL_VECTOR_32
inherit GENERAL_VECTOR[REAL_32]
class REAL_VECTOR_64
inherit GENERAL_VECTOR[REAL_64]
In GENERAL_VECTOR I want to find out the correct type of E_, REAL_32 or
REAL_64, to call the correct function with the correct live type. One
unelegant solution that kind of works:
anchor:E_
...
inspect Current.anchor.generating_type
when "REAL_32" then
debug io.put_string("REAL_32 version of axpy%N") end
f_saxpy($n,$alpha,p1,$ldx,p2,$ldy)
when "REAL_64" then
debug io.put_string("REAL_64 version of axpy%N") end
f_daxpy($n,$alpha,p1,$ldx,p2,$ldy)
end
Above code works and gives the correct results.
(Continue reading)
RSS Feed