Re: REAL with generics constraint
"j-c.taveau" <[email protected]>
| Newsgroups | gmane.comp.lang.eiffel.smalleiffel |
|---|---|
| Message-ID | <[email protected]> |
> Arnaud Payement wrote: > > > > > > > I am using eiffel to write a VECTOR class with operation like dot and > > cross products and I need to get the norm of the vector. Therefore, I > > am using the sqrt methods of the REAL type. However, I want to use my > > class with REAL_32 or REAL_64 etc ... I use generics with constraint > > but REAL_64 and REAL_32 doesn't have a root class with the sqrt > > methods !!!!!! How can I do that ? I am new to Eiffel, so my question > > is perhaps a stupid one. My code : > > You can't. There is no way to implement such generic class. I sent several emails about this with an example class POINT[T->NUMERIC]. What you have to do is define two classes VECTOR_REAL_64 and VECTOR_REAL_32 with their own 'normalize' method. > Have you looked at REAL_GENERAL. I don't know what the current state of > play is. Unfortunately, no :-( 'xxx_GENERAL' classes are dummy classes and can't be used in SmartEiffel code. Accédez au courrier électronique de La Poste : www.laposte.net ; 3615 LAPOSTENET (0,34/mn) ; tél : 08 92 68 13 50 (0,34/mn)