[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
- single/double precision in C++, Peter L., 2009/11/09
- Re: single/double precision in C++, Jaroslav Hajek, 2009/11/09
- Re: single/double precision in C++, Peter L., 2009/11/10
- Re: single/double precision in C++, Jaroslav Hajek, 2009/11/10
- Re: single/double precision in C++, Jaroslav Hajek, 2009/11/10
- Re: single/double precision in C++, John W. Eaton, 2009/11/10
- Re: single/double precision in C++, Jaroslav Hajek, 2009/11/10
- Re: single/double precision in C++,
John W. Eaton <=
- Re: single/double precision in C++, Jaroslav Hajek, 2009/11/10
- Re: single/double precision in C++, Peter Søndergaard, 2009/11/10
Re: single/double precision in C++, Sergei Steshenko, 2009/11/09