🟥 Placeholder library templated where algorithms will be placed (see Algorithms for more details)
More...
|
template<typename Iterator , typename BinaryPredicate = smallerThan<typename TypeTraits::RemovePointer<Iterator>::type>> |
constexpr void | SC::Algorithms::bubbleSort (Iterator first, Iterator last, BinaryPredicate predicate=BinaryPredicate()) |
| Sorts iterator range according to BinaryPredicate (bubble sort). More...
|
|
template<typename ForwardIterator , typename UnaryPredicate > |
constexpr ForwardIterator | SC::Algorithms::findIf (ForwardIterator first, ForwardIterator last, UnaryPredicate &&predicate) |
| Find item satisfying the given predicate. More...
|
|
template<typename ForwardIterator , typename UnaryPredicate > |
ForwardIterator | SC::Algorithms::removeIf (ForwardIterator first, ForwardIterator last, UnaryPredicate &&predicate) |
| Removes all items in the given range, satisfying the given predicate. More...
|
|
template<typename T > |
constexpr const T & | SC::min (const T &t1, const T &t2) |
| Finds the minimum of two values. More...
|
|
template<typename T > |
constexpr const T & | SC::max (const T &t1, const T &t2) |
| Finds the maximum of two values. More...
|
|
🟥 Placeholder library templated where algorithms will be placed (see Algorithms for more details)
◆ bubbleSort()
template<typename Iterator , typename BinaryPredicate = smallerThan<typename TypeTraits::RemovePointer<Iterator>::type>>
constexpr void SC::Algorithms::bubbleSort |
( |
Iterator |
first, |
|
|
Iterator |
last, |
|
|
BinaryPredicate |
predicate = BinaryPredicate() |
|
) |
| |
|
constexpr |
#include <AlgorithmBubbleSort.h>
Sorts iterator range according to BinaryPredicate (bubble sort).
- Template Parameters
-
Iterator | A type that behaves as an iterator (can just be a pointer to element in array / vector) |
BinaryPredicate | A predicate that takes (a, b) and returns bool (example SC::Algorithms::smallerThan) |
- Parameters
-
first | Iterator pointing at first element of the range |
last | Iterator pointing at last element of the array |
predicate | The given BinaryPredicate |
◆ findIf()
template<typename ForwardIterator , typename UnaryPredicate >
constexpr ForwardIterator SC::Algorithms::findIf |
( |
ForwardIterator |
first, |
|
|
ForwardIterator |
last, |
|
|
UnaryPredicate && |
predicate |
|
) |
| |
|
constexpr |
#include <AlgorithmFind.h>
Find item satisfying the given predicate.
- Template Parameters
-
ForwardIterator | A forward iterator (supports ++ and dereference operators) |
UnaryPredicate | A lambda or functor predicate with a bool (const T&) operator |
- Parameters
-
first | Iterator pointing at the first item in the range to check |
last | Iterator pointing after last item in the range to check |
predicate | The functor or lambda predicate that decides if wanted item is found |
- Returns
- Iterator pointing at the found item
◆ max()
template<typename T >
constexpr const T & SC::max |
( |
const T & |
t1, |
|
|
const T & |
t2 |
|
) |
| |
|
constexpr |
#include <Compiler.h>
Finds the maximum of two values.
◆ min()
template<typename T >
constexpr const T & SC::min |
( |
const T & |
t1, |
|
|
const T & |
t2 |
|
) |
| |
|
constexpr |
#include <Compiler.h>
Finds the minimum of two values.
◆ removeIf()
template<typename ForwardIterator , typename UnaryPredicate >
ForwardIterator SC::Algorithms::removeIf |
( |
ForwardIterator |
first, |
|
|
ForwardIterator |
last, |
|
|
UnaryPredicate && |
predicate |
|
) |
| |
#include <AlgorithmRemove.h>
Removes all items in the given range, satisfying the given predicate.
- Template Parameters
-
ForwardIterator | A forward iterator (supports ++ and dereference operators) |
UnaryPredicate | A lambda or functor predicate with a bool (const T&) operator |
- Parameters
-
first | Iterator pointing at the first item in the range to check |
last | Iterator pointing after last item in the range to check |
predicate | The functor or lambda predicate that decides if current item must be removed |
- Returns
last