template <class K, class T, class Less = StdLess<K> >
class SortedVectorMap : public MoveableAndDeepCopyOption<SortedVectorMap<K, T, Less> >, public SortedAMap<K, T, Less, Slaved_InVector__<T> >
Vector flavor of SortedAMap. It has default pick transfer semantics with optional deep-copy. It is Moveable. Both keys and values have to be Moveable.
T& Add(const K& k, const T& x)
T& Add(const K& k, T&& x)
Inserts a copy of key-value pair at upper bound key position and returns reference to element value.
T& Add(const K& k)
Inserts the key at upper bound key position and returns reference to the default constructed value at the same index.
int FindAdd(const K& k)
If key k is present, returns index of its lower-bound position. If not, inserts it at upper-bound position and returns its index (value of element is default-constructed).
int FindAdd(const K& k, const T& init)
If key k is present, returns index of its lower-bound position. If not, inserts it at upper-bound position with value of element copy-constructed from init and returns its index.
T& GetAdd(const K& k)
If key k is present, returns reference of value at its lower-bound position. If not, inserts it at upper-bound position and returns reference to coresponding value (value of element is default-constructed).
T& GetAdd(const K& k, const T& x)
If key k is present, returns reference of value at its lower-bound position. If not, inserts it at upper-bound position and returns reference to coresponding value, which is copy-constructed from x.
T Pop()
Drops the last element and returns its value.
SortedVectorMap& operator()(const K& k, const T& v)
Same as Add(k, v), returns *this. Syntax sugar for creating map.
SortedVectorMap(const SortedVectorMap& s, int)
Deep copy constructor.
SortedVectorMap(std::initializer_list<std::pair<K, T>> init)
C++ 11 initialization.
|