[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
octave_value_list and octave_value subsasgn
From: |
Thomas Treichl |
Subject: |
octave_value_list and octave_value subsasgn |
Date: |
Wed, 16 Jul 2008 20:50:34 +0200 |
User-agent: |
Thunderbird 2.0.0.14 (Macintosh/20080421) |
Hi,
I don't know if this is a bug or if I am doing something wrong, that's why I
decided to post this email on the help list. I've attached two files and I want
to get the same result from the DLD-function as I get from the m-function. If I
am using the subsasgn function in C++ then the type of the octave_value is
converted to double. What I would expect is that the class of the
octave_value_list is still logical like in the m-file function. The attached
codes are snipped out of my current implementations.
If someone might want to know what for I need this then the answer is that I'm
currently reworking arrayfun (and maybe cellfun and structfun and spfun later)
because I need even more compatibility and performance of these functions and I
don't want to go through the list of all class types that are available for an
octave_value in C++ but I simple want to use the "(" and "{" assignment.
A further question: In the other brand structfun accepts only one structure
input argument (cellfun and arrafun accept more than one) - this currently also
is state of the art in Octave. Is it worth and is it wanted (this wouldn't break
compatibility but would enhance usability) if I am creating a new structfun that
accepts more than one structure input argument where all input arguments must
have the same number of fields and the same fieldnames, so that structfun
becomes more likely to cellfun and arrayfun? Something similiar for spfun which
in the other brand also does not support 'UniformOutput' and 'ErrorHandler'?
Regards,
Thomas
function [A] = msubsasgn ()
a = true;
b = false;
A(1) = a;
A(2) = b;
class (A)
endfunction
%# Local Variables: ***
%# mode: octave ***
%# End: ***
#include "oct.h"
DEFUN_DLD (ccsubsasgn, varargin, nargout, " ") {
octave_value a = true;
octave_value b = false;
octave_value_list varargout;
varargout(0) = varargout(0).subsasgn ("(", std::list<octave_value_list>(1,
octave_value(1)), a);
varargout(0) = varargout(0).subsasgn ("(", std::list<octave_value_list>(1,
octave_value(2)), b);
octave_stdout << varargout(0).class_name () << std::endl;
return (varargout);
}
// Local Variables: ***
// mode: C++ ***
// End: ***
- octave_value_list and octave_value subsasgn,
Thomas Treichl <=