In this small tutorial, we will learn how to use the Mutable Container (an efficient associative container) of the tulip API that enables :
A tradeoff between speed and memory.
To manage fragmented index
The direct access in this container is forbidden, but it exist a getter and a setter :
>::ConstValue MutableContainer<type>::get(const unsigned int i) const that returns a reference instead of a copy in order to minimize the number copy of objects, user must be aware that calling the set function can devalidate this reference
void MutableContainer<type>::set( const unsigned int i,const TYPE value).
The MutableContainer has two more methods :
void setAll (const TYPE value)
IteratorValue* findAll(const TYPE &value, bool equal = true) const
Following is a small example of its use :
//declaration of a new MutableContainer MutableContainer<int> t; //set all element to 0 t.setAll(0); //except element of index 1 set to 1. t.set(1,1); //display on standard output cout << t.get(1) << "and" << t.get(2) << endl;