![]() |
Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
|
Spatial provides 8 different containers, with the following characteristics:
value_type is also used as the key and it is stricly equivalent to key_type. It is also immutable.key_type is immutable, while the mapped_type can be mutated. value_type is made of std::pair<key_type, mapped_type>.rebalance(), which is only found in these containers.In addition to the differences above, all container share the same following properties:
value_types in memory, always.value_type, provided that value_compare can compare 2 distinct value types along the same dimension. See Trivial Comparison Concept.key_type and value_type is that they must be copy-constructible.value_type has been inserted in the container, its location in memory will not change, regardless of insertion or removal taking place the container. That means you can retain an iterator on an element of the container for as long as the container exists and as this element is not being removed from the container. Example: std::vector is not a stable container, while std::list is a stable container.
. Their iterators are bidirectional iterators and can be used in general STL algorithms. They are some notable differences: currently the Spatial containers do not provide a range erase function (and maybe, never will).If you are wondering which containers to use for which situation, the Quick Starting Guide provides an small guide to answer this question.
All containers in the library have the following generic interface:
| Member Function | Description | Complexity |
|---|---|---|
iterator insert(const value_type& value) | Insert a value_type value into the container. The value will be copied to its final memory destination in the container. | |
template <typename Iterator> void insert(Iterator first, Iterator last) | Insert a sequence of value in the container. Iterator should be a forward iterator. | for each inserted elements |
iterator find(const value_type& value) | Returns an iterator pointing to the one of the values that compare equivalently to value. If no value compares equivalently to value, end() is returned. | |
iterator begin() | Returns an iterator pointing to the beginning of the container for begin() and past-the-end for end(). This iterator can be used to iterate through all elements in the container. | |
std::size_t erase(const value_type& value) | Erase all values in the container that compare equivalently to value. Returns the number of values that where erased. | for each erased element |
void std::size_t erase(iterator iter) | Erase the value pointed to by iter in the container. | |
See each individual container for a more details explanation of their detailed interface: