Ooops
May 31, 2020, 09:06:42 PM

Author Topic: ArrayList doesn't like Struct  (Read 124 times)

Offline medi71

  • Jr. Member
  • **
  • Posts: 28
ArrayList doesn't like Struct
« on: April 28, 2020, 09:03:30 PM »
It seems TArrayList, doesn't like Struct.
Code: [Select]
SuperStrict

Framework brl.collections
Import brl.standardio
Import brl.Vector

Type MyType
Field m:Int
Field n:Int
End Type

Local a:TArrayList<String> = New TArrayList<String>
Local b:TArrayList<MyType> = New TArrayList<MyType>
Local c:TArrayList<SVec3F> = New TArrayList<SVec3F>

I get :
Quote
Building untitled1
[ 84%] Processing:untitled1.bmx
Compile Error: No overloaded operator '=' found for SVec3F
[C:/Users/msara/Desktop/BlitzMax_win32_x64_0.120.3.41/BlitzMax/mod/brl.mod/collections.mod/list.bmx;146;0]
Build Error: failed to compile (-1) C:/BlitzMaxNG/tmp/untitled1.bmx
Process complete
Is this the way supposed to be in NG?
The same for the TList:
Code: [Select]
SuperStrict

Framework Brl.LinkedList
Import Brl.StandardIO
Import brl.Vector

Local list:TList = CreateList()

Type MyType
Field a:Int
Field b:Int
End Type

Local x:MyType = New MyType
x.a = 89
x.b = 458

ListAddFirst(list, x)
For Local m:MyType = EachIn list
Print m.a
Print m.b
Next '--------- OK so far --------------

Struct MyStruct
Field a:Int
Field b:Int
End Struct

Local s:MyStruct = New MyStruct
s.a = 89
s.b = 458

ListAddFirst(list, s) ''--------- No Struct? --------------
For Local m:MyType = EachIn list
Print m.a
Print m.b
Next
'-----------------------
the same here, as SVec3F is struct
Local vector_list:TList = CreateList()
Local v1:SVec3F = New SVec3F(45,35,8)
Local v2:SVec3F = New SVec3F(145,305,81)
ListAddFirst(vector_list, v1)
ListAddFirst(vector_list, v2)
For Local v:vector_list = EachIn list
Print v.y
Next

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal