Simox  2.3.74.0
simox::alg Namespace Reference

Functions

decltype(auto) advanced (auto &&it, auto n)
 
template<typename ValueIn , typename UnaryOp >
std::vector< std::invoke_result_t< UnaryOp, ValueIn > > apply (const std::vector< ValueIn > &vector, const UnaryOp &op)
 
template<typename ValueIn , typename UnaryOp >
std::vector< std::invoke_result_t< UnaryOp, ValueIn > > apply (const std::set< ValueIn > &set, const UnaryOp &op)
 
template<typename Key , typename ValueIn , typename UnaryOp >
std::map< Key, std::invoke_result_t< UnaryOp, ValueIn > > apply (const std::map< Key, ValueIn > &map, const UnaryOp &op)
 
template<class ContainerT , class ValueT >
bool contains (const ContainerT &container, const ValueT &value)
 
template<class ContainerT , class ValueT , class PredicateT >
bool contains (const ContainerT &container, const ValueT &value, const PredicateT &predicate)
 
template<class K , class V , template< class... > class MapT = std::map, class... Ts>
bool contains_key (const MapT< K, V, Ts... > &map, const K &key)
 
template<class K , class V , template< class... > class MapT = std::map, class... Ts>
bool contains_value (const MapT< K, V, Ts... > &map, const V &value)
 
template<class V , template< class... > class MapT = std::map, class... Ts>
bool contains_key (const MapT< std::string, V, Ts... > &map, const std::string &key)
 
template<class K , template< class... > class MapT = std::map, class... Ts>
bool contains_value (const MapT< K, std::string, Ts... > &map, const std::string &value)
 
template<class ContT , class GetKey >
decltype(auto) fuzzy_find (ContT &cont, meta::key_type_t< ContT > key, meta::key_type_t< ContT > accuracy, GetKey get_key)
 
template<class ContT >
decltype(auto) fuzzy_find (ContT &cont, meta::key_type_t< ContT > key, meta::key_type_t< ContT > accuracy)
 
template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::vector< K > get_keys (const MapT< K, V, Ts... > &map)
 Get the keys of an associative container, a vector of key-value pairs, ... More...
 
template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::set< K > get_keys_set (const MapT< K, V, Ts... > &map)
 Get the keys of map in a set. More...
 
template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::vector< V > get_values (const MapT< K, V, Ts... > &map)
 Get the values of map. More...
 
template<class ValueFn , class K , class V , template< class... > class MapT = std::map, class... Ts>
auto get_values (const MapT< K, V, Ts... > &map, ValueFn value_fn)
 Get the results of applying value_fn to the values of map. More...
 
template<class ValueFn , class K , class V , template< class... > class MapT = std::map, class... Ts>
auto get_values (MapT< K, V, Ts... > &map, ValueFn value_fn)
 Get the results of applying value_fn to the values of map. More...
 
template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::vector< const V * > get_value_ptrs (const MapT< K, V, Ts... > &map)
 Get the (const) pointers to the values of (const) map. More...
 
template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::vector< V * > get_value_ptrs (MapT< K, V, Ts... > &map)
 Get the (non-const) pointers to the values of (non-const) map. More...
 
template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::vector< const V * > get_value_cptrs (MapT< K, V, Ts... > &map)
 Get the const pointers to the values of map. More...
 
template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::vector< const V * > get_value_cptrs (const MapT< K, V, Ts... > &map)
 Get the const pointers to the values of map. More...
 
template<class K , class V , template< class... > class MapT = std::map, class... Ts>
get_value_or_default (const MapT< K, V, Ts... > &map, const K &key, const V &default_value)
 Get a value from map if it exsits or a default value otherwise. More...
 
template<class K , template< class... > class MapT = std::map, class... Ts>
std::string get_value_or_default (const MapT< K, std::string, Ts... > &map, const K &key, const std::string &default_value)
 
template<class T , class Scalar >
std::function< bool(const T &, const T &)> get_compare_fn (const std::function< Scalar(const T &)> unaryFunc)
 Return a function comparing the results of applying unaryFunc to values of type T. More...
 
template<class T , class Scalar >
Scalar min (const std::vector< T > &values, std::function< Scalar(const T &)> unaryFunc)
 Get the maximum of applying unaryFunc to values. More...
 
template<class T , class Scalar >
Scalar max (const std::vector< T > &values, std::function< Scalar(const T &)> unaryFunc)
 Get the maximum of applying unaryFunc to values More...
 
template<class T , class Scalar >
std::pair< Scalar, Scalar > minmax (const std::vector< T > &values, std::function< Scalar(const T &)> unaryFunc)
 Get minimum and maximum of applying unaryFunc to values More...
 
template<typename TypeT >
bool contains (const std::vector< TypeT > &haystack, const TypeT &needle)
 
template<typename TypeT >
std::vector< TypeT > appended (const std::vector< TypeT > &v1, const std::vector< TypeT > &v2)
 
template<typename TypeT >
std::vector< TypeT > & append (std::vector< TypeT > &v1, const std::vector< TypeT > &v2)
 
template<typename TypeT >
std::vector< TypeT > subvector (const std::vector< TypeT > &v, int startPos, int endPos)
 
template<typename TypeT >
std::vector< TypeT > subvector (const std::vector< TypeT > &v, int startPos)
 
template<typename TypeT >
bool startsWith (const std::vector< TypeT > &input, const std::vector< TypeT > &search)
 
template<typename TypeT >
bool endsWith (const std::vector< TypeT > &input, const std::vector< TypeT > &search)
 

Function Documentation

◆ advanced()

decltype(auto) simox::alg::advanced ( auto &&  it,
auto  n 
)

◆ append()

template<typename TypeT >
std::vector<TypeT>& simox::alg::append ( std::vector< TypeT > &  v1,
const std::vector< TypeT > &  v2 
)

◆ appended()

template<typename TypeT >
std::vector<TypeT> simox::alg::appended ( const std::vector< TypeT > &  v1,
const std::vector< TypeT > &  v2 
)

◆ apply() [1/3]

template<typename ValueIn , typename UnaryOp >
std::vector<std::invoke_result_t<UnaryOp, ValueIn> > simox::alg::apply ( const std::vector< ValueIn > &  vector,
const UnaryOp &  op 
)

◆ apply() [2/3]

template<typename ValueIn , typename UnaryOp >
std::vector<std::invoke_result_t<UnaryOp, ValueIn> > simox::alg::apply ( const std::set< ValueIn > &  set,
const UnaryOp &  op 
)

◆ apply() [3/3]

template<typename Key , typename ValueIn , typename UnaryOp >
std::map<Key, std::invoke_result_t<UnaryOp, ValueIn> > simox::alg::apply ( const std::map< Key, ValueIn > &  map,
const UnaryOp &  op 
)

◆ contains() [1/3]

template<typename TypeT >
bool simox::alg::contains ( const std::vector< TypeT > &  haystack,
const TypeT &  needle 
)

◆ contains() [2/3]

template<class ContainerT , class ValueT >
bool simox::alg::contains ( const ContainerT &  container,
const ValueT &  value 
)

Return true if value is an element of container, false otherwise.

◆ contains() [3/3]

template<class ContainerT , class ValueT , class PredicateT >
bool simox::alg::contains ( const ContainerT &  container,
const ValueT &  value,
const PredicateT &  predicate 
)

Return true if value is an element of container (as indicated by predicate), false otherwise.

◆ contains_key() [1/2]

template<class K , class V , template< class... > class MapT = std::map, class... Ts>
bool simox::alg::contains_key ( const MapT< K, V, Ts... > &  map,
const K &  key 
)

Return true if key is a key in map, false otherwise.

◆ contains_key() [2/2]

template<class V , template< class... > class MapT = std::map, class... Ts>
bool simox::alg::contains_key ( const MapT< std::string, V, Ts... > &  map,
const std::string &  key 
)

◆ contains_value() [1/2]

template<class K , class V , template< class... > class MapT = std::map, class... Ts>
bool simox::alg::contains_value ( const MapT< K, V, Ts... > &  map,
const V &  value 
)

Return true if value is a value in map, false otherwise.

◆ contains_value() [2/2]

template<class K , template< class... > class MapT = std::map, class... Ts>
bool simox::alg::contains_value ( const MapT< K, std::string, Ts... > &  map,
const std::string &  value 
)

◆ endsWith()

template<typename TypeT >
bool simox::alg::endsWith ( const std::vector< TypeT > &  input,
const std::vector< TypeT > &  search 
)

◆ fuzzy_find() [1/2]

template<class ContT , class GetKey >
decltype(auto) simox::alg::fuzzy_find ( ContT &  cont,
meta::key_type_t< ContT >  key,
meta::key_type_t< ContT >  accuracy,
GetKey  get_key 
)
inline

◆ fuzzy_find() [2/2]

template<class ContT >
decltype(auto) simox::alg::fuzzy_find ( ContT &  cont,
meta::key_type_t< ContT >  key,
meta::key_type_t< ContT >  accuracy 
)
inline

◆ get_compare_fn()

template<class T , class Scalar >
std::function<bool(const T&, const T&)> simox::alg::get_compare_fn ( const std::function< Scalar(const T &)>  unaryFunc)

Return a function comparing the results of applying unaryFunc to values of type T.

◆ get_keys()

template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::vector<K> simox::alg::get_keys ( const MapT< K, V, Ts... > &  map)

Get the keys of an associative container, a vector of key-value pairs, ...

◆ get_keys_set()

template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::set<K> simox::alg::get_keys_set ( const MapT< K, V, Ts... > &  map)

Get the keys of map in a set.

◆ get_value_cptrs() [1/2]

template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::vector<const V*> simox::alg::get_value_cptrs ( MapT< K, V, Ts... > &  map)

Get the const pointers to the values of map.

◆ get_value_cptrs() [2/2]

template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::vector<const V*> simox::alg::get_value_cptrs ( const MapT< K, V, Ts... > &  map)

Get the const pointers to the values of map.

◆ get_value_or_default() [1/2]

template<class K , class V , template< class... > class MapT = std::map, class... Ts>
V simox::alg::get_value_or_default ( const MapT< K, V, Ts... > &  map,
const K &  key,
const V &  default_value 
)

Get a value from map if it exsits or a default value otherwise.

◆ get_value_or_default() [2/2]

template<class K , template< class... > class MapT = std::map, class... Ts>
std::string simox::alg::get_value_or_default ( const MapT< K, std::string, Ts... > &  map,
const K &  key,
const std::string &  default_value 
)

◆ get_value_ptrs() [1/2]

template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::vector<const V*> simox::alg::get_value_ptrs ( const MapT< K, V, Ts... > &  map)

Get the (const) pointers to the values of (const) map.

◆ get_value_ptrs() [2/2]

template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::vector<V*> simox::alg::get_value_ptrs ( MapT< K, V, Ts... > &  map)

Get the (non-const) pointers to the values of (non-const) map.

◆ get_values() [1/3]

template<class K , class V , template< class... > class MapT = std::map, class... Ts>
std::vector<V> simox::alg::get_values ( const MapT< K, V, Ts... > &  map)

Get the values of map.

◆ get_values() [2/3]

template<class ValueFn , class K , class V , template< class... > class MapT = std::map, class... Ts>
auto simox::alg::get_values ( const MapT< K, V, Ts... > &  map,
ValueFn  value_fn 
)

Get the results of applying value_fn to the values of map.

◆ get_values() [3/3]

template<class ValueFn , class K , class V , template< class... > class MapT = std::map, class... Ts>
auto simox::alg::get_values ( MapT< K, V, Ts... > &  map,
ValueFn  value_fn 
)

Get the results of applying value_fn to the values of map.

◆ max()

template<class T , class Scalar >
Scalar simox::alg::max ( const std::vector< T > &  values,
std::function< Scalar(const T &)>  unaryFunc 
)

Get the maximum of applying unaryFunc to values

◆ min()

template<class T , class Scalar >
Scalar simox::alg::min ( const std::vector< T > &  values,
std::function< Scalar(const T &)>  unaryFunc 
)

Get the maximum of applying unaryFunc to values.

◆ minmax()

template<class T , class Scalar >
std::pair<Scalar, Scalar> simox::alg::minmax ( const std::vector< T > &  values,
std::function< Scalar(const T &)>  unaryFunc 
)

Get minimum and maximum of applying unaryFunc to values

◆ startsWith()

template<typename TypeT >
bool simox::alg::startsWith ( const std::vector< TypeT > &  input,
const std::vector< TypeT > &  search 
)

◆ subvector() [1/2]

template<typename TypeT >
std::vector<TypeT> simox::alg::subvector ( const std::vector< TypeT > &  v,
int  startPos,
int  endPos 
)

◆ subvector() [2/2]

template<typename TypeT >
std::vector<TypeT> simox::alg::subvector ( const std::vector< TypeT > &  v,
int  startPos 
)