Array,List,Map of pointers of an undefined structure

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
CSHW89
User
User
Posts: 30
Joined: Thu Sep 09, 2010 2:47 pm

Array,List,Map of pointers of an undefined structure

Post by CSHW89 »

It is possible to define a pointer in a structure with an undefined structure. Thereby you can define cycle structures:

Code: Select all

Structure Main
  *pointer.SubStruc
  *noerror.ANonexistentStruc
EndStructure

Structure SubStruc Extends Main
  foo.i
EndStructure

test.Main
test\pointer\foo = 2   ; it works, because the structure is subsequently defined
; test\noerror\bar = 3 ; clear, compiler error, an undefined structure is used
But why doesnt work this with arrays/lists/maps:

Code: Select all

Structure Main
  Array *a.SubStruc(1) ; compiler error
  List *b.SubStruc() ; compiler error
  Map *c.SubStruc() ; compiler error
EndStructure

Structure SubStruc Extends Main
  foo.i
EndStructure

test.Main
AddElement(test\b())
test\b()\foo = 2
Is it possible to transfer this behaviour to arrays/lists/maps?
Thanks
Kevin
Image Image Image