Hello Ben Becarisse,
Generics are supports by Object Pascal of Delphi and FreePascal
compilers, and what you are doing above with C++ is creating objects of
classes that supports generics, so you are passing <int>, that means you
are creating objects that has there elements of type "int"...
generics are also supported by Object Pascal of Delphi and FreePascal
compilers, so what you can do with Delphi and FreePascal is create
objects of datastructure that supports generics, in Delphi and
FreePascal we have for example TList datastructure that supports
generics..
So we create an Object of TList datastructure using generics as follow
in Object Pascal of the Delphi and FreePascal compilers:
var
Item: Integer;
[1] List: TList<Integer>;
....
[2] for Item in List do
Writeln(Item);
As in C++, in the Object Pascal code above, notice that in [1] we are
creating and object of class Tlist that supports generics, and in [2],
like in C++, we are using the "for" loop to go through
the elements of the Tlist, this will work with the Object Pascal of the
Delphi and FreePascal compilers.. and you can easily find libraries of
Object Pascal in internet that supports classes that supports generics
and you can do the same as you are doing with C++...so as you have
noticed the Object Pascal of the Delphi and FreePascal are powerful,
they can support generics, and they even support also Lambda expressions
to express more your program in a functional manner ...