[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using STL in .oct files
From: |
Nimrod Mesika |
Subject: |
Re: using STL in .oct files |
Date: |
Sat, 12 Aug 2000 22:20:27 +0300 |
User-agent: |
Mutt/1.2i |
On Sat, Aug 12, 2000 at 09:11:55PM +0300, Nimrod Mesika wrote:
>
> map<string, long> directory;
> DEFUN_DLD (gg, args, ,"gg(str)Ün")
> {
>
> directory["Bogart"] = 1234567;
> directory["Bacall"] = 9876543;
>
> string name = args(0).string_value();
>
> if (directory.find(name) != directory.end())
> octave_stdout << "The phone number for " << name
> << " is " << directory[name] << "Ün";
>
> return octave_value();
> }
To follow my original post, using a simple type (a pointer) as a
global does work:
typedef map<string, long> Directory;
Directory *directory;
DEFUN_DLD (gg, args, ,"gg(str)Ün")
{
int nargin = args.length();
if (nargin != 1) {
error("one string argument only!");
return octave_value();
}
directory = new Directory;
(*directory)["Bogart"] = 1234567;
(*directory)["Bacall"] =
...
}
Strange.
--
Nimrod.
http://www.geocities.com/rodd_27
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------