Modules | Functions
Mutating Algorithms

Modules

 Generator Algorithms
 
 Heap Algorithms
 
 Numeric Algorithms
 
 Raw Storage Algorithms
 
 Set Algorithms
 
 Sorting Algorithms
 
 Swap Algorithms
 

Functions

template<typename ForwardIterator , typename T >
void ustl::replace (ForwardIterator first, ForwardIterator last, const T &old_value, const T &new_value)
 
template<typename InputIterator , typename OutputIterator , typename T >
OutputIterator ustl::replace_copy (InputIterator first, InputIterator last, OutputIterator result, const T &old_value, const T &new_value)
 
template<typename BidirectionalIterator >
void ustl::reverse (BidirectionalIterator first, BidirectionalIterator last)
 Reverse reverses a range. That is: for every i such that 0 <= i <= (last - first) / 2), it exchanges *(first + i) and *(last - (i + 1)).
 
template<typename BidirectionalIterator , typename OutputIterator >
OutputIterator ustl::reverse_copy (BidirectionalIterator first, BidirectionalIterator last, OutputIterator result)
 Reverses [first,last) and writes it to output.
 
template<typename ForwardIterator >
ForwardIterator ustl::rotate (ForwardIterator first, ForwardIterator middle, ForwardIterator last)
 Exchanges ranges [first, middle) and [middle, last)
 
template<typename ForwardIterator , typename OutputIterator >
OutputIterator ustl::rotate_copy (ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result)
 Exchanges ranges [first, middle) and [middle, last) into result.
 
template<typename InputIterator , typename OutputIterator , typename T >
OutputIterator ustl::remove_copy (InputIterator first, InputIterator last, OutputIterator result, const T &value)
 
template<typename InputIterator , typename OutputIterator , typename RInputIterator >
OutputIterator ustl::remove_copy (InputIterator first, InputIterator last, OutputIterator result, RInputIterator rfirst, RInputIterator rlast)
 
template<typename ForwardIterator , typename T >
ForwardIterator ustl::remove (ForwardIterator first, ForwardIterator last, const T &value)
 
template<typename InputIterator , typename OutputIterator >
OutputIterator ustl::unique_copy (InputIterator first, InputIterator last, OutputIterator result)
 
template<typename ForwardIterator >
ForwardIterator ustl::unique (ForwardIterator first, ForwardIterator last)
 
template<typename InputIterator , typename OutputIterator >
OutputIterator ustl::copy (InputIterator first, InputIterator last, OutputIterator result)
 
template<typename InputIterator , typename OutputIterator >
OutputIterator ustl::copy_n (InputIterator first, size_t count, OutputIterator result)
 
template<typename InputIterator , typename OutputIterator >
OutputIterator ustl::copy_backward (InputIterator first, InputIterator last, OutputIterator result)
 Copy copies elements from the range (last, first] to result.Copies elements starting at last, decrementing both last and result.
 
template<typename InputIterator , typename UnaryFunction >
UnaryFunction ustl::for_each (InputIterator first, InputIterator last, UnaryFunction f)
 
template<typename Container , typename OutputIterator >
OutputIterator ustl::copy (const Container &ctr, OutputIterator result)
 
template<typename Container , typename OutputIterator , typename Predicate >
OutputIterator ustl::copy_if (Container &ctr, OutputIterator result, Predicate pred)
 
template<typename Container , typename UnaryFunction >
UnaryFunction ustl::for_each (Container &ctr, UnaryFunction f)
 
template<typename Container , typename UnaryFunction >
UnaryFunction ustl::for_each (const Container &ctr, UnaryFunction f)
 
template<typename Container , typename UnaryFunction >
void ustl::transform (Container &ctr, UnaryFunction op)
 
template<typename Container , typename OutputIterator , typename UnaryFunction >
OutputIterator ustl::transform (Container &ctr, OutputIterator result, UnaryFunction op)
 
template<typename Container , typename InputIterator , typename OutputIterator , typename BinaryFunction >
OutputIterator ustl::transform (Container &ctr, InputIterator first, OutputIterator result, BinaryFunction op)
 
template<typename Container , typename T >
void ustl::replace (Container &ctr, const T &old_value, const T &new_value)
 
template<typename Container , typename Predicate , typename T >
void ustl::replace_if (Container &ctr, Predicate pred, const T &new_value)
 
template<typename Container , typename OutputIterator , typename T >
OutputIterator ustl::replace_copy (const Container &ctr, OutputIterator result, const T &old_value, const T &new_value)
 
template<typename Container , typename OutputIterator , typename Predicate , typename T >
OutputIterator ustl::replace_copy_if (const Container &ctr, OutputIterator result, Predicate pred, const T &new_value)
 
template<typename Container , typename OutputIterator , typename T >
OutputIterator ustl::remove_copy (const Container &ctr, OutputIterator result, const T &value)
 
template<typename Container , typename OutputIterator , typename Predicate >
OutputIterator ustl::remove_copy_if (const Container &ctr, OutputIterator result, Predicate pred)
 
template<typename Container , typename T >
void ustl::remove (Container &ctr, const T &value)
 
template<typename Container , typename ForwardIterator >
void ustl::remove (Container &ctr, ForwardIterator rfirst, ForwardIterator rlast)
 
template<typename Container , typename Predicate >
void ustl::remove_if (Container &ctr, Predicate pred)
 
template<typename Container , typename OutputIterator >
OutputIterator ustl::unique_copy (const Container &ctr, OutputIterator result)
 
template<typename Container >
void ustl::unique (Container &ctr)
 
template<typename Container , typename BinaryPredicate >
void ustl::unique (Container &ctr, BinaryPredicate binary_pred)
 
template<typename Container >
void ustl::reverse (Container &ctr)
 
template<typename Container >
void ustl::rotate (Container &ctr, off_t offset)
 
template<typename RandomAccessIterator , typename Compare >
void ustl::push_heap (RandomAccessIterator first, RandomAccessIterator last, Compare comp)
 Inserts the *–last into the preceeding range assumed to be a heap.
 
template<typename RandomAccessIterator , typename Compare >
void ustl::pop_heap (RandomAccessIterator first, RandomAccessIterator last, Compare comp)
 

Detailed Description

Algorithms for modifying your data in some way.

Function Documentation

template<typename Container , typename OutputIterator >
OutputIterator ustl::copy ( const Container &  ctr,
OutputIterator  result 
)
inline

Copy copies elements from the range [first, last) to the range [result, result + (last - first)). That is, it performs the assignments *result = *first, *(result + 1) = *(first + 1), and so on. [1] Generally, for every integer n from 0 to last - first, copy performs the assignment *(result + n) = *(first + n). Assignments are performed in forward order, i.e. in order of increasing n.

References ustl::copy().

template<typename InputIterator , typename OutputIterator >
OutputIterator ustl::copy ( InputIterator  first,
InputIterator  last,
OutputIterator  result 
)
inline

Copy copies elements from the range [first, last) to the range [result, result + (last - first)). That is, it performs the assignments *result = *first, *(result + 1) = *(first + 1), and so on. [1] Generally, for every integer n from 0 to last - first, copy performs the assignment *(result + n) = *(first + n). Assignments are performed in forward order, i.e. in order of increasing n.

Referenced by ustl::vector< T >::assign(), ustl::copy(), ustl::istringstream::getline(), ustl::merge(), ustl::rotate_copy(), ustl::set_difference(), ustl::set_symmetric_difference(), and ustl::set_union().

template<typename Container , typename OutputIterator , typename Predicate >
OutputIterator ustl::copy_if ( Container &  ctr,
OutputIterator  result,
Predicate  pred 
)
inline

Copy_if copies elements from the range [first, last) to the range [result, result + (last - first)) if pred(*i) returns true.

template<typename InputIterator , typename OutputIterator >
OutputIterator ustl::copy_n ( InputIterator  first,
size_t  count,
OutputIterator  result 
)
inline

Copy_n copies elements from the range [first, first + n) to the range [result, result + n). That is, it performs the assignments *result = *first, *(result + 1) = *(first + 1), and so on. Generally, for every integer i from 0 up to (but not including) n, copy_n performs the assignment *(result + i) = *(first + i). Assignments are performed in forward order, i.e. in order of increasing n.

References ustl::count().

Referenced by ustl::string::append(), ustl::memblock::assign(), ustl::string::assign(), ustl::string::copy(), ustl::memlink::fill(), ustl::indexv_to_iteratorv(), ustl::memblock::reserve(), and ustl::string::string().

template<typename Container , typename UnaryFunction >
UnaryFunction ustl::for_each ( Container &  ctr,
UnaryFunction  f 
)
inline

For_each applies the function object f to each element in the range [first, last); f's return value, if any, is ignored. Applications are performed in forward order, i.e. from first to last. For_each returns the function object after it has been applied to each element.

References ustl::for_each().

template<typename Container , typename UnaryFunction >
UnaryFunction ustl::for_each ( const Container &  ctr,
UnaryFunction  f 
)
inline

For_each applies the function object f to each element in the range [first, last); f's return value, if any, is ignored. Applications are performed in forward order, i.e. from first to last. For_each returns the function object after it has been applied to each element.

References ustl::for_each().

template<typename InputIterator , typename UnaryFunction >
UnaryFunction ustl::for_each ( InputIterator  first,
InputIterator  last,
UnaryFunction  f 
)
inline

For_each applies the function object f to each element in the range [first, last); f's return value, if any, is ignored. Applications are performed in forward order, i.e. from first to last. For_each returns the function object after it has been applied to each element.

Referenced by ustl::for_each().

template<typename RandomAccessIterator , typename Compare >
void ustl::pop_heap ( RandomAccessIterator  first,
RandomAccessIterator  last,
Compare  comp 
)

Removes the largest element from the heap (*first) and places it at *(last-1) [first, last-1) is a heap after this operation.

References ustl::iter_swap(), and ustl::make_heap().

Referenced by ustl::sort_heap().

template<typename Container , typename T >
void ustl::remove ( Container &  ctr,
const T &  value 
)
inline

Remove removes from the range [first, last) all elements that are equal to value. That is, remove returns an iterator new_last such that the range [first, new_last) contains no elements equal to value. Remove is stable, meaning that the relative order of elements that are not equal to value is unchanged.

References ustl::remove_copy().

template<typename Container , typename ForwardIterator >
void ustl::remove ( Container &  ctr,
ForwardIterator  rfirst,
ForwardIterator  rlast 
)
inline

Remove removes from the range [first, last) all elements that have an iterator in range [rfirst, rlast). The range is assumed to be sorted. That is, remove returns an iterator new_last such that the range [first, new_last) contains no elements whose iterators are in [rfirst, rlast). Remove is stable, meaning that the relative order of elements that are not equal to value is unchanged. This version of the algorithm is a uSTL extension.

References ustl::remove_copy().

template<typename ForwardIterator , typename T >
ForwardIterator ustl::remove ( ForwardIterator  first,
ForwardIterator  last,
const T &  value 
)
inline

Remove removes from the range [first, last) all elements that are equal to value. That is, remove returns an iterator new_last such that the range [first, new_last) contains no elements equal to value. [1] The iterators in the range [new_last, last) are all still dereferenceable, but the elements that they point to are unspecified. Remove is stable, meaning that the relative order of elements that are not equal to value is unchanged.

References ustl::remove_copy().

template<typename Container , typename OutputIterator , typename T >
OutputIterator ustl::remove_copy ( const Container &  ctr,
OutputIterator  result,
const T &  value 
)
inline

Remove_copy copies elements that are not equal to value from the range [first, last) to a range beginning at result. The return value is the end of the resulting range. This operation is stable, meaning that the relative order of the elements that are copied is the same as in the range [first, last).

References ustl::remove_copy().

template<typename InputIterator , typename OutputIterator , typename T >
OutputIterator ustl::remove_copy ( InputIterator  first,
InputIterator  last,
OutputIterator  result,
const T &  value 
)

Remove_copy copies elements that are not equal to value from the range [first, last) to a range beginning at result. The return value is the end of the resulting range. This operation is stable, meaning that the relative order of the elements that are copied is the same as in the range [first, last).

Referenced by ustl::remove(), and ustl::remove_copy().

template<typename InputIterator , typename OutputIterator , typename RInputIterator >
OutputIterator ustl::remove_copy ( InputIterator  first,
InputIterator  last,
OutputIterator  result,
RInputIterator  rfirst,
RInputIterator  rlast 
)

Remove_copy copies elements pointed to by iterators in [rfirst, rlast) from the range [first, last) to a range beginning at result. The return value is the end of the resulting range. This operation is stable, meaning that the relative order of the elements that are copied is the same as in the range [first, last). Range [rfirst, rlast) is assumed to be sorted. This algorithm is a uSTL extension.

template<typename Container , typename OutputIterator , typename Predicate >
OutputIterator ustl::remove_copy_if ( const Container &  ctr,
OutputIterator  result,
Predicate  pred 
)
inline

Remove_copy_if copies elements from the range [first, last) to a range beginning at result, except that elements for which pred is true are not copied. The return value is the end of the resulting range. This operation is stable, meaning that the relative order of the elements that are copied is the same as in the range [first, last).

Referenced by ustl::remove_if().

template<typename Container , typename Predicate >
void ustl::remove_if ( Container &  ctr,
Predicate  pred 
)
inline

Remove_if removes from the range [first, last) every element x such that pred(x) is true. That is, remove_if returns an iterator new_last such that the range [first, new_last) contains no elements for which pred is true. The iterators in the range [new_last, last) are all still dereferenceable, but the elements that they point to are unspecified. Remove_if is stable, meaning that the relative order of elements that are not removed is unchanged.

References ustl::remove_copy_if().

template<typename ForwardIterator , typename T >
void ustl::replace ( ForwardIterator  first,
ForwardIterator  last,
const T &  old_value,
const T &  new_value 
)
inline

Replace replaces every element in the range [first, last) equal to old_value with new_value. That is: for every iterator i, if *i == old_value then it performs the assignment *i = new_value.

Referenced by ustl::replace().

template<typename Container , typename T >
void ustl::replace ( Container &  ctr,
const T &  old_value,
const T &  new_value 
)
inline

Replace replaces every element in the range [first, last) equal to old_value with new_value. That is: for every iterator i, if *i == old_value then it performs the assignment *i = new_value.

References ustl::replace().

template<typename InputIterator , typename OutputIterator , typename T >
OutputIterator ustl::replace_copy ( InputIterator  first,
InputIterator  last,
OutputIterator  result,
const T &  old_value,
const T &  new_value 
)
inline

Replace_copy copies elements from the range [first, last) to the range [result, result + (last-first)), except that any element equal to old_value is not copied; new_value is copied instead. More precisely, for every integer n such that 0 <= n < last-first, replace_copy performs the assignment *(result+n) = new_value if *(first+n) == old_value, and *(result+n) = *(first+n) otherwise.

Referenced by ustl::replace_copy().

template<typename Container , typename OutputIterator , typename T >
OutputIterator ustl::replace_copy ( const Container &  ctr,
OutputIterator  result,
const T &  old_value,
const T &  new_value 
)
inline

Replace_copy copies elements from the range [first, last) to the range [result, result + (last-first)), except that any element equal to old_value is not copied; new_value is copied instead. More precisely, for every integer n such that 0 <= n < last-first, replace_copy performs the assignment *(result+n) = new_value if *(first+n) == old_value, and *(result+n) = *(first+n) otherwise.

References ustl::replace_copy().

template<typename Container , typename OutputIterator , typename Predicate , typename T >
OutputIterator ustl::replace_copy_if ( const Container &  ctr,
OutputIterator  result,
Predicate  pred,
const T &  new_value 
)
inline

Replace_copy_if copies elements from the range [first, last) to the range [result, result + (last-first)), except that any element for which pred is true is not copied; new_value is copied instead. More precisely, for every integer n such that 0 <= n < last-first, replace_copy_if performs the assignment *(result+n) = new_value if pred(*(first+n)), and *(result+n) = *(first+n) otherwise.

template<typename Container , typename Predicate , typename T >
void ustl::replace_if ( Container &  ctr,
Predicate  pred,
const T &  new_value 
)
inline

Replace_if replaces every element in the range [first, last) for which pred returns true with new_value. That is: for every iterator i, if pred(*i) is true then it performs the assignment *i = new_value.

template<typename Container >
void ustl::reverse ( Container &  ctr)
inline

Reverse reverses a range. That is: for every i such that 0 <= i <= (last - first) / 2), it exchanges *(first + i) and *(last - (i + 1)).

References ustl::reverse().

template<typename Container >
void ustl::rotate ( Container &  ctr,
off_t  offset 
)
inline

Exchanges ranges [first, middle) and [middle, last)

References ustl::rotate().

template<typename Container , typename UnaryFunction >
void ustl::transform ( Container &  ctr,
UnaryFunction  op 
)
inline

The first version of transform performs the operation op(*i) for each iterator i in the range [first, last), and assigns the result of that operation to *o, where o is the corresponding output iterator. That is, for each n such that 0 <= n < last - first, it performs the assignment *(result + n) = op(*(first + n)). The return value is result + (last - first).

References ustl::transform().

template<typename Container , typename OutputIterator , typename UnaryFunction >
OutputIterator ustl::transform ( Container &  ctr,
OutputIterator  result,
UnaryFunction  op 
)
inline

The first version of transform performs the operation op(*i) for each iterator i in the range [first, last), and assigns the result of that operation to *o, where o is the corresponding output iterator. That is, for each n such that 0 <= n < last - first, it performs the assignment *(result + n) = op(*(first + n)). The return value is result + (last - first).

References ustl::transform().

template<typename Container , typename InputIterator , typename OutputIterator , typename BinaryFunction >
OutputIterator ustl::transform ( Container &  ctr,
InputIterator  first,
OutputIterator  result,
BinaryFunction  op 
)
inline

The second version of transform is very similar, except that it uses a Binary Function instead of a Unary Function: it performs the operation op(*i1, *i2) for each iterator i1 in the range [first1, last1) and assigns the result to *o, where i2 is the corresponding iterator in the second input range and where o is the corresponding output iterator. That is, for each n such that 0 <= n < last1 - first1, it performs the assignment *(result + n) = op(*(first1 + n), *(first2 + n). The return value is result + (last1 - first1).

References ustl::transform().

template<typename Container >
void ustl::unique ( Container &  ctr)
inline

Every time a consecutive group of duplicate elements appears in the range [first, last), the algorithm unique removes all but the first element. That is, unique returns an iterator new_last such that the range [first, new_last) contains no two consecutive elements that are duplicates. The iterators in the range [new_last, last) are all still dereferenceable, but the elements that they point to are unspecified. Unique is stable, meaning that the relative order of elements that are not removed is unchanged.

References ustl::unique_copy().

template<typename Container , typename BinaryPredicate >
void ustl::unique ( Container &  ctr,
BinaryPredicate  binary_pred 
)
inline

Every time a consecutive group of duplicate elements appears in the range [first, last), the algorithm unique removes all but the first element. That is, unique returns an iterator new_last such that the range [first, new_last) contains no two consecutive elements that are duplicates. The iterators in the range [new_last, last) are all still dereferenceable, but the elements that they point to are unspecified. Unique is stable, meaning that the relative order of elements that are not removed is unchanged.

References ustl::unique_copy().

template<typename ForwardIterator >
ForwardIterator ustl::unique ( ForwardIterator  first,
ForwardIterator  last 
)
inline

Every time a consecutive group of duplicate elements appears in the range [first, last), the algorithm unique removes all but the first element. That is, unique returns an iterator new_last such that the range [first, new_last) contains no two consecutive elements that are duplicates. The iterators in the range [new_last, last) are all still dereferenceable, but the elements that they point to are unspecified. Unique is stable, meaning that the relative order of elements that are not removed is unchanged.

References ustl::unique_copy().

template<typename Container , typename OutputIterator >
OutputIterator ustl::unique_copy ( const Container &  ctr,
OutputIterator  result 
)
inline

Unique_copy copies elements from the range [first, last) to a range beginning with result, except that in a consecutive group of duplicate elements only the first one is copied. The return value is the end of the range to which the elements are copied. This behavior is similar to the Unix filter uniq.

References ustl::unique_copy().

template<typename InputIterator , typename OutputIterator >
OutputIterator ustl::unique_copy ( InputIterator  first,
InputIterator  last,
OutputIterator  result 
)

Unique_copy copies elements from the range [first, last) to a range beginning with result, except that in a consecutive group of duplicate elements only the first one is copied. The return value is the end of the range to which the elements are copied. This behavior is similar to the Unix filter uniq.

Referenced by ustl::unique(), and ustl::unique_copy().


Generated on Mon Sep 28 2015 17:58:50 for uSTL by Doxygen 1.8.10