Click to See Complete Forum and Search --> : STL-like stuff in languages other than C++


Hobson
March 4th, 2006, 07:23 AM
Hello everybody

I am a programmer and as my 'professional hobby' (you know, thing which makes you think that you like your job) I chose programming with C++. I try to study various apects of it, and master my C++ skills as much as possible. I am finding a lot of things in C++ very useful, and one of such things is STL and templates. Standards containers and algorithms are very helpful and make my life easier. However, not always I am allowed to use C++. Sometimes customer says: 'I want to have it done with Delphi' or something like that. Then I have to dig through tons of docs, web samples, etc to find answers 'how to do this' and 'how to do that', and sometimes cannot find an answer for a long time. So I wanted to ask you all:

Are there any routines already included in most commonly used object languages (like Java, C#, Delphi, VB) which let me do things that STL does? I especially mean two containers (like std::vector and std::map, and I know that these are available when using Java) and algorithms like searching, removing(both by value and user-defined predictate), sorting, accumulating, and maybe some more. I am more or less familiar with all above languages, but it often turns out that I do not know how to do something.

Thanks for any help
Hob

Yves M
March 5th, 2006, 11:18 PM
In C# you also have containers like vector, string, map etc. With .NET 2.0 you actually have generics which are somewhat like C++ templates, so the containers are quite fast. The only drawback is that writing generic algorithms in C# is not quite as well supported as in C++.

VB.NET has the same containers as C# but no generics. Not sure about the performance differences though.

In VB6, you can use COM objects like collections (from the Scripting Runtime), which basically include a hashed map and a hashed set. For any container you're missing you actually *could* implement it in C++ as a COM object and then call it from VB. I've done a few things this way (sorted map, list, introsort) if there wasn't any better way of doing it.

I've not touched Delphi for something like 10 years, so I don't have a clue about it :/