algorithms.h File Reference

Classes

struct  IsIterable< T >
 
struct  IsIterable< T[N]>
 
struct  EqualityCompare< T1, T2 >
 
struct  LessThanCompare< T1, T2 >
 
struct  CopyImplSelector< false >
 
struct  CopyImplSelector< true >
 
class  Match< ITERATOR >
 
class  Match< Int >
 
struct  StaticSplitHelper< REMAINING_COUNT, I >
 
struct  StaticSplitHelper< 0, I >
 
struct  PredicateMatcher< PRED >
 
struct  ValuePredicate< T >
 
struct  ValueComparePredicate< T, COMPARE >
 
struct  RepeatingPredicateMatcher< PRED >
 
struct  SequenceMatcher< SEARCH_SEQ, COMPARE >
 

Namespaces

 maxon
 
 maxon::details
 

Typedefs

using IndexPair = Pair< Int, Int >
 

Enumerations

enum class  MOVE_MODE {
  KEEP_SOURCE ,
  DESTRUCT_SOURCE
}
 
enum class  NO_MATCH_TYPE { VALUE }
 

Functions

template<typename T >
std::false_type TestForBeginFunction (OverloadRank0)
 
template<typename T >
std::false_type TestForEndFunction (OverloadRank0)
 
template<typename ITERATOR , typename SENTINEL , typename ... ARGS, typename = typename std::enable_if<!IsIterable<ITERATOR>::value>::type>
auto ConstructElements (ITERATOR first, SENTINEL sentinel, const ARGS &... args) -> ITERATOR
 
template<typename ITERABLE , typename ... ARGS, typename = typename std::enable_if<IsIterable<ITERABLE>::value>::type>
auto ConstructElements (ITERABLE &&iterable, const ARGS &... args) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename SENTINEL , typename = typename std::enable_if<!IsIterable<ITERATOR>::value>::type>
auto DestructElements (ITERATOR first, SENTINEL sentinel) -> ITERATOR
 
template<typename ITERABLE , typename = typename std::enable_if<IsIterable<ITERABLE>::value>::type>
auto DestructElements (ITERABLE &&iterable) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename SENTINEL , typename DEST_ITERATOR >
auto Copy (ITERATOR first, SENTINEL sentinel, DEST_ITERATOR dest) -> Result< DEST_ITERATOR >
 
template<typename ITERABLE , typename DEST_ITERATOR >
auto Copy (const ITERABLE &iterable, DEST_ITERATOR dest) -> Result< DEST_ITERATOR >
 
template<typename ITERATOR , typename SENTINEL , typename DEST_ITERATOR , typename PREDICATE >
auto CopyIf (ITERATOR first, SENTINEL sentinel, DEST_ITERATOR dest, PREDICATE pred) -> Result< DEST_ITERATOR >
 
template<typename ITERABLE , typename DEST_ITERATOR , typename PREDICATE >
auto CopyIf (const ITERABLE &iterable, DEST_ITERATOR dest, PREDICATE pred) -> Result< DEST_ITERATOR >
 
template<typename ITERATOR , typename SENTINEL , typename DEST_ITERATOR >
auto CopyToUninitialized (ITERATOR first, SENTINEL sentinel, DEST_ITERATOR dest) -> Result< DEST_ITERATOR >
 
template<typename ITERABLE , typename DEST_ITERATOR >
auto CopyToUninitialized (const ITERABLE &iterable, DEST_ITERATOR dest) -> Result< DEST_ITERATOR >
 
template<typename ITERATOR , typename SENTINEL , typename DEST_ITERATOR , typename PREDICATE >
auto CopyToUninitializedIf (ITERATOR first, SENTINEL sentinel, DEST_ITERATOR dest, PREDICATE pred) -> Result< DEST_ITERATOR >
 
template<typename ITERABLE , typename DEST_ITERATOR , typename PREDICATE >
auto CopyToUninitializedIf (const ITERABLE &iterable, DEST_ITERATOR dest, PREDICATE pred) -> Result< DEST_ITERATOR >
 
enum maxon::MOVE_MODE MAXON_ENUM_LIST (MOVE_MODE)
 
template<MOVE_MODE MODE = MOVE_MODE::KEEP_SOURCE, typename ITERATOR , typename SENTINEL , typename DEST_ITERATOR >
auto Move (ITERATOR first, SENTINEL sentinel, DEST_ITERATOR dest) -> DEST_ITERATOR
 
template<MOVE_MODE MODE = MOVE_MODE::KEEP_SOURCE, typename ITERABLE , typename DEST_ITERATOR >
auto Move (ITERABLE &&iterable, DEST_ITERATOR dest) -> DEST_ITERATOR
 
template<MOVE_MODE MODE = MOVE_MODE::KEEP_SOURCE, typename ITERATOR , typename SENTINEL , typename DEST_ITERATOR , typename PREDICATE >
auto MoveIf (ITERATOR first, SENTINEL sentinel, DEST_ITERATOR dest, PREDICATE pred) -> DEST_ITERATOR
 
template<MOVE_MODE MODE = MOVE_MODE::KEEP_SOURCE, typename ITERABLE , typename DEST_ITERATOR , typename PREDICATE >
auto MoveIf (ITERABLE &&iterable, DEST_ITERATOR dest, PREDICATE pred) -> DEST_ITERATOR
 
template<MOVE_MODE MODE = MOVE_MODE::KEEP_SOURCE, typename ITERATOR , typename SENTINEL , typename DEST_ITERATOR >
auto MoveToUninitialized (ITERATOR first, SENTINEL sentinel, DEST_ITERATOR dest) -> DEST_ITERATOR
 
template<MOVE_MODE MODE = MOVE_MODE::KEEP_SOURCE, typename ITERABLE , typename DEST_ITERATOR >
auto MoveToUninitialized (ITERABLE &&iterable, DEST_ITERATOR dest) -> DEST_ITERATOR
 
template<MOVE_MODE MODE = MOVE_MODE::KEEP_SOURCE, typename ITERATOR , typename SENTINEL , typename DEST_ITERATOR , typename PREDICATE >
auto MoveToUninitializedIf (ITERATOR first, SENTINEL sentinel, DEST_ITERATOR dest, PREDICATE pred) -> DEST_ITERATOR
 
template<MOVE_MODE MODE = MOVE_MODE::KEEP_SOURCE, typename ITERABLE , typename DEST_ITERATOR , typename PREDICATE >
auto MoveToUninitializedIf (ITERABLE &&iterable, DEST_ITERATOR dest, PREDICATE pred) -> DEST_ITERATOR
 
template<typename ITERABLE , typename T >
auto Fill (ITERABLE &&iterable, const T &value) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename SENTINEL , typename GENERATOR >
auto Generate (ITERATOR first, SENTINEL sentinel, GENERATOR gen) -> ITERATOR
 
template<typename ITERABLE , typename GENERATOR >
auto Generate (ITERABLE &&iterable, GENERATOR gen) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename SENTINEL , typename PREDICATE >
Bool AllOf (ITERATOR first, SENTINEL sentinel, PREDICATE pred)
 
template<typename ITERABLE , typename PREDICATE >
Bool AllOf (const ITERABLE &iterable, PREDICATE pred)
 
template<typename ITERATOR , typename SENTINEL , typename PREDICATE >
Bool AnyOf (ITERATOR first, SENTINEL sentinel, PREDICATE pred)
 
template<typename ITERABLE , typename PREDICATE >
Bool AnyOf (const ITERABLE &iterable, PREDICATE pred)
 
template<typename ITERATOR , typename SENTINEL , typename PREDICATE >
Bool NoneOf (ITERATOR first, SENTINEL sentinel, PREDICATE pred)
 
template<typename ITERABLE , typename PREDICATE >
Bool NoneOf (const ITERABLE &iterable, PREDICATE pred)
 
template<typename ITERATOR1 , typename SENTINEL1 , typename ITERATOR2 , typename SENTINEL2 >
Bool Equal (ITERATOR1 first1, SENTINEL1 sentinel1, ITERATOR2 first2, SENTINEL2 sentinel2)
 
template<typename ITERABLE1 , typename ITERABLE2 >
Bool Equal (const ITERABLE1 &iterable1, const ITERABLE2 &iterable2)
 
template<typename ITERATOR1 , typename SENTINEL1 , typename ITERATOR2 , typename SENTINEL2 , typename COMPARE >
Bool Equal (ITERATOR1 first1, SENTINEL1 sentinel1, ITERATOR2 first2, SENTINEL2 sentinel2, COMPARE comp)
 
template<typename ITERABLE1 , typename ITERABLE2 , typename COMPARE >
Bool Equal (const ITERABLE1 &iterable1, const ITERABLE2 &iterable2, COMPARE comp)
 
template<typename ITERATOR1 , typename SENTINEL1 , typename ITERATOR2 , typename SENTINEL2 >
auto Mismatch (ITERATOR1 first1, SENTINEL1 sentinel1, ITERATOR2 first2, SENTINEL2 sentinel2) -> Optional< Pair< ITERATOR1, ITERATOR2 >>
 
template<typename ITERABLE1 , typename ITERABLE2 >
auto Mismatch (ITERABLE1 &&iterable1, ITERABLE2 &&iterable2) -> Optional< Pair< decltype(begin(iterable1)), decltype(begin(iterable2))>>
 
template<typename ITERATOR1 , typename SENTINEL1 , typename ITERATOR2 , typename SENTINEL2 , typename COMPARE >
auto Mismatch (ITERATOR1 first1, SENTINEL1 sentinel1, ITERATOR2 first2, SENTINEL2 sentinel2, COMPARE comp) -> Optional< Pair< ITERATOR1, ITERATOR2 >>
 
template<typename ITERABLE1 , typename ITERABLE2 , typename COMPARE >
auto Mismatch (ITERABLE1 &&iterable1, ITERABLE2 &&iterable2, COMPARE comp) -> Optional< Pair< decltype(begin(iterable1)), decltype(begin(iterable2))>>
 
template<typename ITERATOR , typename PREDICATE >
auto Partition (ITERATOR first, ITERATOR last, PREDICATE pred) -> ITERATOR
 
template<typename ITERATOR , typename SENTINEL , typename PREDICATE >
auto Partition (ITERATOR first, SENTINEL sentinel, PREDICATE pred) -> ITERATOR
 
template<typename ITERABLE , typename PREDICATE >
auto Partition (ITERABLE &&iterable, PREDICATE pred) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename PREDICATE >
Bool IsPartitioned (ITERATOR first, ITERATOR last, PREDICATE pred)
 
template<typename ITERATOR , typename SENTINEL , typename PREDICATE >
Bool IsPartitioned (ITERATOR first, SENTINEL sentinel, PREDICATE pred)
 
template<typename ITERABLE , typename PREDICATE >
Bool IsPartitioned (const ITERABLE &iterable, PREDICATE pred)
 
template<typename ITERABLE >
auto Reverse (ITERABLE &&iterable) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename T >
auto LowerBound (ITERATOR first, ITERATOR last, const T &value) -> ITERATOR
 
template<typename ITERATOR , typename T , typename COMPARE >
auto LowerBound (ITERATOR first, ITERATOR last, const T &value, COMPARE comp) -> ITERATOR
 
template<typename ITERATOR , typename SENTINEL , typename T >
auto LowerBound (ITERATOR first, SENTINEL sentinel, const T &value) -> ITERATOR
 
template<typename ITERATOR , typename SENTINEL , typename T , typename COMPARE >
auto LowerBound (ITERATOR first, SENTINEL sentinel, const T &value, COMPARE comp) -> ITERATOR
 
template<typename ITERABLE , typename T >
auto LowerBound (ITERABLE &&iterable, const T &value) -> decltype(begin(iterable))
 
template<typename ITERABLE , typename T , typename COMPARE >
auto LowerBound (ITERABLE &&iterable, const T &value, COMPARE comp) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename T >
auto UpperBound (ITERATOR first, ITERATOR last, const T &value) -> ITERATOR
 
template<typename ITERATOR , typename T , typename COMPARE >
auto UpperBound (ITERATOR first, ITERATOR last, const T &value, COMPARE comp) -> ITERATOR
 
template<typename ITERATOR , typename SENTINEL , typename T >
auto UpperBound (ITERATOR first, SENTINEL sentinel, const T &value) -> ITERATOR
 
template<typename ITERATOR , typename SENTINEL , typename T , typename COMPARE >
auto UpperBound (ITERATOR first, SENTINEL sentinel, const T &value, COMPARE comp) -> ITERATOR
 
template<typename ITERABLE , typename T >
auto UpperBound (ITERABLE &&iterable, const T &value) -> decltype(begin(iterable))
 
template<typename ITERABLE , typename T , typename COMPARE >
auto UpperBound (ITERABLE &&iterable, const T &value, COMPARE comp) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename T >
auto BinarySearch (ITERATOR first, ITERATOR last, const T &value) -> Optional< ITERATOR >
 
template<typename ITERATOR , typename SENTINEL , typename T >
auto BinarySearch (ITERATOR first, SENTINEL sentinel, const T &value) -> Optional< ITERATOR >
 
template<typename ITERATOR , typename T , typename COMPARE >
auto BinarySearch (ITERATOR first, ITERATOR last, const T &value, COMPARE comp) -> Optional< ITERATOR >
 
template<typename ITERATOR , typename SENTINEL , typename T , typename COMPARE >
auto BinarySearch (ITERATOR first, SENTINEL sentinel, const T &value, COMPARE comp) -> Optional< ITERATOR >
 
template<typename ITERABLE , typename T >
auto BinarySearch (ITERABLE &&iterable, const T &value) -> decltype(begin(iterable))
 
template<typename ITERABLE , typename T , typename COMPARE >
auto BinarySearch (ITERABLE &&iterable, const T &value, COMPARE comp) -> decltype(begin(iterable))
 
template<typename ITERATOR >
auto Rotate (ITERATOR first, ITERATOR last, ITERATOR newFirst) -> ITERATOR
 
template<typename ITERABLE , typename ITERATOR >
auto Rotate (ITERABLE &&iterable, ITERATOR newFirst) -> ITERATOR
 
template<typename ITERATOR , typename SENTINEL >
auto Rotate (ITERATOR first, SENTINEL sentinel, ITERATOR newFirst) -> ITERATOR
 
template<typename ITERATOR , typename SENTINEL , typename T >
Int Count (ITERATOR first, SENTINEL sentinel, const T &value)
 
template<typename ITERABLE , typename T >
Int Count (ITERABLE &&iterable, const T &value)
 
template<typename ITERATOR , typename SENTINEL , typename PREDICATE >
Int CountIf (ITERATOR first, SENTINEL sentinel, PREDICATE pred)
 
template<typename ITERABLE , typename PREDICATE >
auto CountIf (const ITERABLE &iterable, PREDICATE pred) -> Int
 
template<typename ITERATOR , typename SENTINEL , typename = typename std::enable_if<!IsIterable<ITERATOR>::value>::type>
auto Unique (ITERATOR first, SENTINEL sentinel) -> ITERATOR
 
template<typename ITERABLE >
auto Unique (ITERABLE &&iterable) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename SENTINEL , typename COMPARE >
auto Unique (ITERATOR first, SENTINEL sentinel, COMPARE comp) -> ITERATOR
 
template<typename ITERABLE , typename COMPARE , typename = typename std::enable_if<IsIterable<ITERABLE>::value>::type>
auto Unique (ITERABLE &&iterable, COMPARE comp) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename SENTINEL , typename T >
auto Remove (ITERATOR first, SENTINEL sentinel, const T &value) -> ITERATOR
 
template<typename ITERABLE , typename T >
auto Remove (ITERABLE &&iterable, const T &value) -> decltype(begin(iterable))
 
template<typename ITERABLE , typename PREDICATE >
auto RemoveIf (ITERABLE &&iterable, PREDICATE pred) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename SENTINEL , typename T >
auto Replace (ITERATOR first, SENTINEL sentinel, const T &oldValue, const T &newValue) -> ITERATOR
 
template<typename ITERABLE , typename T >
auto Replace (ITERABLE &&iterable, const T &oldValue, const T &newValue) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename SENTINEL , typename PREDICATE , typename T >
auto ReplaceIf (ITERATOR first, SENTINEL sentinel, PREDICATE pred, const T &newValue) -> ITERATOR
 
template<typename ITERABLE , typename PREDICATE , typename T >
auto ReplaceIf (ITERABLE &&iterable, PREDICATE pred, const T &newValue) -> decltype(begin(iterable))
 
template<typename ITERATOR , typename SENTINEL , typename V , typename BINARYOP >
Fold (ITERATOR first, SENTINEL sentinel, V initialValue, BINARYOP op)
 
template<typename ITERABLE , typename V , typename BINARYOP >
Fold (const ITERABLE &iterable, const V &intitialValue, BINARYOP op)
 
template<typename ITERATOR , typename SENTINEL >
auto MinElement (ITERATOR first, SENTINEL sentinel) -> Optional< ITERATOR >
 
template<typename ITERATOR , typename SENTINEL , typename COMPARE >
auto MinElement (ITERATOR first, SENTINEL sentinel, COMPARE comp) -> Optional< ITERATOR >
 
template<typename ITERABLE >
auto MinElement (ITERABLE &&iterable) -> Optional< decltype(begin(iterable))>
 
template<typename ITERABLE , typename COMPARE >
auto MinElement (ITERABLE &&iterable, COMPARE comp) -> Optional< decltype(begin(iterable))>
 
template<typename ITERATOR , typename SENTINEL >
auto MaxElement (ITERATOR first, SENTINEL sentinel) -> Optional< ITERATOR >
 
template<typename ITERATOR , typename SENTINEL , typename COMPARE >
auto MaxElement (ITERATOR first, SENTINEL sentinel, COMPARE comp) -> Optional< ITERATOR >
 
template<typename ITERABLE >
auto MaxElement (ITERABLE &&iterable) -> Optional< decltype(begin(iterable))>
 
template<typename ITERABLE , typename COMPARE >
auto MaxElement (ITERABLE &&iterable, COMPARE comp) -> Optional< decltype(begin(iterable))>
 
template<typename ITERATOR >
Int GetSequenceLength (ITERATOR first, ITERATOR last)
 
template<typename ITERATOR , typename SENTINEL >
Int GetSequenceLength (ITERATOR first, SENTINEL sentinel)
 
template<typename ITERABLE >
Int GetSequenceLength (const ITERABLE &iterable)
 
enum maxon::NO_MATCH_TYPE MAXON_ENUM_LIST (NO_MATCH_TYPE)
 
template<typename INDEXABLE , typename MATCHER >
static auto CountIfMatch (INDEXABLE &&indexable, MATCHER matcher) -> Match< Int >
 
template<typename ITERATOR , typename SENTINEL , typename MATCHER >
auto LinearSearch (ITERATOR first, SENTINEL sentinel, MATCHER matcher) -> Match< ITERATOR >
 
template<typename ITERABLE , typename MATCHER >
auto LinearSearch (ITERABLE &&iterable, MATCHER matcher) -> Match< decltype(begin(iterable))>
 
template<typename ITERABLE , typename MATCHER >
auto Split (const ITERABLE &iterable, MATCHER matcher) -> Result< BaseArray< ITERABLE >>
 
template<typename INDEXABLE , typename MATCHER >
auto SplitIndex (const INDEXABLE &indexable, IndexPair indexPair, MATCHER matcher) -> Result< BaseArray< Match< Int >>>
 
template<typename INDEXABLE , typename MATCHER >
auto SplitIndex (const INDEXABLE &indexable, MATCHER matcher) -> Result< void >
 
template<Int COUNT, typename ITERABLE , typename MATCHER >
auto SplitToTuple (const ITERABLE &iterable, MATCHER matcher) -> HomogenousTupleType< COUNT, ITERABLE >
 
template<Int COUNT, typename INDEXABLE , typename MATCHER >
auto SplitToTupleIndex (const INDEXABLE &indexable, IndexPair indexPair, MATCHER matcher) -> HomogenousTupleType< COUNT, Match< Int >>
 
template<Int COUNT, typename INDEXABLE , typename MATCHER >
auto SplitToTupleIndex (const INDEXABLE &indexable, MATCHER matcher) -> HomogenousTupleType< COUNT, Match< Int >>
 
template<typename ITERATE_FUNC , typename ITERABLE , typename MATCHER >
auto SplitIterate (ITERATE_FUNC iterFunc, const ITERABLE &iterable, MATCHER matcher) -> Result< Bool >
 
template<typename ITERATE_FUNC , typename INDEXABLE , typename MATCHER >
auto SplitIterateIndex (ITERATE_FUNC iterFunc, const INDEXABLE &indexable, IndexPair indexPair, MATCHER matcher) -> Result< Bool >
 
template<typename ITERATE_FUNC , typename INDEXABLE , typename MATCHER >
auto SplitIterateIndex (ITERATE_FUNC iterFunc, const INDEXABLE &indexable, const MATCHER &matcher) -> Result< Bool >
 
template<typename PRED >
auto ByPredicate (const PRED &pred) -> PredicateMatcher< std::reference_wrapper< const PRED >>
 
template<typename T >
auto ByValue (const T &value) -> PredicateMatcher< ValuePredicate< T >>
 
template<typename T , typename COMPARE >
auto ByValue (const T &value, const COMPARE &comp) -> PredicateMatcher< ValueComparePredicate< T, COMPARE >>
 
template<typename PRED >
auto ByRepeatingPredicate (const PRED &pred) -> RepeatingPredicateMatcher< PRED >
 
template<typename T >
auto ByRepeatingValue (const T &value) -> RepeatingPredicateMatcher< ValuePredicate< T >>
 
template<typename T , typename COMPARE >
auto ByRepeatingValue (const T &value, const COMPARE &comp) -> RepeatingPredicateMatcher< ValueComparePredicate< T, COMPARE >>
 
template<typename SEARCH_SEQ >
auto BySequence (const SEARCH_SEQ &searchSeq) -> SequenceMatcher< SEARCH_SEQ, maxon::details::EqualityCompare< typename std::iterator_traits< decltype(begin(searchSeq))>::value_type, typename std::iterator_traits< decltype(begin(searchSeq))>::value_type >>
 
template<typename SEARCH_SEQ , typename COMPARE >
auto BySequence (const SEARCH_SEQ &searchSeq, const COMPARE &comp) -> SequenceMatcher< SEARCH_SEQ, COMPARE >
 
template<typename ITERABLE1 , typename ITERABLE2 >
auto SetDifference (const ITERABLE1 &firstSet, const ITERABLE2 &secondSet) -> Result< ITERABLE1 >
 
template<typename ITERABLE1 , typename ITERABLE2 , typename APPENDABLE >
auto SetDifference (const ITERABLE1 &firstSet, const ITERABLE2 &secondSet, APPENDABLE &outContainer) -> Result< void >
 
template<typename ITERABLE , typename FINDABLE >
auto UnorderedSetDifference (const ITERABLE &firstSet, const FINDABLE &secondSet) -> Result< ITERABLE >
 
template<typename ITERABLE , typename FINDABLE , typename APPENDABLE >
auto UnorderedSetDifference (const ITERABLE &firstSet, const FINDABLE &secondSet, APPENDABLE &outputContainer) -> Result< void >
 
template<typename ERASABLE , typename ITERABLE >
auto ExcludeSetFromSet (ERASABLE &firstSet, const ITERABLE &secondSet) -> Result< void >
 

Variables

template<typename T >
decltype(begin(std::declval< T & >())) TestForBeginFunction (OverloadRank1)
 
template<typename T >
decltype(end(std::declval< T & >())) TestForEndFunction (OverloadRank1)
 
 KEEP_SOURCE
 
 DESTRUCT_SOURCE
 
 VALUE
 
static const NO_MATCH_TYPE NO_MATCH
 

Variable Documentation

◆ KEEP_SOURCE

KEEP_SOURCE

◆ DESTRUCT_SOURCE

DESTRUCT_SOURCE

◆ VALUE

VALUE