Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

VectorMap

 

template <class K, class T, class HashFn = StdHash<K> >

class VectorMap : public MoveableAndDeepCopyOption<VectorMap<K, T, HashFn> >, public AMap< K, T, Vector<T>, HashFn > 

 

K

Type of keys. K must have deep copy constructor, be moveable and must have operator== defined.

T

Type of elements stored in Vector. T is required to be moveable and must have either deep copy constructor, pick constructor or default constructor.

HashFn

Hashing class. Must have defined unsigned operator()(const K& x) method returning hash value for elements.

 

Vector flavor of map. Inherits most of its functionality from AMap and adds only members specific for its flavor.

Like any other NTL container, VectorMap is moveable type with pick and optional deep copy transfer semantics. Calling methods of picked VectorMap is logic error with exception of:

 

void operator=(pick_ VectorMap& v) (defined by composition)

void operator<<=(const AMap& v) (defined in AMap)

void Clear()

bool IsPicked() const

 

Optional deep copy operator is inherited from AMap class. Pick operator is implicitly defined by composition.

 

 

Constructor Detail

 

VectorMap()

Default constructor. Constructs empty VectorMap.

 


 

VectorMap(std::initializer_list<std::pair<K, T>> init)

C++ 11 initialization.

 


 

VectorMap& operator()(const K& k, const T& v)

Same as Add(k, v), returns *this. Syntax sugar for creating map.

 


 

VectorMap(const VectorMap& s, int)

Optional deep copy constructor.

Requires T to have deep copy constructor or optional deep copy constructor.

s

Source VectorMap.

 


 

VectorMap(pick_ Index<K, HashFn>& ndx, pick_ Vector<T>& val)

Pick-constructs VectorMap from Index of keys and Vector of values. Both source containers should have the same number of elements.

ndx

Source Index.

val

Source Vector.

 


 

VectorMap(pick_ Vector<K>& ndx, pick_ Vector<T>& val)

Pick-constructs VectorMap from Vector of keys and Vector of values. Both source containers should have the same number of elements.

ndx

Source Vector of keys.

val

Source Vector of values.

 

 

Public Member List

 

T Pop()

Drops last element of VectorMap and returns its value.

Return value

Value of dropped element.

 

 

Last edit by cxl on 07/02/2016. Do you want to contribute?. T++