algorithm.h File Reference
#include <algorithm>
#include <map>
#include <unordered_map>
#include <numeric>
#include <vector>
#include "TemplateMetaProgramming.h"
+ Include dependency graph for algorithm.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 armarx
 This file offers overloads of toIce() and fromIce() functions for STL container types.
 
 std
 

Enumerations

enum  MergeMapsMode { OverrideOldValues, KeepOldValues, OverrideNoValues }
 

Functions

template<class ContainerType , class ElementType >
bool Contains (const ContainerType &container, const ElementType &searchElement)
 
template<class ContainerT , class IndexContainerT , class IndexT = typename IndexContainerT::value_type>
std::vector< typename ContainerT::value_type > copyValuesAt (const ContainerT &src, const IndexContainerT &idx)
 Uses the container of indices to copy values (accessed via src.at()) from the given container into a vector and returns his vector. More...
 
template<class ContainerT , class IndexContainerT , class OutputIteratorT , class IndexT = typename IndexContainerT::value_type>
void copyValuesAt (const ContainerT &src, const IndexContainerT &idx, OutputIteratorT dest)
 Uses the container of indices to copy values (accessed via src.at())from the given container into the output iterator. More...
 
template<class ContainerT , class IndexIteratorT , class IndexT = typename std::iterator_traits<IndexIteratorT>::value_type>
std::vector< typename ContainerT::value_type > copyValuesAt (const ContainerT &src, IndexIteratorT fst, IndexIteratorT lst)
 Uses the range of indices to copy values (accessed via src.at())from the given container into a vector and returns his vector. More...
 
template<class ContainerT , class IndexIteratorT , class OutputIteratorT , class IndexT = typename std::iterator_traits<IndexIteratorT>::value_type>
void copyValuesAt (const ContainerT &src, IndexIteratorT fst, IndexIteratorT lst, OutputIteratorT dest)
 Uses the range of indices to copy values (accessed via src.at())from the given container into the output iterator. More...
 
template<class KeyT , class ValT >
std::vector< KeyT > getIndices (const std::map< KeyT, ValT > &c)
 
template<class KeyT , class ValT >
std::vector< KeyT > getIndices (const std::unordered_map< KeyT, ValT > &c)
 
template<class ValT >
std::vector< std::size_t > getIndices (const std::vector< ValT > &c)
 
template<class MapType >
std::vector< typename MapType::key_type > getMapKeys (const MapType &map)
 
template<class MapType , class OutputIteratorType >
void getMapKeys (const MapType &map, OutputIteratorType it)
 
template<class MapType , template< class... > class ContainerT = std::vector>
ContainerT< typename MapType::mapped_type > getMapValues (const MapType &map)
 
template<class MapType , class OutputIteratorType >
void getMapValues (const MapType &map, OutputIteratorType it)
 
void incrementAll ()
 Increment all given parameter using the pre-increment operator. More...
 
template<typename It0 , typename ... It>
void incrementAll (It0 &it0, It &...it)
 
template<class T , class... Ts>
bool isfinite (const std::vector< T, Ts... > &v)
 
template<typename T >
void mergeMaps (T &oldMap, const T &newMap, MergeMapsMode mergeMode=MergeMapsMode::OverrideOldValues)
 Inserts and overwrites the values from oldMap with the values from newMap. More...
 
template<class T >
T sign (T t)
 
template<class T , class MapType = std::unordered_map<typename T::value_type, typename T::size_type>>
MapType toIndexMap (const T &vec)
 This function takes a container (e.g. More...
 
template<class OutputT , class InputT , typename Alloc , template< class, class > class Container>
auto transform (const Container< InputT, Alloc > &in, OutputT(*func)(InputT const &)) -> Container< OutputT, typename std::allocator_traits< Alloc >::template rebind_alloc< OutputT > >
 Convenience function (with less typing) to transform a container of type InputT into the same container type of type OutputT. More...
 
template<class MapInT , class TransformT , class MapOutT = MapInT>
void transformMapKeys (const MapInT &inMap, MapOutT &outMap, TransformT transform)
 
template<class MapInT , class TransformT , class MapOutT = MapInT>
MapOutT transformMapKeys (const MapInT &inMap, TransformT transform)