C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2
sorting_array< KeyType, _Pr > Class Template Reference

Dynamic container for storing elements of an ordered set. More...

#include <generic_utility.h>

+ Inheritance diagram for sorting_array< KeyType, _Pr >:

Detailed Description

template<class KeyType, class _Pr = std::less<KeyType>>
class sorting_array< KeyType, _Pr >

Dynamic container for storing elements of an ordered set.

Type of container element must have order operators. Do not confuse this type of container with a set or map. It is not obliged always be supported in a sorted state, and only when it is needed (with caching of sorting algorithm). It is guaranteed that the vector is sorted immediately after the function call get_sorted or sort. Const methods and the erase method does not break sorting.

About efficiency
Often sorted vector is more effective than std::map or std::set especially when adding/removing elements of the array is standard and is rarely interspersed with queries quickly (binary) search of element or its place by
the order. In contrast to the map or set minimal defragmented memory and does not require excess information for storage of pointers
(can occupy memory in less than 4 times). For fast queries, can use standard algorithms such as std::binary_search, std::lower_bound etc.

The documentation for this class was generated from the following file: