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 <debug/debug.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 ForwardIterator1, typename ForwardIterator2>
void iter_swap (ForwardIterator1 a, ForwardIterator2 __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 InputIterator, typename OutputIterator>
OutputIterator copy (InputIterator first, InputIterator last, OutputIterator __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 ForwardIterator, typename Type>
void fill (ForwardIterator first, ForwardIterator last, const Type &value)
 Fills the range [first,last) with copies of value.
template<typename OutputIterator, typename Size, typename Type>
OutputIterator fill_n (OutputIterator first, Size n, const Type &value)
 Fills the range [first,first+n) with copies of value.
template<typename InputIterator1, typename InputIterator2>
pair< InputIterator1, InputIterator2 > mismatch (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
 Finds the places in ranges which don't match.
template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
pair< InputIterator1, InputIterator2 > mismatch (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate __binary_pred)
 Finds the places in ranges which don't match.
template<typename InputIterator1, typename InputIterator2>
bool equal (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
 Tests a range for element-wise equality.
template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
bool equal (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, BinaryPredicate __binary_pred)
 Tests a range for element-wise equality.
template<typename InputIterator1, typename InputIterator2>
bool lexicographical_compare (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2)
 Performs "dictionary" comparison on ranges.
template<typename InputIterator1, typename InputIterator2, typename Compare>
bool lexicographical_compare (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 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 InputIterator, typename OutputIterator>
OutputIterator std::copy InputIterator  first,
InputIterator  last,
OutputIterator  __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). Result may not be contained within [first,last); the copy_backward function should be used instead.

Note that the end of the output range is permitted to be contained within [first,last).

Definition at line 348 of file stl_algobase.h.

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

Copies the range [first,last) into result.

Parameters:
first A bidirectional iterator.
last A bidirectional iterator.
result A bidirectional 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).

Result may not be in the range [first,last). Use copy instead. Note that the start of the output range may overlap [first,last).

Definition at line 487 of file stl_algobase.h.

template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
bool std::equal InputIterator1  first1,
InputIterator1  last1,
InputIterator2  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 712 of file stl_algobase.h.

template<typename InputIterator1, typename InputIterator2>
bool std::equal InputIterator1  first1,
InputIterator1  last1,
InputIterator2  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 679 of file stl_algobase.h.

Referenced by std::operator==().

template<typename ForwardIterator, typename Type>
void std::fill ForwardIterator  first,
ForwardIterator  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 516 of file stl_algobase.h.

template<typename OutputIterator, typename Size, typename Type>
OutputIterator std::fill_n OutputIterator  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 540 of file stl_algobase.h.

template<typename ForwardIterator1, typename ForwardIterator2>
void std::iter_swap ForwardIterator1  a,
ForwardIterator2  __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 92 of file stl_algobase.h.

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

template<typename InputIterator1, typename InputIterator2, typename Compare>
bool std::lexicographical_compare InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  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 783 of file stl_algobase.h.

template<typename InputIterator1, typename InputIterator2>
bool std::lexicographical_compare InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  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 743 of file stl_algobase.h.

Referenced by std::operator<().

template<typename Type, typename Compare>
const Type& std::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 214 of file stl_algobase.h.

template<typename Type>
const Type& std::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 172 of file stl_algobase.h.

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

template<typename Type, typename Compare>
const Type& std::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 194 of file stl_algobase.h.

template<typename Type>
const Type& std::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 150 of file stl_algobase.h.

Referenced by std::basic_string< CharT, Traits, Alloc >::compare(), std::basic_string< char >::compare(), std::basic_istream< CharT, Traits >::getline(), std::basic_istream< CharT, Traits >::operator>>(), std::basic_stringbuf< CharT, Traits, Alloc >::overflow(), __gnu_cxx::random_sample_n(), std::basic_istream< CharT, Traits >::readsome(), std::basic_string< CharT, Traits, Alloc >::rfind(), std::basic_filebuf< CharT, Traits >::underflow(), std::basic_streambuf< CharT, Traits >::xsgetn(), and std::basic_streambuf< CharT, Traits >::xsputn().

template<typename InputIterator1, typename InputIterator2, typename BinaryPredicate>
pair<InputIterator1, InputIterator2> std::mismatch InputIterator1  first1,
InputIterator1  last1,
InputIterator2  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 650 of file stl_algobase.h.

template<typename InputIterator1, typename InputIterator2>
pair<InputIterator1, InputIterator2> std::mismatch InputIterator1  first1,
InputIterator1  last1,
InputIterator2  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 614 of file stl_algobase.h.

template<typename Type>
void std::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 125 of file stl_algobase.h.


Generated on Fri May 6 01:11:19 2005 for libstdc++-v3 Source by  doxygen 1.4.2