help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new types and INSTALL_BINOP


From: John W. Eaton
Subject: Re: new types and INSTALL_BINOP
Date: Fri, 2 Mar 2001 23:20:21 -0600

On  2-Mar-2001, Francesco Potorti` <address@hidden> wrote:

|    | I have conversion methods for this, eg:
|    |    Matrix octave_sparse::matrix_value (bool = false) const {
|    |       Matrix M= oct_sparse_to_full( X );
|    |       return M;
|    |    }
|    
|    (I'd write the body of this function as just
|    
|      return oct_sparse_to_full (X);
|    
|    since there is no need to have the declaration/initialization
|    statement here.)
| 
| Maybe  I am  completely wrong,  but why  not simply  using  a conversion
| operator?  Sorry if the syntax is  incorrect, I have not used this for a
| long time:
| 
| octave_sparse::operator Matrix() { return oct_sparse_to_full(this); }

Yes, defining a conversion operator might be useful for C++ code, but
that will not enable the Octave interpreter to perform type
conversions.  For that, you need to define the conversion operations
as I outlined.

jwe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]