This is a template function optimized for searching integer types (internal use only).

template<class VectorValues, class PosType> inline std::vector<PosType> Match(VectorValues const& x, VectorValues const& table, PosType const& NA);

For each element of x return the index of its first occurence in table or NA if the element is not found in table or is equal to NA. It is assumed that x does not have duplicated elements or NA elements.

The template argument VectorValues must be an index-able class, such as std::vector<T>, where T must be an integer type. The template argument PosType must be an integer type that can be used as index type in VectorValues.

Arguments

x

VectorValues const& of values to search for in table. This vector should not have duplicates or NAs.

table

VectorValues const& of (possibly duplicated) values to matched against the elements in x.

NA

PosType const& an integer type that can be used as index-type in x and table.

Value

an std::vector<PosType>.

See also