fb vector equivalent?
fb vector equivalent?
In some c++ source files, I've seen this include statement:
#include <vector>
Is there and FB equivalent for this?
#include <vector>
Is there and FB equivalent for this?
-
- Posts: 5494
- Joined: Sep 12, 2005 20:06
- Location: California
-
- Posts: 5494
- Joined: Sep 12, 2005 20:06
- Location: California
We have an Array implementation that is very similiar to c++ vectors in ext. It works with all built-in numerical types (maybe strings too, haven't checked) and it should easily work with a UDT also. Check the thread in Projects or see: http://fb-extended-lib.googlecode.com for more details.
We use more BASIC friendly terminology so a STL::Vector is ext.Array, we do have a set of Math vectors ext.math.vector2/3/4d and also an OpenGL compatible matrix class. Here: http://fb-extended-lib.googlecode.com/s ... rotate.bas is one of the examples Dr_D wrote to demonstrate using them.
-
- Posts: 5494
- Joined: Sep 12, 2005 20:06
- Location: California
here's as close as I've come to figuring out how these work
Code: Select all
#include once "ext/containers/array.bi"
var foo = FBEXT_ARRAY(integer)()
foo.PushBack(&hdeadbeef)
foo.PushBack(&hcafebabe)
? hex(*foo.Front())
? hex(*foo.Back())
for standard internal types that works, but not for udt's:
Code: Select all
#include once "ext/containers/array.bi"
type test
a as integer
b as string
end type
var t = FBEXT_ARRAY(test)()
Code: Select all
FbTemp.bas(8) error 8: Undefined symbol, Arraytest in 'var t = FBEXT_ARRAY(test)()'
FbTemp.bas(8) warning 12(0): Implicit variable allocation, Arraytest