Stefan Scholz / ETL
Embed: (wiki syntax)

« Back to documentation index

algorithm

algorithm

Reverse engineered algorithms from C++ 0x11 Additional new variants of certain algorithms. More...

Functions

template<typename TIterator , typename TCompare >
std::pair< TIterator, TIterator > minmax_element (TIterator begin, TIterator end, TCompare compare)
 Finds the greatest and the smallest element in the range (begin, end).
template<typename TIterator >
std::pair< TIterator, TIterator > minmax_element (TIterator begin, TIterator end)
 minmax_elementa href="http://en.cppreference.com/w/cpp/algorithm/minmax_element">
template<typename T >
std::pair< const T &, const T & > minmax (const T &a, const T &b)
 minmaxa href="http://en.cppreference.com/w/cpp/algorithm/minmax">
template<typename T , typename TCompare >
std::pair< const T &, const T & > minmax (const T &a, const T &b, TCompare compare)
 minmaxa href="http://en.cppreference.com/w/cpp/algorithm/minmax">
template<typename TIterator >
TIterator is_sorted_until (TIterator begin, TIterator end)
 is_sorted_untila href="http://en.cppreference.com/w/cpp/algorithm/is_sorted_until">
template<typename TIterator , typename TCompare >
TIterator is_sorted_until (TIterator begin, TIterator end, TCompare compare)
 is_sorted_untila href="http://en.cppreference.com/w/cpp/algorithm/is_sorted_until">
template<typename TIterator >
bool is_sorted (TIterator begin, TIterator end)
 is_sorteda href="http://en.cppreference.com/w/cpp/algorithm/is_sorted">
template<typename TIterator , typename TCompare >
bool is_sorted (TIterator begin, TIterator end, TCompare compare)
 is_sorteda href="http://en.cppreference.com/w/cpp/algorithm/is_sorted">
template<typename TInputIterator , typename TOutputIterator >
etl::enable_if
< etl::is_random_iterator
< TInputIterator >::value
&&etl::is_random_iterator
< TOutputIterator >::value,
TOutputIterator >::type 
copy (TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TOutputIterator o_end)
 copy A form of copy where the smallest of the two ranges is used.
template<typename TInputIterator , typename TSize , typename TOutputIterator >
etl::enable_if
< etl::is_random_iterator
< TInputIterator >::value,
TOutputIterator >::type 
copy_n (TInputIterator i_begin, TSize n, TOutputIterator o_begin)
 copy_n (Random input iterators)a href="http://en.cppreference.com/w/cpp/algorithm/copy_n">
template<typename TInputIterator , typename TSize , typename TOutputIterator >
TOutputIterator copy_n (TInputIterator i_begin, TSize n, TOutputIterator o_begin, TOutputIterator o_end)
 copy_n A form of copy_n where the smallest of the two ranges is used.
template<typename TInputIterator , typename TSize1 , typename TOutputIterator , typename TSize2 >
TOutputIterator copy_n (TInputIterator i_begin, TSize1 n1, TOutputIterator o_begin, TSize2 n2)
 copy_n A form of copy_n where the smallest of the two ranges is used.
template<typename TIterator , typename TOutputIterator , typename TUnaryPredicate >
TOutputIterator copy_if (TIterator begin, TIterator end, TOutputIterator out, TUnaryPredicate predicate)
 copy_ifa href="http://en.cppreference.com/w/cpp/algorithm/copy">
template<typename TInputIterator , typename TOutputIterator , typename TUnaryPredicate >
TOutputIterator copy_if (TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TOutputIterator o_end, TUnaryPredicate predicate)
 copy_if A form of copy_if where it terminates when the first end iterator is reached.
template<typename TInputIterator , typename TSize , typename TOutputIterator , typename TUnaryPredicate >
TOutputIterator copy_n_if (TInputIterator i_begin, TSize n, TOutputIterator o_begin, TUnaryPredicate predicate)
 copy_n_if Combination of copy_n and copy_if.
template<typename TIterator , typename TValue >
TIterator binary_find (TIterator begin, TIterator end, const TValue &value)
 binary_findDoes a binary search and returns an iterator to the value or end if not found.
template<typename TIterator , typename TValue , typename TBinaryPredicate , typename TBinaryEquality >
TIterator binary_find (TIterator begin, TIterator end, const TValue &value, TBinaryPredicate predicate, TBinaryEquality equality)
 binary_findDoes a binary search and returns an iterator to the value or end if not found.
template<typename TIterator , typename TUnaryPredicate >
TIterator find_if_not (TIterator begin, TIterator end, TUnaryPredicate predicate)
 find_if_nota href="http://en.cppreference.com/w/cpp/algorithm/find">
template<typename TIterator , typename TUnaryPredicate >
bool all_of (TIterator begin, TIterator end, TUnaryPredicate predicate)
 all_ofa href="http://en.cppreference.com/w/cpp/algorithm/all_any_none_of">
template<typename TIterator , typename TUnaryPredicate >
bool any_of (TIterator begin, TIterator end, TUnaryPredicate predicate)
 any_ofa href="http://en.cppreference.com/w/cpp/algorithm/all_any_none_of">
template<typename TIterator , typename TUnaryPredicate >
bool none_of (TIterator begin, TIterator end, TUnaryPredicate predicate)
 none_ofa href="http://en.cppreference.com/w/cpp/algorithm/all_any_none_of">
template<typename TIterator1 , typename TIterator2 >
bool is_permutation (TIterator1 begin1, TIterator1 end1, TIterator2 begin2)
 is_permutationa href="http://en.cppreference.com/w/cpp/algorithm/is_permutation">
template<typename TIterator1 , typename TIterator2 >
bool is_permutation (TIterator1 begin1, TIterator1 end1, TIterator2 begin2, TIterator2 end2)
 is_permutationa href="http://en.cppreference.com/w/cpp/algorithm/is_permutation">
template<typename TIterator1 , typename TIterator2 , typename TBinaryPredicate >
bool is_permutation (TIterator1 begin1, TIterator1 end1, TIterator2 begin2, TBinaryPredicate predicate)
 is_permutationa href="http://en.cppreference.com/w/cpp/algorithm/is_permutation">
template<typename TIterator1 , typename TIterator2 , typename TBinaryPredicate >
bool is_permutation (TIterator1 begin1, TIterator1 end1, TIterator2 begin2, TIterator2 end2, TBinaryPredicate predicate)
 is_permutationa href="http://en.cppreference.com/w/cpp/algorithm/is_permutation">
template<typename TIterator , typename TUnaryPredicate >
bool is_partitioned (TIterator begin, TIterator end, TUnaryPredicate predicate)
 is_partitioneda href="http://en.cppreference.com/w/cpp/algorithm/is_partitioned">
template<typename TIterator , typename TUnaryPredicate >
TIterator partition_point (TIterator begin, TIterator end, TUnaryPredicate predicate)
 partition_point a href="http://en.cppreference.com/w/cpp/algorithm/partition_point">
template<typename TSource , typename TDestinationTrue , typename TDestinationFalse , typename TUnaryPredicate >
std::pair< TDestinationTrue,
TDestinationFalse > 
partition_copy (TSource begin, TSource end, TDestinationTrue destination_true, TDestinationFalse destination_false, TUnaryPredicate predicate)
 Copies the elements from the range (begin, end) to two different ranges depending on the value returned by the predicate.
template<typename TIterator , typename TUnaryFunction , typename TUnaryPredicate >
TUnaryFunction for_each_if (TIterator begin, const TIterator end, TUnaryFunction function, TUnaryPredicate predicate)
 Like std::for_each but applies a predicate before calling the function.
template<typename TIterator , typename TSize , typename TUnaryFunction >
TIterator for_each_n (TIterator begin, TSize n, TUnaryFunction function)
 Like std::for_each but for 'n' iterations.
template<typename TIterator , typename TSize , typename TUnaryFunction , typename TUnaryPredicate >
TIterator for_each_n_if (TIterator begin, TSize n, TUnaryFunction function, TUnaryPredicate predicate)
 Like std::for_each but applies a predicate before calling the function, for 'n' iterations.
template<typename TInputIterator , typename TOutputIterator , typename TUnaryFunction >
void transform (TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TOutputIterator o_end, TUnaryFunction function)
 A form of std::transform where the transform returns when the first range end is reached.
template<typename TInputIterator , typename TSize , typename TOutputIterator , typename TUnaryFunction >
etl::enable_if
< etl::is_random_iterator
< TInputIterator >::value,
void >::type 
transform_n (TInputIterator i_begin, TSize n, TOutputIterator o_begin, TUnaryFunction function)
 Transform 'n' items.
template<typename TInputIterator1 , typename TInputIterator2 , typename TSize , typename TOutputIterator , typename TBinaryFunction >
etl::enable_if
< etl::is_random_iterator
< TInputIterator1 >::value
&&etl::is_random_iterator
< TInputIterator2 >::value,
void >::type 
transform_n (TInputIterator1 i_begin1, TInputIterator2 i_begin2, TSize n, TOutputIterator o_begin, TBinaryFunction function)
 Transform 'n' items from two ranges.
template<typename TInputIterator , typename TOutputIterator , typename TUnaryFunction , typename TUnaryPredicate >
TOutputIterator transform_if (TInputIterator i_begin, const TInputIterator i_end, TOutputIterator o_begin, TUnaryFunction function, TUnaryPredicate predicate)
 Like std::transform but applies a predicate before calling the function.
template<typename TInputIterator1 , typename TInputIterator2 , typename TOutputIterator , typename TBinaryFunction , typename TBinaryPredicate >
TOutputIterator transform_if (TInputIterator1 i_begin1, const TInputIterator1 i_end1, TInputIterator2 i_begin2, TOutputIterator o_begin, TBinaryFunction function, TBinaryPredicate predicate)
 Like etl::transform_if but inputs from two ranges.
template<typename TInputIterator , typename TSize , typename TOutputIterator , typename TUnaryFunction , typename TUnaryPredicate >
TOutputIterator transform_n_if (TInputIterator i_begin, TSize n, TOutputIterator o_begin, TUnaryFunction function, TUnaryPredicate predicate)
 Like std::transform_if, for 'n' items.
template<typename TInputIterator1 , typename TInputIterator2 , typename TSize , typename TOutputIterator , typename TBinaryFunction , typename TBinaryPredicate >
TOutputIterator transform_n_if (TInputIterator1 i_begin1, TInputIterator2 i_begin2, TSize n, TOutputIterator o_begin, TBinaryFunction function, TBinaryPredicate predicate)
 Like etl::transform_if but inputs from two ranges for 'n' items.
template<typename TSource , typename TDestinationTrue , typename TDestinationFalse , typename TUnaryFunctionTrue , typename TUnaryFunctionFalse , typename TUnaryPredicate >
std::pair< TDestinationTrue,
TDestinationFalse > 
partition_transform (TSource begin, TSource end, TDestinationTrue destination_true, TDestinationFalse destination_false, TUnaryFunctionTrue function_true, TUnaryFunctionFalse function_false, TUnaryPredicate predicate)
 Transforms the elements from the range (begin, end) to two different ranges depending on the value returned by the predicate.
template<typename TSource1 , typename TSource2 , typename TDestinationTrue , typename TDestinationFalse , typename TBinaryFunctionTrue , typename TBinaryFunctionFalse , typename TBinaryPredicate >
std::pair< TDestinationTrue,
TDestinationFalse > 
partition_transform (TSource1 begin1, TSource1 end1, TSource2 begin2, TDestinationTrue destination_true, TDestinationFalse destination_false, TBinaryFunctionTrue function_true, TBinaryFunctionFalse function_false, TBinaryPredicate predicate)
 Transforms the elements from the ranges (begin1, end1) & (begin2) to two different ranges depending on the value returned by the predicate.

Detailed Description

Reverse engineered algorithms from C++ 0x11 Additional new variants of certain algorithms.


Function Documentation

bool etl::all_of ( TIterator  begin,
TIterator  end,
TUnaryPredicate  predicate 
)

all_ofa href="http://en.cppreference.com/w/cpp/algorithm/all_any_none_of">

Definition at line 499 of file algorithm.h.

bool etl::any_of ( TIterator  begin,
TIterator  end,
TUnaryPredicate  predicate 
)

any_ofa href="http://en.cppreference.com/w/cpp/algorithm/all_any_none_of">

Definition at line 513 of file algorithm.h.

TIterator etl::binary_find ( TIterator  begin,
TIterator  end,
const TValue &  value,
TBinaryPredicate  predicate,
TBinaryEquality  equality 
)

binary_findDoes a binary search and returns an iterator to the value or end if not found.

Definition at line 452 of file algorithm.h.

TIterator etl::binary_find ( TIterator  begin,
TIterator  end,
const TValue &  value 
)

binary_findDoes a binary search and returns an iterator to the value or end if not found.

Definition at line 429 of file algorithm.h.

etl::enable_if<!etl::is_random_iterator< TInputIterator >::value||!etl::is_random_iterator< TOutputIterator >::value, TOutputIterator >::type copy ( TInputIterator  i_begin,
TInputIterator  i_end,
TOutputIterator  o_begin,
TOutputIterator  o_end 
)

copy A form of copy where the smallest of the two ranges is used.

There is currently no STL equivalent. Specialisation for random access iterators.

Parameters:
i_beginBeginning of the input range.
i_endEnd of the input range.
o_beginBeginning of the output range.
o_endEnd of the output range.

There is currently no STL equivalent. Specialisation for non random access iterators.

Parameters:
i_beginBeginning of the input range.
i_endEnd of the input range.
o_beginBeginning of the output range.
o_endEnd of the output range.

Definition at line 221 of file algorithm.h.

TOutputIterator etl::copy_if ( TIterator  begin,
TIterator  end,
TOutputIterator  out,
TUnaryPredicate  predicate 
)

copy_ifa href="http://en.cppreference.com/w/cpp/algorithm/copy">

Definition at line 349 of file algorithm.h.

TOutputIterator etl::copy_if ( TInputIterator  i_begin,
TInputIterator  i_end,
TOutputIterator  o_begin,
TOutputIterator  o_end,
TUnaryPredicate  predicate 
)

copy_if A form of copy_if where it terminates when the first end iterator is reached.

There is currently no STL equivelent.

Definition at line 376 of file algorithm.h.

etl::enable_if<!etl::is_random_iterator< TInputIterator >::value, TOutputIterator >::type copy_n ( TInputIterator  i_begin,
TSize  n,
TOutputIterator  o_begin 
)

copy_n (Random input iterators)a href="http://en.cppreference.com/w/cpp/algorithm/copy_n">

copy_n (Non-random input iterators)

a href="http://en.cppreference.com/w/cpp/algorithm/copy_n">

Definition at line 270 of file algorithm.h.

TOutputIterator etl::copy_n ( TInputIterator  i_begin,
TSize  n,
TOutputIterator  o_begin,
TOutputIterator  o_end 
)

copy_n A form of copy_n where the smallest of the two ranges is used.

Definition at line 306 of file algorithm.h.

TOutputIterator etl::copy_n ( TInputIterator  i_begin,
TSize1  n1,
TOutputIterator  o_begin,
TSize2  n2 
)

copy_n A form of copy_n where the smallest of the two ranges is used.

Definition at line 328 of file algorithm.h.

TOutputIterator etl::copy_n_if ( TInputIterator  i_begin,
TSize  n,
TOutputIterator  o_begin,
TUnaryPredicate  predicate 
)

copy_n_if Combination of copy_n and copy_if.

Definition at line 404 of file algorithm.h.

TIterator etl::find_if_not ( TIterator  begin,
TIterator  end,
TUnaryPredicate  predicate 
)

find_if_nota href="http://en.cppreference.com/w/cpp/algorithm/find">

Definition at line 475 of file algorithm.h.

TUnaryFunction etl::for_each_if ( TIterator  begin,
const TIterator  end,
TUnaryFunction  function,
TUnaryPredicate  predicate 
)

Like std::for_each but applies a predicate before calling the function.

Definition at line 760 of file algorithm.h.

TIterator etl::for_each_n ( TIterator  begin,
TSize  n,
TUnaryFunction  function 
)

Like std::for_each but for 'n' iterations.

Definition at line 785 of file algorithm.h.

TIterator etl::for_each_n_if ( TIterator  begin,
TSize  n,
TUnaryFunction  function,
TUnaryPredicate  predicate 
)

Like std::for_each but applies a predicate before calling the function, for 'n' iterations.

Definition at line 805 of file algorithm.h.

bool etl::is_partitioned ( TIterator  begin,
TIterator  end,
TUnaryPredicate  predicate 
)

is_partitioneda href="http://en.cppreference.com/w/cpp/algorithm/is_partitioned">

Definition at line 675 of file algorithm.h.

bool etl::is_permutation ( TIterator1  begin1,
TIterator1  end1,
TIterator2  begin2 
)

is_permutationa href="http://en.cppreference.com/w/cpp/algorithm/is_permutation">

Definition at line 541 of file algorithm.h.

bool etl::is_permutation ( TIterator1  begin1,
TIterator1  end1,
TIterator2  begin2,
TIterator2  end2 
)

is_permutationa href="http://en.cppreference.com/w/cpp/algorithm/is_permutation">

Definition at line 575 of file algorithm.h.

bool etl::is_permutation ( TIterator1  begin1,
TIterator1  end1,
TIterator2  begin2,
TBinaryPredicate  predicate 
)

is_permutationa href="http://en.cppreference.com/w/cpp/algorithm/is_permutation">

Definition at line 607 of file algorithm.h.

bool etl::is_permutation ( TIterator1  begin1,
TIterator1  end1,
TIterator2  begin2,
TIterator2  end2,
TBinaryPredicate  predicate 
)

is_permutationa href="http://en.cppreference.com/w/cpp/algorithm/is_permutation">

Definition at line 643 of file algorithm.h.

bool etl::is_sorted ( TIterator  begin,
TIterator  end,
TCompare  compare 
)

is_sorteda href="http://en.cppreference.com/w/cpp/algorithm/is_sorted">

Definition at line 199 of file algorithm.h.

bool etl::is_sorted ( TIterator  begin,
TIterator  end 
)

is_sorteda href="http://en.cppreference.com/w/cpp/algorithm/is_sorted">

Definition at line 186 of file algorithm.h.

TIterator etl::is_sorted_until ( TIterator  begin,
TIterator  end 
)

is_sorted_untila href="http://en.cppreference.com/w/cpp/algorithm/is_sorted_until">

Definition at line 130 of file algorithm.h.

TIterator etl::is_sorted_until ( TIterator  begin,
TIterator  end,
TCompare  compare 
)

is_sorted_untila href="http://en.cppreference.com/w/cpp/algorithm/is_sorted_until">

Definition at line 158 of file algorithm.h.

std::pair<const T&, const T&> etl::minmax ( const T &  a,
const T &  b 
)

minmaxa href="http://en.cppreference.com/w/cpp/algorithm/minmax">

Definition at line 104 of file algorithm.h.

std::pair<const T&, const T&> etl::minmax ( const T &  a,
const T &  b,
TCompare  compare 
)

minmaxa href="http://en.cppreference.com/w/cpp/algorithm/minmax">

Definition at line 117 of file algorithm.h.

std::pair<TIterator, TIterator> etl::minmax_element ( TIterator  begin,
TIterator  end 
)

minmax_elementa href="http://en.cppreference.com/w/cpp/algorithm/minmax_element">

Definition at line 90 of file algorithm.h.

std::pair<TIterator, TIterator> etl::minmax_element ( TIterator  begin,
TIterator  end,
TCompare  compare 
)

Finds the greatest and the smallest element in the range (begin, end).


a href="http://en.cppreference.com/w/cpp/algorithm/minmax_element">

Definition at line 59 of file algorithm.h.

bool etl::none_of ( TIterator  begin,
TIterator  end,
TUnaryPredicate  predicate 
)

none_ofa href="http://en.cppreference.com/w/cpp/algorithm/all_any_none_of">

Definition at line 527 of file algorithm.h.

std::pair<TDestinationTrue, TDestinationFalse> etl::partition_copy ( TSource  begin,
TSource  end,
TDestinationTrue  destination_true,
TDestinationFalse  destination_false,
TUnaryPredicate  predicate 
)

Copies the elements from the range (begin, end) to two different ranges depending on the value returned by the predicate.


a href="http://en.cppreference.com/w/cpp/algorithm/partition_copy">

Definition at line 732 of file algorithm.h.

TIterator etl::partition_point ( TIterator  begin,
TIterator  end,
TUnaryPredicate  predicate 
)

partition_point a href="http://en.cppreference.com/w/cpp/algorithm/partition_point">

Definition at line 705 of file algorithm.h.

std::pair<TDestinationTrue, TDestinationFalse> etl::partition_transform ( TSource  begin,
TSource  end,
TDestinationTrue  destination_true,
TDestinationFalse  destination_false,
TUnaryFunctionTrue  function_true,
TUnaryFunctionFalse  function_false,
TUnaryPredicate  predicate 
)

Transforms the elements from the range (begin, end) to two different ranges depending on the value returned by the predicate.


Definition at line 1058 of file algorithm.h.

std::pair<TDestinationTrue, TDestinationFalse> etl::partition_transform ( TSource1  begin1,
TSource1  end1,
TSource2  begin2,
TDestinationTrue  destination_true,
TDestinationFalse  destination_false,
TBinaryFunctionTrue  function_true,
TBinaryFunctionFalse  function_false,
TBinaryPredicate  predicate 
)

Transforms the elements from the ranges (begin1, end1) & (begin2) to two different ranges depending on the value returned by the predicate.

Definition at line 1093 of file algorithm.h.

void etl::transform ( TInputIterator  i_begin,
TInputIterator  i_end,
TOutputIterator  o_begin,
TOutputIterator  o_end,
TUnaryFunction  function 
)

A form of std::transform where the transform returns when the first range end is reached.

There is currently no STL equivalent.

Definition at line 832 of file algorithm.h.

TOutputIterator etl::transform_if ( TInputIterator  i_begin,
const TInputIterator  i_end,
TOutputIterator  o_begin,
TUnaryFunction  function,
TUnaryPredicate  predicate 
)

Like std::transform but applies a predicate before calling the function.

Definition at line 942 of file algorithm.h.

TOutputIterator etl::transform_if ( TInputIterator1  i_begin1,
const TInputIterator1  i_end1,
TInputIterator2  i_begin2,
TOutputIterator  o_begin,
TBinaryFunction  function,
TBinaryPredicate  predicate 
)

Like etl::transform_if but inputs from two ranges.

Definition at line 970 of file algorithm.h.

etl::enable_if<!etl::is_random_iterator< TInputIterator1 >::value||!etl::is_random_iterator< TInputIterator2 >::value, void >::type transform_n ( TInputIterator1  i_begin1,
TInputIterator2  i_begin2,
TSize  n,
TOutputIterator  o_begin,
TBinaryFunction  function 
)

Transform 'n' items from two ranges.

Random iterators. There is currently no STL equivalent.

Non-random iterators. There is currently no STL equivalent.

Definition at line 876 of file algorithm.h.

etl::enable_if<!etl::is_random_iterator< TInputIterator >::value, void >::type transform_n ( TInputIterator  i_begin,
TSize  n,
TOutputIterator  o_begin,
TUnaryFunction  function 
)

Transform 'n' items.

Random iterators. There is currently no STL equivalent.

Non-random iterators. There is currently no STL equivalent.

Definition at line 855 of file algorithm.h.

TOutputIterator etl::transform_n_if ( TInputIterator  i_begin,
TSize  n,
TOutputIterator  o_begin,
TUnaryFunction  function,
TUnaryPredicate  predicate 
)

Like std::transform_if, for 'n' items.

Definition at line 1000 of file algorithm.h.

TOutputIterator etl::transform_n_if ( TInputIterator1  i_begin1,
TInputIterator2  i_begin2,
TSize  n,
TOutputIterator  o_begin,
TBinaryFunction  function,
TBinaryPredicate  predicate 
)

Like etl::transform_if but inputs from two ranges for 'n' items.

Definition at line 1029 of file algorithm.h.