What's equivalent of std::vector
, std::deque
and std::map
in ObjectPascal (FreePascal compiler)?
In brief:
(vector) is an auto-resizing contiguous array
(deque) is an auto-sizing hybrid array of arrays giving near O(1) random access while allowing O(1) push/pop from either end
(map, unordered_map) is an associative array
In general it is not logical to assume there are direct substitutes in some different language.
Currently FPC generics are a mix of old school C++ like generics (based on token replay), and Delphi more .NET styled generics (fully declarative, but more limited for value types for languages without autoboxing).
Anyway, I'll give it a try:
There is also some generics including a simple deque in packages/fcl-stl, I suggest you check it out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With