[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
modify in place
From: |
Ben Sapp |
Subject: |
modify in place |
Date: |
Mon, 27 Nov 2000 17:51:00 -0700 |
How can I modify a variable that is a new user defined type? I want to
modify the actuall variable. I do not want to make another modified
instance of the variable. I tried the following piece of code and it
compiled fine but, ended up crashing on the line in
"non_const_function()" where I modify some internal variables in
myclass.
------------------------------------------------------------
octave_value &rep = const_cast<octave_value&>(args(0).get_rep());
octave_myclass &myclass = (octave_myclass &)(rep);
myclass.non_const_function();
-------------------------------------------------------------
I want it to work like this from the octave command line:
modify_in_place(a);
Now "modify_in_place" does not return any thing it just changes the
value of "a".
Thanks.
--
Ben Sapp Los Alamos National Laboratory
email: <mailto:address@hidden> Phone: (505)667-3277
Fax: (505)665-7920 URL: http://www.neutrino.lanl.gov/
--
-------------------------------------------------------------
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
-------------------------------------------------------------
- modify in place,
Ben Sapp <=