Yes it does seem to work( or at least I have made it work :)), but only
under the following conditions.
1) You specifically seperate the individual structures with the curly
brackets e.g.
MyStruct[]={{1,2},
                     {3,4},
                     {5,6}};
2) All user defined types appear at the end of your structure.
3) You dont't compile it under MSVC++6. It somehow can't handle it, it says:
    No constructor could take the source type, or constructor overload
resolution was ambiguous.
And yet the metrowerks compiler doesn't complain at all.



----- Original Message -----
From: "Garth Watkins" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Monday, November 20, 2000 6:47 PM
Subject: Initializing array of objects in declaration


> Hi
>
> Initializing an array of structures that contain only the built in types
> seems pretty straightforward e.g.
> typedef struct {
>                         int x;
>                         int y;
>                         int z;
>                         }FooType;
> FooType foo[3]={1,2,3,
>                              4,5,6,
>                              7,8,9};
> but I have a structure that contains a few user-defined types e.g
> typedef struct {
>                         int x;
>                         int y;
>                         MyClass mc;
>                         } MyStruct;
> I now want to intialize an array of MyStruct structs, in the declaration
of
> this array.
> e.g.
> MyStruct[]={1,2,?,
>                     3,4,?,
>                     4,5,?};
>
> Is this possible in C++
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
>


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to