help-octave
[Top][All Lists]
Advanced

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

Re: single/double precision in C++


From: John W. Eaton
Subject: Re: single/double precision in C++
Date: Tue, 10 Nov 2009 07:14:10 -0500

On 10-Nov-2009, Jaroslav Hajek wrote:

| On Tue, Nov 10, 2009 at 12:56 PM, John W. Eaton <address@hidden> wrote:
| 
| > On 10-Nov-2009, Jaroslav Hajek wrote:
| >
| > | + // const_casts are necessary because LTFAT doesn't specify const on
| > input data.
| > | + lib_func (const_cast<T1 *>(f.fortran_vec ()), const_cast<T2
| > *>(gf.fortran_vec ()),
| > | +           L, W, R, a, M, cout.fortran_vec ());
| >
| > Maybe I'm missing something, but I don't see why the const_cast is
| > necessary here.  The result of fortran_vec is not const.
| >
| >
| The result of fortran_vec *is* const when called on a const variable, which
| is the case here. In this sense, fortran_vec behaves just like the elem()
| functions. data () is a const-only method.

OK, so I was missing something.  :-)

But I would still not recommend getting in the habit of casting away
const...

jwe


reply via email to

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