help-octave
[Top][All Lists]
Advanced

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

Re: Vectors of Structures in C++


From: Bill Denney
Subject: Re: Vectors of Structures in C++
Date: Mon, 10 Apr 2006 18:32:06 -0400 (EDT)

On Mon, 10 Apr 2006, Jordi Gutierrez Hermoso wrote:

On 4/9/06, Bill Denney <address@hidden> wrote:
I'm wanting to make a vector of structures

I'm not sure if I'm understanding your question, but will a simple answer like using the Standard Template Library vector class satisfy your needs?

I don't think so, but let me try to explain what I'm wanting a bit better, and maybe you can tell me if it will work (and perhaps give an example of how to do it):

I am currently doing something like

DLD_FUNCTION(TranslateSBML, argsIn, , "") {
  octave_value_list retval;

  Octave_map a;
  a.assign("foo", 123);
  a.assign("bar", GetSubstruct());

  return retval;
}

octave_value_list GetSubstruct() {
  Octave_map tmp;
  octave_value_list substruct;

  for (int i=0; i < 10; i++) {
    tmp.assign("a", i);
    substruct(i) = tmp;
  }

  return substruct;
}

I want substruct to be a struct vector instead of a cell vector. How do I do that?

Bill

--
"She often gave herself very good advice (though she very seldom
followed it)."
  -- Lewis Carroll



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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