![]() |
Documentation
Tools for embedded systems
|
The generic namespace. More...
Functions | |
template<typename T > | |
void | swap (T &x, T &y) noexcept |
Exchanges the values of a and b. | |
template<typename T , size_t n> | |
void | sort (T(&array)[n], size_t first=0U, size_t last=n - 1U, bool(*comp)(const T &, const T &)=nullptr) noexcept |
Sorts the given array in the range [first,last) into ascending order. | |
template<typename T , size_t n> | |
void | reverse (T(&array)[n], const size_t first=0U, const size_t last=n - 1U) noexcept |
Reverses the order of the elements in the range [first,last). | |
template<typename T , size_t n> | |
void | rotate (T(&array)[n], const int k=1) noexcept |
Rotates k elements of the array. Rotation direction is determined by the sign of k, the means a positive value performs a right-rotation and a negative value a left-rotation. | |
template<typename T , size_t n> | |
void | fill (T(&array)[n], const T value, const size_t first=0U, const size_t last=n - 1U) noexcept |
Assigns value to all the elements of the array in the range [first,last). | |
template<typename T , size_t n> | |
T * | find (T(&array)[n], const T key, const size_t first=0U, const size_t last=n - 1U) noexcept |
Returns a pointer to the first element in the range [first,last) that compares equal to key. If no such element is found, the function returns nullptr . | |
template<typename T , size_t n> | |
bool | any_of (T(&array)[n], bool(*pred)(const T), const size_t first=0U, const size_t last=n - 1U) noexcept |
Returns true if pred returns true for any of the elements in the range [first,last), and false otherwise. | |
template<typename T , size_t n> | |
bool | all_of (T(&array)[n], bool(*pred)(const T), const size_t first=0U, const size_t last=n - 1U) noexcept |
Returns true if pred returns true for all the elements in the range [first,last), and false otherwise. | |
template<typename T , size_t n> | |
void | replace (T(&array)[n], const T &old_value, const T &new_value, const size_t first=0U, const size_t last=n - 1U) noexcept |
Replaces all elements satisfying specific criteria with new_value in the range [first, last). Replaces all elements that are equal to old_value (using operator==) | |
template<typename T , size_t n> | |
void | replace_if (T(&array)[n], bool(*pred)(const T &), const T &new_value, const size_t first=0U, const size_t last=n - 1U) noexcept |
Replaces all elements satisfying specific criteria with new_value in the range [first, last). Replaces all elements for which predicate pred returns true . | |
template<typename T , size_t n> | |
size_t | count_if (T(&array)[n], bool(*pred)(const T), const size_t first=0U, const size_t last=n - 1U) noexcept |
Returns the number of elements in the range [first,last) for which pred is true . | |
template<typename T , size_t n> | |
T * | find_if (T(&array)[n], bool(*pred)(const T), const size_t first=0U, const size_t last=n - 1U) noexcept |
Returns an iterator to the first element in the range [first,last) for which pred returns true . If no such element is found, the function returns nullptr . | |
template<typename T , size_t n> | |
void | for_each (T(&array)[n], void(*fn)(T &), const size_t first=0U, const size_t last=n - 1U) noexcept |
Applies function fn to each of the elements in the range [first,last). | |
template<typename T , size_t n> | |
T * | binary_search (T(&array)[n], const T key, const size_t first=0U, const size_t last=n - 1U) noexcept |
Returns a pointer to the first element in the range [first,last) that compares equal to key. If no such element is found, the function returns nullptr . | |
The generic namespace.