quote:Original post by Anonymous Poster
There was a post on Turbo that described a way to do template-like things using Interfaces in Delphi. I''ll dig up the link later (tomorrow, because it''s time for me bed), unless Sly beats me to it, but rest assured it''s possible.
Yes I will beat you to it. Here''s the link
Templates in Object Pascal
Mind you, they are only simulating templates and they do not support all the features of C++ templates. They are also a bit messier to setup.
quote:NuffSaid: I think you can just say:
procedure Stuff(a: array of Integer);
begin
{ use High() to get upper bounds of a, zero-based }
end;
This should work for any array. It''s called Open Arrays, and is handled differently from Dynamic Arrays (which use exactly the same syntax, just out of a procedure).
Use Low() for the lower bounds of the array instead of assuming it is zero. You could also pass a pointer to the first element and a count and do pointer arithmetic just like in C.
In my various projects I use a mixture of Delphi and C/C++, sometimes both in the same project. As grasshopa55 said, speed of compiled is not really an issue today unless you are an absolute optimization freak wanting the highest performance possible.
Note that I am typing this while waiting for the PS2 version of our game to build. We get an average of about 15 minutes per rebuild using a GNU C++ compiler.
Steve ''Sly'' Williams Monkey Wrangler Krome Studios