Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Dynamic Data

In ELM, you can use usual data structure based on the template approach (as in STL) but also data structure that works in the same way as in Java language based on interfaces and virtual function calls. This enables to use data structures implementing the same interface independently of their actual type. However, notice that, if dynamic structure are more flexible than generic data structure, they are also slower. More...

Classes

class  AbstractCollection< T >
 
class  MutableAbstractCollection< T >
 
class  AbstractIter< T >
 
class  Iter< T >
 
class  Collection< T, C >
 
class  MutableCollection< T, C >
 
class  IterInst< T, I >
 

Functions

template<class T , class I >
IterInst< T, I > * iter (const I &i)
 

Detailed Description

In ELM, you can use usual data structure based on the template approach (as in STL) but also data structure that works in the same way as in Java language based on interfaces and virtual function calls. This enables to use data structures implementing the same interface independently of their actual type. However, notice that, if dynamic structure are more flexible than generic data structure, they are also slower.

To handle collections, there are 3 classes providing the interface:

Additionally, to support allocated operator easily, the class Iter receives an iterator from AbstractCollection, behave like an iterator wrapped around the AbstractIter and is in charge of deleting it at the end.

Dynamic data structure are easily derived from generic data structures using the classes Collection or InstIter. Below is an example of the use of the iterator:

int count(const AbstractCollection<T>& coll) {
int c = 0;
for(Iter i(coll->iterator()); i; i++)
c++;
return c;
}

Function Documentation

◆ iter()

IterInst< T, I > * iter ( const I &  i)
inline

#include <include/elm/dyndata/Collection.h>

Build a Dynamic Data iterator from a generic iterator.

Parameters
iGeneric iterator.
TType of iterated values.
IType of the iterator.
elm::count
int count(const C &c, const P &p)
Definition: util.h:65