cxtream  0.5.1
C++17 data pipeline with Python bindings.
Classes | Functions
Bidirectional map between indices and values.

Classes

class  cxtream::index_mapper< T >
 Provides a bidirectional access from values to their indices in an std::vector. More...
 

Functions

template<typename Rng , typename T = ranges::range_value_type_t<Rng>>
index_mapper< T > cxtream::make_unique_index_mapper (Rng &&rng)
 Make index mapper from unique elements of a range. More...
 

Detailed Description

Function Documentation

◆ make_unique_index_mapper()

template<typename Rng , typename T = ranges::range_value_type_t<Rng>>
index_mapper<T> cxtream::make_unique_index_mapper ( Rng &&  rng)

Make index mapper from unique elements of a range.

Example:

std::vector<std::string> data = {"bum", "bada", "bum", "bum", "bada", "yeah!"};
index_mapper<std::string> mapper = make_unique_index_mapper(data);
// mapper.values() == {"bum", "bada", "yeah!"}
Parameters
rngThe range of values to be inserted.
Returns
The index mapper made of unique values of the range.

Definition at line 211 of file index_mapper.hpp.