[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Array of structures.
- Subject: Re: Array of structures.
- From: Ben Tupper <tupper(at)seadas.bigelow.org>
- Date: Tue, 16 May 2000 08:51:45 -0400
- Newsgroups: comp.lang.idl-pvwave
- Organization: Bigelow Laboratory for Ocean Sciences
- References: <39213931.B1AC6563@Noveltis.fr>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:19612
Nicolas Decoster wrote:
> Hi.
>
> I'd like to build an array of structure using one line. Something like
> that:
>
> arr = [{sig:a, color:'red'}, {sig:b, color:'green'}]
>
> I don't want to use the replicate function and then fill the array one
> by one:
>
> arr = replicate({myStruct, sig:a, color:'red'}, 2)
> arr[0] = {myStruct, sig:a, color:'red'}
> arr[1] = {myStruct, sig:b, color:'green'}
>
> Any suggestions ?
>
> Thanks.
>
> Nicolas.
>
> ps: In fact, I'm trying to find a way to handle lists of anything. In
> the present case I want to pass as one argument a list of signals
> (arrays of value) associated with a color. The list must be of any size,
> we must be able to build it on the fly. Something like that : {{sig1
> 'red'} {sig2 'green'}} in a Tcl-like syntax.
>
>
Hello,
I think you should look into employing a pointer array. Each element of
the pointer array can point to anything (like structures, etc.)
Look into PTRARR() function.
Ben
--
Ben Tupper
Bigelow Laboratory for Ocean Science
tupper@seadas.bigelow.org
pemaquidriver@tidewater.net