Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Pascal

Idiom #170 Get map size

Set n to the number of elements stored in mymap.

This is not always equal to the map capacity.

uses fgl;
n := MyMap.Count;

Map is not a native Pascal type.
The fgl unit defines several generic prototypes for maps.
All of which have a Count property.
(def n (count mymap))

New implementation...
< >
programming-idioms.org