NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
nc::stl_algorithms Namespace Reference

Functions

template<class InputIt , class UnaryPredicate >
bool all_of (InputIt first, InputIt last, UnaryPredicate p) noexcept
 
template<class InputIt , class UnaryPredicate >
bool any_of (InputIt first, InputIt last, UnaryPredicate p) noexcept
 
template<class InputIt , class OutputIt >
OutputIt copy (InputIt first, InputIt last, OutputIt destination) noexcept
 
template<class InputIt , class T >
std::iterator_traits< InputIt >::difference_type count (InputIt first, InputIt last, const T &value) noexcept
 
template<class InputIt1 , class InputIt2 >
bool equal (InputIt1 first1, InputIt1 last1, InputIt2 first2) noexcept
 
template<class InputIt1 , class InputIt2 , class BinaryPredicate >
bool equal (InputIt1 first1, InputIt1 last1, InputIt2 first2, BinaryPredicate p) noexcept
 
template<class ForwardIt , class T >
void fill (ForwardIt first, ForwardIt last, const T &value) noexcept
 
template<class InputIt , class T >
InputIt find (InputIt first, InputIt last, const T &value) noexcept
 
template<class InputIt , class UnaryFunction >
void for_each (InputIt first, InputIt last, UnaryFunction f)
 
template<class ForwardIt >
bool is_sorted (ForwardIt first, ForwardIt last) noexcept
 
template<class ForwardIt , class Compare >
bool is_sorted (ForwardIt first, ForwardIt last, Compare comp) noexcept
 
template<class ForwardIt >
ForwardIt max_element (ForwardIt first, ForwardIt last) noexcept
 
template<class ForwardIt , class Compare >
ForwardIt max_element (ForwardIt first, ForwardIt last, Compare comp) noexcept
 
template<class ForwardIt >
ForwardIt min_element (ForwardIt first, ForwardIt last) noexcept
 
template<class ForwardIt , class Compare >
ForwardIt min_element (ForwardIt first, ForwardIt last, Compare comp) noexcept
 
template<class ForwardIt >
std::pair< ForwardIt, ForwardIt > minmax_element (ForwardIt first, ForwardIt last) noexcept
 
template<class ForwardIt , class Compare >
std::pair< ForwardIt, ForwardIt > minmax_element (ForwardIt first, ForwardIt last, Compare comp) noexcept
 
template<class InputIt , class UnaryPredicate >
bool none_of (InputIt first, InputIt last, UnaryPredicate p) noexcept
 
template<class RandomIt >
void nth_element (RandomIt first, RandomIt nth, RandomIt last) noexcept
 
template<class RandomIt , class Compare >
void nth_element (RandomIt first, RandomIt nth, RandomIt last, Compare comp) noexcept
 
template<class ForwardIt , class T >
void replace (ForwardIt first, ForwardIt last, const T &oldValue, const T &newValue) noexcept
 
template<class BidirIt >
void reverse (BidirIt first, BidirIt last) noexcept
 
template<class ForwardIt >
void rotate (ForwardIt first, ForwardIt firstN, ForwardIt last) noexcept
 
template<class InputIt1 , class InputIt2 , class OutputIt >
OutputIt set_difference (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination)
 
template<class InputIt1 , class InputIt2 , class OutputIt , class Compare >
OutputIt set_difference (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination, Compare comp) noexcept
 
template<class InputIt1 , class InputIt2 , class OutputIt >
OutputIt set_intersection (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination) noexcept
 
template<class InputIt1 , class InputIt2 , class OutputIt , class Compare >
OutputIt set_intersection (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination, Compare comp) noexcept
 
template<class InputIt1 , class InputIt2 , class OutputIt >
OutputIt set_union (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination) noexcept
 
template<class InputIt1 , class InputIt2 , class OutputIt , class Compare >
OutputIt set_union (InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt destination, Compare comp) noexcept
 
template<class RandomIt >
void sort (RandomIt first, RandomIt last) noexcept
 
template<class RandomIt , class Compare >
void sort (RandomIt first, RandomIt last, Compare comp) noexcept
 
template<class RandomIt >
void stable_sort (RandomIt first, RandomIt last) noexcept
 
template<class RandomIt , class Compare >
void stable_sort (RandomIt first, RandomIt last, Compare comp) noexcept
 
template<class InputIt , class OutputIt , class UnaryOperation >
OutputIt transform (InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
 
template<class InputIt1 , class InputIt2 , class OutputIt , class BinaryOperation >
OutputIt transform (InputIt1 first1, InputIt1 last1, InputIt2 first2, OutputIt destination, BinaryOperation unaryFunction)
 
template<class InputIt , class OutputIt >
constexpr OutputIt unique_copy (InputIt first, InputIt last, OutputIt destination) noexcept
 
template<class InputIt , class OutputIt , class BinaryPredicate >
constexpr OutputIt unique_copy (InputIt first, InputIt last, OutputIt destination, BinaryPredicate binaryFunction) noexcept
 

Function Documentation

◆ all_of()

template<class InputIt , class UnaryPredicate >
bool nc::stl_algorithms::all_of ( InputIt  first,
InputIt  last,
UnaryPredicate  p 
)
noexcept

Tests if all of the elements of a range satisy a predicate

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
punary predicate function
Returns
bool

◆ any_of()

template<class InputIt , class UnaryPredicate >
bool nc::stl_algorithms::any_of ( InputIt  first,
InputIt  last,
UnaryPredicate  p 
)
noexcept

Tests if any of the elements of a range satisy a predicate

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
punary predicate function
Returns
bool

◆ copy()

template<class InputIt , class OutputIt >
OutputIt nc::stl_algorithms::copy ( InputIt  first,
InputIt  last,
OutputIt  destination 
)
noexcept

Copies from one container to another

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
destinationthe first iterator of the destination
Returns
OutputIt

◆ count()

template<class InputIt , class T >
std::iterator_traits< InputIt >::difference_type nc::stl_algorithms::count ( InputIt  first,
InputIt  last,
const T &  value 
)
noexcept

Counts the values in the range

Parameters
firstthe first iterator of container
lastthe last iterator of container
valuethe initial value
Returns
count

◆ equal() [1/2]

template<class InputIt1 , class InputIt2 >
bool nc::stl_algorithms::equal ( InputIt1  first1,
InputIt1  last1,
InputIt2  first2 
)
noexcept

Test if two ranges are equal

Parameters
first1the first iterator of first container
last1the last iterator of first container
first2the first iterator of second container
Returns
bool

◆ equal() [2/2]

template<class InputIt1 , class InputIt2 , class BinaryPredicate >
bool nc::stl_algorithms::equal ( InputIt1  first1,
InputIt1  last1,
InputIt2  first2,
BinaryPredicate  p 
)
noexcept

Test if two ranges are equal

Parameters
first1the first iterator of first container
last1the last iterator of first container
first2the first iterator of second container
pbinary predicate to compare the elements
Returns
bool

◆ fill()

template<class ForwardIt , class T >
void nc::stl_algorithms::fill ( ForwardIt  first,
ForwardIt  last,
const T &  value 
)
noexcept

Fills the range with the value

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
valuethe function to apply to the input iterators

◆ find()

template<class InputIt , class T >
InputIt nc::stl_algorithms::find ( InputIt  first,
InputIt  last,
const T &  value 
)
noexcept

Returns the first element in the range [first, last) that satisfies specific criteria:

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
valuethe value to find
Returns
InputIt

◆ for_each()

template<class InputIt , class UnaryFunction >
void nc::stl_algorithms::for_each ( InputIt  first,
InputIt  last,
UnaryFunction  f 
)

Runs the function on each element of the range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
fthe function to apply to the input iterators

◆ is_sorted() [1/2]

template<class ForwardIt >
bool nc::stl_algorithms::is_sorted ( ForwardIt  first,
ForwardIt  last 
)
noexcept

Returns true if the array is sorted

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
Returns
bool true if sorted

◆ is_sorted() [2/2]

template<class ForwardIt , class Compare >
bool nc::stl_algorithms::is_sorted ( ForwardIt  first,
ForwardIt  last,
Compare  comp 
)
noexcept

Returns true if the array is sorted

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
compcomparitor function
Returns
bool true if sorted

◆ max_element() [1/2]

template<class ForwardIt >
ForwardIt nc::stl_algorithms::max_element ( ForwardIt  first,
ForwardIt  last 
)
noexcept

Returns the maximum element of the range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
Returns
ForwordIt

◆ max_element() [2/2]

template<class ForwardIt , class Compare >
ForwardIt nc::stl_algorithms::max_element ( ForwardIt  first,
ForwardIt  last,
Compare  comp 
)
noexcept

Returns the maximum element of the range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
compthe comparitor function
Returns
ForwordIt

◆ min_element() [1/2]

template<class ForwardIt >
ForwardIt nc::stl_algorithms::min_element ( ForwardIt  first,
ForwardIt  last 
)
noexcept

Returns the minimum element of the range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
Returns
ForwardIt

◆ min_element() [2/2]

template<class ForwardIt , class Compare >
ForwardIt nc::stl_algorithms::min_element ( ForwardIt  first,
ForwardIt  last,
Compare  comp 
)
noexcept

Returns the minimum element of the range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
compthe comparitor function
Returns
ForwordIt

◆ minmax_element() [1/2]

template<class ForwardIt >
std::pair< ForwardIt, ForwardIt > nc::stl_algorithms::minmax_element ( ForwardIt  first,
ForwardIt  last 
)
noexcept

Runs the minimum and maximum elements of the range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
Returns
std::pair

◆ minmax_element() [2/2]

template<class ForwardIt , class Compare >
std::pair< ForwardIt, ForwardIt > nc::stl_algorithms::minmax_element ( ForwardIt  first,
ForwardIt  last,
Compare  comp 
)
noexcept

Runs the minimum and maximum elements of the range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
compthe comparitor function
Returns
std::pair

◆ none_of()

template<class InputIt , class UnaryPredicate >
bool nc::stl_algorithms::none_of ( InputIt  first,
InputIt  last,
UnaryPredicate  p 
)
noexcept

Tests if none of the elements of a range satisy a predicate

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
punary predicate function
Returns
bool

◆ nth_element() [1/2]

template<class RandomIt >
void nc::stl_algorithms::nth_element ( RandomIt  first,
RandomIt  nth,
RandomIt  last 
)
noexcept

Sorts up to the nth element

Parameters
firstthe first iterator of the range
nththe element that should be sorted
lastthe last iterator of the range

◆ nth_element() [2/2]

template<class RandomIt , class Compare >
void nc::stl_algorithms::nth_element ( RandomIt  first,
RandomIt  nth,
RandomIt  last,
Compare  comp 
)
noexcept

Sorts up to the nth element

Parameters
firstthe first iterator of the range
nththe element that should be sorted
lastthe last iterator of the range
compthe comparitor function

◆ replace()

template<class ForwardIt , class T >
void nc::stl_algorithms::replace ( ForwardIt  first,
ForwardIt  last,
const T &  oldValue,
const T &  newValue 
)
noexcept

replaces a value in the range with another value

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
oldValuethe value to replace
newValuethe replacement value

◆ reverse()

template<class BidirIt >
void nc::stl_algorithms::reverse ( BidirIt  first,
BidirIt  last 
)
noexcept

reverses the range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source

◆ rotate()

template<class ForwardIt >
void nc::stl_algorithms::rotate ( ForwardIt  first,
ForwardIt  firstN,
ForwardIt  last 
)
noexcept

Rotates the elements of a range

Parameters
firstthe first iterator of the range
firstNthe element that should appear at the beginning of the rotated range
lastthe last iterator of the range

◆ set_difference() [1/2]

template<class InputIt1 , class InputIt2 , class OutputIt >
OutputIt nc::stl_algorithms::set_difference ( InputIt1  first1,
InputIt1  last1,
InputIt2  first2,
InputIt2  last2,
OutputIt  destination 
)

finds the difference of two ranges

Parameters
first1the first iterator of the source
last1the last iterator of the source
first2the first iterator of the second source
last2the first iterator of the destination
destinationthe function to apply to the input iterators
Returns
OutputIt

◆ set_difference() [2/2]

template<class InputIt1 , class InputIt2 , class OutputIt , class Compare >
OutputIt nc::stl_algorithms::set_difference ( InputIt1  first1,
InputIt1  last1,
InputIt2  first2,
InputIt2  last2,
OutputIt  destination,
Compare  comp 
)
noexcept

finds the difference of two ranges

Parameters
first1the first iterator of the source
last1the last iterator of the source
first2the first iterator of the second source
last2the first iterator of the destination
destinationthe function to apply to the input iterators
compcomparitor function
Returns
OutputIt

◆ set_intersection() [1/2]

template<class InputIt1 , class InputIt2 , class OutputIt >
OutputIt nc::stl_algorithms::set_intersection ( InputIt1  first1,
InputIt1  last1,
InputIt2  first2,
InputIt2  last2,
OutputIt  destination 
)
noexcept

finds the intersection of two ranges

Parameters
first1the first iterator of the source
last1the last iterator of the source
first2the first iterator of the second source
last2the first iterator of the destination
destinationthe function to apply to the input iterators
Returns
OutputIt

◆ set_intersection() [2/2]

template<class InputIt1 , class InputIt2 , class OutputIt , class Compare >
OutputIt nc::stl_algorithms::set_intersection ( InputIt1  first1,
InputIt1  last1,
InputIt2  first2,
InputIt2  last2,
OutputIt  destination,
Compare  comp 
)
noexcept

finds the intersection of two ranges

Parameters
first1the first iterator of the source
last1the last iterator of the source
first2the first iterator of the second source
last2the first iterator of the destination
destinationthe function to apply to the input iterators
compcomparitor function
Returns
OutputIt

◆ set_union() [1/2]

template<class InputIt1 , class InputIt2 , class OutputIt >
OutputIt nc::stl_algorithms::set_union ( InputIt1  first1,
InputIt1  last1,
InputIt2  first2,
InputIt2  last2,
OutputIt  destination 
)
noexcept

finds the union of two ranges

Parameters
first1the first iterator of the source
last1the last iterator of the source
first2the first iterator of the second source
last2the first iterator of the destination
destinationthe function to apply to the input iterators
Returns
OutputIt

◆ set_union() [2/2]

template<class InputIt1 , class InputIt2 , class OutputIt , class Compare >
OutputIt nc::stl_algorithms::set_union ( InputIt1  first1,
InputIt1  last1,
InputIt2  first2,
InputIt2  last2,
OutputIt  destination,
Compare  comp 
)
noexcept

finds the union of two ranges

Parameters
first1the first iterator of the source
last1the last iterator of the source
first2the first iterator of the second source
last2the first iterator of the destination
destinationthe function to apply to the input iterators
compcomparitor function
Returns
OutputIt

◆ sort() [1/2]

template<class RandomIt >
void nc::stl_algorithms::sort ( RandomIt  first,
RandomIt  last 
)
noexcept

Sorts the range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source

◆ sort() [2/2]

template<class RandomIt , class Compare >
void nc::stl_algorithms::sort ( RandomIt  first,
RandomIt  last,
Compare  comp 
)
noexcept

Sorts the range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
compthe comparitor function

◆ stable_sort() [1/2]

template<class RandomIt >
void nc::stl_algorithms::stable_sort ( RandomIt  first,
RandomIt  last 
)
noexcept

Sorts the range preserving order

Parameters
firstthe first iterator of the source
lastthe last iterator of the source

◆ stable_sort() [2/2]

template<class RandomIt , class Compare >
void nc::stl_algorithms::stable_sort ( RandomIt  first,
RandomIt  last,
Compare  comp 
)
noexcept

Sorts the range preserving order

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
compthe comparitor function

◆ transform() [1/2]

template<class InputIt , class OutputIt , class UnaryOperation >
OutputIt nc::stl_algorithms::transform ( InputIt  first,
InputIt  last,
OutputIt  destination,
UnaryOperation  unaryFunction 
)

Transforms the elements of the range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
destinationthe first iterator of the destination
unaryFunctionthe function to apply to the input iterators
Returns
OutputIt

◆ transform() [2/2]

template<class InputIt1 , class InputIt2 , class OutputIt , class BinaryOperation >
OutputIt nc::stl_algorithms::transform ( InputIt1  first1,
InputIt1  last1,
InputIt2  first2,
OutputIt  destination,
BinaryOperation  unaryFunction 
)

Transforms the elements of the range

Parameters
first1the first iterator of the source
last1the last iterator of the source
first2the first iterator of the second source
destinationthe first iterator of the destination
unaryFunctionthe function to apply to the input iterators
Returns
OutputIt

◆ unique_copy() [1/2]

template<class InputIt , class OutputIt >
constexpr OutputIt nc::stl_algorithms::unique_copy ( InputIt  first,
InputIt  last,
OutputIt  destination 
)
constexprnoexcept

Copies the unique elements of a range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
destinationthe first iterator of the destination
Returns
OutputIt

◆ unique_copy() [2/2]

template<class InputIt , class OutputIt , class BinaryPredicate >
constexpr OutputIt nc::stl_algorithms::unique_copy ( InputIt  first,
InputIt  last,
OutputIt  destination,
BinaryPredicate  binaryFunction 
)
constexprnoexcept

Copies the unique elements of a range

Parameters
firstthe first iterator of the source
lastthe last iterator of the source
destinationthe first iterator of the destination
binaryFunctionthe function to apply to the input iterators
Returns
OutputIt