Reference » Collections and iterators

Collections and iterators


All collections (data structures) and their iterators (objects that reveal and modify the data in a collection).


Name Description
Collection Generic collection (pseudo-class).
MHash Linear unordered collection with exceptionally fast insertions and removals.
MImage 2D matrix collection (of fixed size) of colored pixels.
MList Linear ordered collection, similar to MVector, but with more flexible insert/remove.
MMap Linear unordered collection that defines a 1-to-1 key-to-value relation.
MSortList Linear ordered collection with automatic sorting capability.
MString Linear ordered collection of MChar (Unicode-16) elements.
MVector Linear ordered collection.
MWidthList Linear ordered collection of abstract "widths" with O(lgn) insert/remove complexity.


A collection is an object, which contains a variable number of other objects (items) of a certain type. Items can be collections too.

Iterators are special objects that can reveal or modify the content of a collection.

Collections organize similar objects for a convenient and efficient usage. A collection is empty if it contains zero items. The number of items is limited only by the available memory.

Elgrint defines 8 types of collections, as seen above (the generic Collection is not a real class). Two of these (MString and MImage) contain items of a predefined type (MChar and MColor respectively). The rest are templates, which can contain items of almost any type.

Each collection has its own unique qualities, which make it most suitable for specific kind of tasks. Choosing not the most suitable collection for each task may result in poor performance.

Each collection type (except for MString) has one or more corresponding iterators to navigate within the collection. Iterator objects are instances of iterator classes, which are child classes of the corresponding collections.

Iterators can be of two kinds - constant (Collection::CIter) and non-constant (Collection::Iter). Constant iterators cannot modify the collection content. It is recommended to use constant iterators whenever possible - they are safer and sometimes more efficient.


Let us know

Please Contact us to report any errors on this page, or to suggest any improvements.

Miranor Home | About Miranor | About Elgrint | Create account | Login | Account settings | Contact Us | Privacy Policy | Site map

© Copyright 2014 by Miranor. All rights reserved. By using this site you agree to the Terms of Use.

Page last updated on August 10th, 2014.