Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
ahAlgo.H File Reference

Aleph-w implementation of STL-like algorithms. More...

#include <ahAssert.H>
#include <ahUtils.H>
Include dependency graph for ahAlgo.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 

Typedefs

using Aleph::size_type = size_t
 

Functions

template<class Itor , class Operation >
Operation Aleph::for_each (Itor beg, const Itor &end, Operation op)
 Apply an operation to each element in a range.
 
template<class Itor , class Operation >
Itor::difference_type Aleph::count_if (Itor beg, const Itor &end, Operation op)
 Count elements satisfying a predicate.
 
template<class Itor , class T >
Itor::difference_type Aleph::count (const Itor &beg, const Itor &end, const T &value)
 Count elements equal to a value.
 
template<class Itor , class CompFunc = Aleph::less<typename Itor::value_type>>
Itor Aleph::min_element (Itor beg, const Itor &end, CompFunc op=CompFunc())
 Find the minimum element in a range.
 
template<class Itor , class CompFunc = Aleph::greater<typename Itor::value_type>>
Itor Aleph::max_element (const Itor &beg, const Itor &end, CompFunc op=CompFunc())
 Find the maximum element in a range.
 
template<class Itor , class UnaryPredicate >
Itor Aleph::find_if (Itor beg, const Itor &end, UnaryPredicate op)
 Find the first element satisfying a predicate.
 
template<class Itor , class T >
Itor Aleph::find (const Itor &beg, const Itor &end, const T &value)
 Find the first element equal to a value.
 
template<class Itor , class Size , class T , class BinaryPredicate = Aleph::equal_to<T>>
Itor Aleph::search_n (Itor beg, const Itor &end, Size count, const T &value, BinaryPredicate op=BinaryPredicate())
 Find n consecutive elements equal to a value.
 
template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
Itor1 Aleph::search (Itor1 beg, const Itor1 &end, Itor2 searchBeg, const Itor2 &searchEnd, BinaryPredicate op=BinaryPredicate())
 Search for a subrange within a range.
 
template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
Itor1 Aleph::find_end (Itor1 beg, Itor1 end, Itor2 searchBeg, Itor2 searchEnd, BinaryPredicate op=BinaryPredicate())
 Find the last occurrence of a subrange.
 
template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
Itor1 Aleph::find_first_of (const Itor1 &beg, const Itor1 &end, Itor2 searchBeg, const Itor2 &searchEnd, BinaryPredicate op=BinaryPredicate())
 Find first element from a set.
 
template<class Itor , class BinaryPredicate = Aleph::equal_to<typename Itor::value_type>>
Itor Aleph::adjacent_find (Itor beg, const Itor &end, BinaryPredicate op=BinaryPredicate())
 Find first pair of adjacent equal elements.
 
template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
bool Aleph::equal (Itor1 beg, const Itor1 &end, Itor2 cmpBeg, BinaryPredicate op=BinaryPredicate())
 Test if two ranges are equal.
 
template<class Itor1 , class Itor2 , class BinaryPredicate = Aleph::equal_to<typename Itor1::value_type>>
std::pair< Itor1, Itor2Aleph::mismatch (Itor1 beg, const Itor1 &end, Itor2 cmpBeg, BinaryPredicate op=BinaryPredicate())
 Find the first mismatching elements in two ranges.
 
template<class Itor1 , class Itor2 , class Comp = Aleph::less<typename Itor1::value_type>>
bool Aleph::lexicographical_compare (Itor1 beg1, const Itor1 &end1, Itor2 beg2, const Itor2 &end2, Comp op=Comp())
 Lexicographical comparison of two ranges.
 
template<class Itor1 , class Itor2 >
Itor2 Aleph::copy (Itor1 sourceBeg, const Itor1 &sourceEnd, Itor2 destBeg)
 Copy elements from one range to another.
 
template<class Itor1 , class Itor2 >
Itor2 Aleph::copy_backward (const Itor1 &sourceBeg, Itor1 sourceEnd, Itor2 destEnd)
 Copy elements backward from one range to another.
 
template<class Itor1 , class Itor2 , class UnaryFunc >
Itor2 Aleph::transform (Itor1 sourceBeg, Itor1 sourceEnd, Itor2 destBeg, UnaryFunc op)
 Transform elements using a unary operation.
 
template<class Itor1 , class Itor2 , class Itor3 , class BinaryFunc >
Itor3 Aleph::transform (Itor1 source1Beg, Itor1 source1End, Itor2 source2Beg, Itor3 destBeg, BinaryFunc op)
 Transform elements using a binary operation.
 
template<class Itor1 , class Itor2 >
Itor2 Aleph::swap_ranges (Itor1 beg1, const Itor1 &end1, Itor2 beg2)
 Swap elements between two ranges.
 
template<class Itor , class T >
void Aleph::fill (Itor beg, const Itor &end, const T &value)
 Fill a range with a value.
 
template<class Itor , class T , class Size >
void Aleph::fill_n (Itor beg, Size num, const T &value)
 Fill n elements with a value.
 
template<class Itor , class Func >
void Aleph::generate (Itor beg, const Itor &end, Func op)
 Generate values for a range.
 
template<class Itor , class Size , class Func >
void Aleph::generate_n (Itor beg, Size num, Func op)
 Generate values for n elements.
 
template<class Itor , class UnaryPredicate , class T >
void Aleph::replace_if (Itor beg, const Itor &end, UnaryPredicate op, const T &value)
 Replace elements satisfying a predicate.
 
template<class Itor , class T >
void Aleph::replace (Itor beg, const Itor &end, const T &old_value, const T &new_value)
 Replace elements equal to a value.
 
template<class Itor1 , class Itor2 , class UnaryPredicate , class T >
Itor2 Aleph::replace_copy_if (Itor1 sourceBeg, const Itor1 &sourceEnd, Itor2 destBeg, UnaryPredicate op, const T &value)
 Copy and replace elements satisfying a predicate.
 
template<class Itor1 , class Itor2 , class T >
Itor2 Aleph::replace_copy (const Itor1 &sourceBeg, const Itor1 &sourceEnd, Itor2 destBeg, const T &old_value, const T &new_value)
 Copy and replace elements equal to a value.
 
template<class In_Itor , class Out_Itor , class Predicate >
Out_Itor Aleph::remove_copy_if (In_Itor __first, const In_Itor &__last, Out_Itor __result, Predicate __pred)
 Copy elements not satisfying a predicate.
 
template<class Fw_Itor , class Predicate >
Fw_Itor Aleph::remove_if (Fw_Itor __first, const Fw_Itor &__last, Predicate __pred)
 Remove elements satisfying a predicate.
 
template<class Fw_Itor , class T >
Fw_Itor Aleph::remove (Fw_Itor __first, const Fw_Itor &__last, const T &__value)
 Remove elements equal to a value.
 
template<class In_Itor , class Out_Itor >
Out_Itor Aleph::unique_copy (In_Itor __first, In_Itor __last, Out_Itor __result)
 Copy unique elements.
 
template<class In_Itor , class Out_Itor , class BinaryPredicate >
Out_Itor Aleph::unique_copy (In_Itor __first, In_Itor __last, Out_Itor __result, BinaryPredicate __binary_pred)
 Copy unique elements with custom comparison.
 
template<class Itor , class BinaryPredicate = Aleph::equal_to<typename Itor::value_type>>
Itor Aleph::unique (Itor __first, Itor __last, BinaryPredicate __binary_pred=BinaryPredicate())
 Remove consecutive duplicates in place.
 
template<class Itor >
void Aleph::reverse (Itor beg, Itor end)
 Reverse elements in a range.
 
template<class Itor1 , class Itor2 >
Itor2 Aleph::reverse_copy (Itor1 sourceBeg, Itor1 sourceEnd, Itor2 destBeg)
 Copy elements in reverse order.
 
template<class Itor >
void Aleph::rotate (Itor beg, Itor pos, Itor end)
 Rotate elements in a range.
 
template<class Itor1 , class Itor2 >
Itor2 Aleph::rotate_copy (const Itor1 &beg, const Itor1 &pos, const Itor1 &end, Itor2 tgt_beg)
 Copy and rotate elements.
 
template<class Itor , class T >
Itor Aleph::lower_bound (Itor beg, Itor end, const T &value)
 Find lower bound in a sorted range.
 
template<class Itor , class T , class BinaryPredicate >
Itor Aleph::lower_bound (Itor beg, Itor end, const T &value, BinaryPredicate op)
 Find lower bound with custom comparison.
 
template<class Itor , class T >
Itor Aleph::upper_bound (Itor beg, Itor end, const T &value)
 Find upper bound in a sorted range.
 
template<class Itor , class T , class BinaryPredicate >
Itor Aleph::upper_bound (Itor beg, Itor end, const T &value, BinaryPredicate op)
 Find upper bound with custom comparison.
 
template<class Itor , class T >
bool Aleph::binary_search (Itor beg, Itor end, const T &value)
 Binary search for a value.
 
template<class Itor , class T , class BinaryPredicate >
bool Aleph::binary_search (Itor beg, Itor end, const T &value, BinaryPredicate op)
 Binary search with custom comparison.
 
template<class Itor , class T >
std::pair< Itor, Itor > Aleph::equal_range (Itor beg, Itor end, const T &value)
 Find equal range in a sorted sequence.
 
template<class Itor , class T , class BinaryPredicate >
std::pair< Itor, Itor > Aleph::equal_range (Itor beg, Itor end, const T &value, BinaryPredicate op)
 Find equal range with custom comparison.
 
template<class Itor1 , class Itor2 >
bool Aleph::includes (Itor1 beg, Itor1 end, Itor2 searchBeg, Itor2 searchEnd)
 Test if one sorted range includes another.
 
template<class Itor1 , class Itor2 , class Itor3 >
Itor3 Aleph::merge (Itor1 source1Beg, Itor1 source1End, Itor2 source2Beg, Itor2 source2End, Itor3 destBeg)
 Merge two sorted ranges.
 
template<class Itor1 , class Itor2 , class Itor3 , class BinaryPredicate >
Itor3 Aleph::merge (Itor1 source1Beg, Itor1 source1End, Itor2 source2Beg, Itor2 source2End, Itor3 destBeg, BinaryPredicate op)
 Merge two sorted ranges with custom comparison.
 
template<class Itor , class T >
T Aleph::accumulate (Itor beg, Itor end, T initValue)
 Accumulate values in a range.
 
template<class Itor , class T , class BinaryFunc >
T Aleph::accumulate (Itor beg, Itor end, T initValue, BinaryFunc op)
 Accumulate values with custom operation.
 
template<class Itor1 , class Itor2 , class T >
T Aleph::inner_product (Itor1 beg1, Itor1 end1, Itor2 beg2, T initValue)
 Compute inner product of two ranges.
 
template<class Itor1 , class Itor2 , class T , class BinaryFunc1 , class BinaryFunc2 >
T Aleph::inner_product (Itor1 beg1, Itor1 end1, Itor2 beg2, T initValue, BinaryFunc1 op1, BinaryFunc2 op2)
 Compute inner product with custom operations.
 
template<class Itor1 , class Itor2 >
Itor2 Aleph::partial_sum (Itor1 sourceBeg, Itor1 sourceEnd, Itor2 destBeg)
 Compute partial sums of a range.
 
template<class Itor1 , class Itor2 , class BinaryFunc >
Itor2 Aleph::partial_sum (Itor1 sourceBeg, Itor1 sourceEnd, Itor2 destBeg, BinaryFunc op)
 Compute partial sums with custom operation.
 
template<class Itor1 , class Itor2 >
Itor2 Aleph::adjacent_difference (Itor1 sourceBeg, Itor1 sourceEnd, Itor2 destBeg)
 Compute adjacent differences.
 
template<class Itor1 , class Itor2 , class BinaryFunc >
Itor2 Aleph::adjacent_difference (Itor1 sourceBeg, Itor1 sourceEnd, Itor2 destBeg, BinaryFunc op)
 Compute adjacent differences with custom operation.
 

Detailed Description

Aleph-w implementation of STL-like algorithms.

This file provides implementations of common STL algorithms adapted for use with Aleph-w containers and iterators.

Author
Leandro Rabindranath León

Definition in file ahAlgo.H.