help-octave
[Top][All Lists]
Advanced

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

Problem with vector classes


From: John W. Eaton
Subject: Problem with vector classes
Date: Fri, 1 Oct 1999 12:22:00 -0500 (CDT)

[The octave-sources mailing list is for posting sources.  If you want
help, please send mail to the help-octave mailing list instead.  --jwe]

On  1-Oct-1999, Thomas Walter <address@hidden> wrote:

| I have a problem with the behaviout of 'ColumnVector', 'RowVector' and
| the direct access to their data using 'fortran_vec()'.
| 
| Example code:
| 
|   const ColumnVector xv = args (0).vector_value();
|   const double *my_data = xv.fortran_vec();
| 
| Using 'gcc-2.95.1' on a linux-box gives the following error message:
| 
| heap_sort.cc: In function `class octave_value_list Frank_data(const 
octave_value_list &, int)':
| heap_sort.cc:321: passing `const ColumnVector' as `this' argument of
| `double * Array<double>::fortran_vec()' discards qualifiers
| 
| current fix to the example:
| 
|   /* const */ ColumnVector xv = args (0).vector_value();
|   const double *my_data = xv.fortran_vec();
| 
| Is it possible or are there plans to fix this?

I don't think it is a bug, so I don't see anything to fix.

| This could improve the coding to C-style functions which want a
| pointer to the data but for read only.

If you want read-only access to data in a matrix or vector objet, use
the data() member function.  It returns a const pointer.

jwe



---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------



reply via email to

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