stl_algobase.h File Reference

#include <bits/c++config.h>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <cstddef>
#include <new>
#include <iosfwd>
#include <bits/stl_pair.h>
#include <bits/type_traits.h>
#include <bits/stl_iterator_base_types.h>
#include <bits/stl_iterator_base_funcs.h>
#include <bits/stl_iterator.h>
#include <bits/concept_check.h>

Include dependency graph for stl_algobase.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  std

Functions

template<typename ForwardIter1, typename ForwardIter2>
void iter_swap (ForwardIter1 a, ForwardIter2 __b)
 Swaps the contents of two iterators.
template<typename Type>
void swap (Type &a, Type &__b)
 Swaps two values.
template<typename Type>
const Type & min (const Type &a, const Type &__b)
 This does what you think it does.
template<typename Type>
const Type & max (const Type &a, const Type &__b)
 This does what you think it does.
template<typename Type, typename Compare>
const Type & min (const Type &a, const Type &__b, Compare comp)
 This does what you think it does.
template<typename Type, typename Compare>
const Type & max (const Type &a, const Type &__b, Compare comp)
 This does what you think it does.
template<typename InputIter, typename OutputIter>
OutputIter copy (InputIter first, InputIter last, OutputIter __result)
 Copies the range [first,last) into result.
template<typename BI1, typename BI2>
BI2 copy_backward (BI1 first, BI1 last, BI2 __result)
 Copies the range [first,last) into result.
template<typename ForwardIter, typename Type>
void fill (ForwardIter first, ForwardIter last, const Type &value)
 Fills the range [first,last) with copies of value.
template<typename OutputIter, typename Size, typename Type>
OutputIter fill_n (OutputIter first, Size n, const Type &value)
 Fills the range [first,first+n) with copies of value.
template<typename InputIter1, typename InputIter2>
pair< InputIter1, InputIter2 > mismatch (InputIter1 first1, InputIter1 last1, InputIter2 first2)
 Finds the places in ranges which don't match.
template<typename InputIter1, typename InputIter2, typename BinaryPredicate>
pair< InputIter1, InputIter2 > mismatch (InputIter1 first1, InputIter1 last1, InputIter2 first2, BinaryPredicate __binary_pred)
 Finds the places in ranges which don't match.
template<typename InputIter1, typename InputIter2>
bool equal (InputIter1 first1, InputIter1 last1, InputIter2 first2)
 Tests a range for element-wise equality.
template<typename InputIter1, typename InputIter2, typename BinaryPredicate>
bool equal (InputIter1 first1, InputIter1 last1, InputIter2 first2, BinaryPredicate __binary_pred)
 Tests a range for element-wise equality.
template<typename InputIter1, typename InputIter2>
bool lexicographical_compare (InputIter1 first1, InputIter1 last1, InputIter2 first2, InputIter2 last2)
 Performs "dictionary" comparison on ranges.
template<typename InputIter1, typename InputIter2, typename Compare>
bool lexicographical_compare (InputIter1 first1, InputIter1 last1, InputIter2 first2, InputIter2 last2, Compare comp)
 Performs "dictionary" comparison on ranges.


Detailed Description

This is an internal header file, included by other library headers. You should not attempt to use it directly.

Definition in file stl_algobase.h.


Function Documentation

template<typename InputIter, typename OutputIter>
OutputIter copy InputIter  first,
InputIter  last,
OutputIter  __result
[inline]
 

Copies the range [first,last) into result.

Parameters:
first An input iterator.
last An input iterator.
result An output iterator.
Returns:
result + (first - last)
This inline function will boil down to a call to memmove whenever possible. Failing that, if random access iterators are passed, then the loop count will be known (and therefore a candidate for compiler optimizations such as unrolling). If the input range and the output range overlap, then the copy_backward function should be used instead.

Definition at line 341 of file stl_algobase.h.

Referenced by std::vector< Type, Alloc >::erase(), std::deque< Type, Alloc >::erase(), std::merge(), std::vector< Type, Alloc >::operator=(), std::deque< Type, Alloc >::operator=(), std::rotate_copy(), std::basic_streambuf< CharT, Traits >::xsgetn(), and std::basic_streambuf< CharT, Traits >::xsputn().

template<typename BI1, typename BI2>
BI2 copy_backward BI1  first,
BI1  last,
BI2  __result
[inline]
 

Copies the range [first,last) into result.

Parameters:
first An input iterator.
last An input iterator.
result An output iterator.
Returns:
result - (first - last)
The function has the same effect as copy, but starts at the end of the range and works its way to the start, returning the start of the result. This inline function will boil down to a call to memmove whenever possible. Failing that, if random access iterators are passed, then the loop count will be known (and therefore a candidate for compiler optimizations such as unrolling).

Definition at line 479 of file stl_algobase.h.

Referenced by std::deque< Type, Alloc >::erase().

template<typename InputIter1, typename InputIter2, typename BinaryPredicate>
bool equal InputIter1  first1,
InputIter1  last1,
InputIter2  first2,
BinaryPredicate  __binary_pred
[inline]
 

Tests a range for element-wise equality.

Parameters:
first1 An input iterator.
last1 An input iterator.
first2 An input iterator.
binary_pred A binary predicate functor.
Returns:
A boolean true or false.
This compares the elements of two ranges using the binary_pred parameter, and returns true or false depending on whether all of the corresponding elements of the ranges are equal.

Definition at line 701 of file stl_algobase.h.

template<typename InputIter1, typename InputIter2>
bool equal InputIter1  first1,
InputIter1  last1,
InputIter2  first2
[inline]
 

Tests a range for element-wise equality.

Parameters:
first1 An input iterator.
last1 An input iterator.
first2 An input iterator.
Returns:
A boolean true or false.
This compares the elements of two ranges using == and returns true or false depending on whether all of the corresponding elements of the ranges are equal.

Definition at line 670 of file stl_algobase.h.

Referenced by std::operator==().

template<typename ForwardIter, typename Type>
void fill ForwardIter  first,
ForwardIter  last,
const Type &  value
 

Fills the range [first,last) with copies of value.

Parameters:
first A forward iterator.
last A forward iterator.
value A reference-to-const of arbitrary type.
Returns:
Nothing.
This function fills a range with copies of the same value. For one-byte types filling contiguous areas of memory, this becomes an inline call to memset.

Definition at line 511 of file stl_algobase.h.

template<typename OutputIter, typename Size, typename Type>
OutputIter fill_n OutputIter  first,
Size  n,
const Type &  value
 

Fills the range [first,first+n) with copies of value.

Parameters:
first An output iterator.
n The count of copies to perform.
value A reference-to-const of arbitrary type.
Returns:
The iterator at first+n.
This function fills a range with copies of the same value. For one-byte types filling contiguous areas of memory, this becomes an inline call to memset.

Definition at line 533 of file stl_algobase.h.

template<typename ForwardIter1, typename ForwardIter2>
void iter_swap ForwardIter1  a,
ForwardIter2  __b
[inline]
 

Swaps the contents of two iterators.

Parameters:
a An iterator.
b Another iterator.
Returns:
Nothing.
This function swaps the values pointed to by two iterators, not the iterators themselves.

Definition at line 93 of file stl_algobase.h.

Referenced by std::random_shuffle(), and std::swap_ranges().

template<typename InputIter1, typename InputIter2, typename Compare>
bool lexicographical_compare InputIter1  first1,
InputIter1  last1,
InputIter2  first2,
InputIter2  last2,
Compare  comp
 

Performs "dictionary" comparison on ranges.

Parameters:
first1 An input iterator.
last1 An input iterator.
first2 An input iterator.
last2 An input iterator.
comp A comparison functor.
Returns:
A boolean true or false.
The same as the four-parameter lexigraphical_compare, but uses the comp parameter instead of <.

Definition at line 769 of file stl_algobase.h.

template<typename InputIter1, typename InputIter2>
bool lexicographical_compare InputIter1  first1,
InputIter1  last1,
InputIter2  first2,
InputIter2  last2
 

Performs "dictionary" comparison on ranges.

Parameters:
first1 An input iterator.
last1 An input iterator.
first2 An input iterator.
last2 An input iterator.
Returns:
A boolean true or false.
"Returns true if the sequence of elements defined by the range [first1,last1) is lexicographically less than the sequence of elements defined by the range [first2,last2). Returns false otherwise." (Quoted from [25.3.8]/1.) If the iterators are all character pointers, then this is an inline call to memcmp.

Definition at line 734 of file stl_algobase.h.

Referenced by std::operator<().

template<typename Type, typename Compare>
const Type& max const Type &  a,
const Type &  __b,
Compare  comp
[inline]
 

This does what you think it does.

Parameters:
a A thing of arbitrary type.
b Another thing of arbitrary type.
comp A comparison functor.
Returns:
The greater of the parameters.
This will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.

Definition at line 206 of file stl_algobase.h.

template<typename Type>
const Type& max const Type &  a,
const Type &  __b
[inline]
 

This does what you think it does.

Parameters:
a A thing of arbitrary type.
b Another thing of arbitrary type.
Returns:
The greater of the parameters.
This is the simple classic generic implementation. It will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.

Definition at line 168 of file stl_algobase.h.

Referenced by std::basic_istream< CharT, Traits >::ignore(), std::operator>>(), std::basic_istream< CharT, Traits >::operator>>(), std::basic_stringbuf< CharT, Traits, Alloc >::overflow(), std::basic_filebuf< CharT, Traits >::seekoff(), and std::basic_stringbuf< CharT, Traits, Alloc >::str().

template<typename Type, typename Compare>
const Type& min const Type &  a,
const Type &  __b,
Compare  comp
[inline]
 

This does what you think it does.

Parameters:
a A thing of arbitrary type.
b Another thing of arbitrary type.
comp A comparison functor.
Returns:
The lesser of the parameters.
This will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.

Definition at line 188 of file stl_algobase.h.

template<typename Type>
const Type& min const Type &  a,
const Type &  __b
[inline]
 

This does what you think it does.

Parameters:
a A thing of arbitrary type.
b Another thing of arbitrary type.
Returns:
The lesser of the parameters.
This is the simple classic generic implementation. It will work on temporary expressions, since they are only evaluated once, unlike a preprocessor macro.

Definition at line 148 of file stl_algobase.h.

Referenced by std::basic_istream< CharT, Traits >::ignore(), std::basic_istream< CharT, Traits >::operator>>(), __gnu_cxx::random_sample_n(), std::basic_istream< CharT, Traits >::readsome(), std::basic_streambuf< CharT, Traits >::xsgetn(), and std::basic_streambuf< CharT, Traits >::xsputn().

template<typename InputIter1, typename InputIter2, typename BinaryPredicate>
pair<InputIter1, InputIter2> mismatch InputIter1  first1,
InputIter1  last1,
InputIter2  first2,
BinaryPredicate  __binary_pred
 

Finds the places in ranges which don't match.

Parameters:
first1 An input iterator.
last1 An input iterator.
first2 An input iterator.
binary_pred A binary predicate functor.
Returns:
A pair of iterators pointing to the first mismatch.
This compares the elements of two ranges using the binary_pred parameter, and returns a pair of iterators. The first iterator points into the first range, the second iterator points into the second range, and the elements pointed to by the iterators are not equal.

Definition at line 642 of file stl_algobase.h.

template<typename InputIter1, typename InputIter2>
pair<InputIter1, InputIter2> mismatch InputIter1  first1,
InputIter1  last1,
InputIter2  first2
 

Finds the places in ranges which don't match.

Parameters:
first1 An input iterator.
last1 An input iterator.
first2 An input iterator.
Returns:
A pair of iterators pointing to the first mismatch.
This compares the elements of two ranges using == and returns a pair of iterators. The first iterator points into the first range, the second iterator points into the second range, and the elements pointed to by the iterators are not equal.

Definition at line 608 of file stl_algobase.h.

template<typename Type>
void swap Type &  a,
Type &  __b
[inline]
 

Swaps two values.

Parameters:
a A thing of arbitrary type.
b Another thing of arbitrary type.
Returns:
Nothing.
This is the simple classic generic implementation. It will work on any type which has a copy constructor and an assignment operator.

Definition at line 120 of file stl_algobase.h.

Referenced by std::vector< Node *, Alloc >::swap(), std::list< Type, Alloc >::swap(), and std::deque< Type, Alloc >::swap().


Generated on Thu Feb 10 23:23:31 2005 for libstdc++-v3 Source by  doxygen 1.4.0