Set operation algorithms


Functions

template<typename InputIterator1, typename InputIterator2>
bool std::includes (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2)
 Determines whether all elements of a sequence exists in a range.
template<typename InputIterator1, typename InputIterator2, typename Compare>
bool std::includes (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp)
 Determines whether all elements of a sequence exists in a range using comparison.
template<typename InputIterator1, typename InputIterator2, typename OutputIterator>
OutputIterator std::set_union (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator __result)
 Return the union of two sorted ranges.
template<typename InputIterator1, typename InputIterator2, typename OutputIterator, typename Compare>
OutputIterator std::set_union (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator __result, Compare comp)
 Return the union of two sorted ranges using a comparison functor.
template<typename InputIterator1, typename InputIterator2, typename OutputIterator>
OutputIterator std::set_intersection (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator __result)
 Return the intersection of two sorted ranges.
template<typename InputIterator1, typename InputIterator2, typename OutputIterator, typename Compare>
OutputIterator std::set_intersection (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator __result, Compare comp)
 Return the intersection of two sorted ranges using comparison functor.
template<typename InputIterator1, typename InputIterator2, typename OutputIterator>
OutputIterator std::set_difference (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator __result)
 Return the difference of two sorted ranges.
template<typename InputIterator1, typename InputIterator2, typename OutputIterator, typename Compare>
OutputIterator std::set_difference (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator __result, Compare comp)
 Return the difference of two sorted ranges using comparison functor.
template<typename InputIterator1, typename InputIterator2, typename OutputIterator>
OutputIterator std::set_symmetric_difference (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator __result)
 Return the symmetric difference of two sorted ranges.
template<typename InputIterator1, typename InputIterator2, typename OutputIterator, typename Compare>
OutputIterator std::set_symmetric_difference (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator __result, Compare comp)
 Return the symmetric difference of two sorted ranges using comparison functor.

Detailed Description

These algorithms are common set operations performed on sequences that are already sorted.

The number of comparisons will be linear.


Function Documentation

template<typename InputIterator1, typename InputIterator2, typename Compare>
bool std::includes InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
Compare  comp
 

Determines whether all elements of a sequence exists in a range using comparison.

Parameters:
first1 Start of search range.
last1 End of search range.
first2 Start of sequence
last2 End of sequence.
comp Comparison function to use.
Returns:
True if each element in [first2,last2) is contained in order within [first1,last1) according to comp. False otherwise.
This operation expects both [first1,last1) and [first2,last2) to be sorted. Searches for the presence of each element in [first2,last2) within [first1,last1), using comp to decide. The iterators over each range only move forward, so this is a linear algorithm. If an element in [first2,last2) is not found before the search iterator reaches last2, false is returned.

Definition at line 4023 of file stl_algo.h.

template<typename InputIterator1, typename InputIterator2>
bool std::includes InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2
 

Determines whether all elements of a sequence exists in a range.

Parameters:
first1 Start of search range.
last1 End of search range.
first2 Start of sequence
last2 End of sequence.
Returns:
True if each element in [first2,last2) is contained in order within [first1,last1). False otherwise.
This operation expects both [first1,last1) and [first2,last2) to be sorted. Searches for the presence of each element in [first2,last2) within [first1,last1). The iterators over each range only move forward, so this is a linear algorithm. If an element in [first2,last2) is not found before the search iterator reaches last2, false is returned.

Definition at line 3976 of file stl_algo.h.

template<typename InputIterator1, typename InputIterator2, typename OutputIterator, typename Compare>
OutputIterator std::set_difference InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
OutputIterator  __result,
Compare  comp
 

Return the difference of two sorted ranges using comparison functor.

Parameters:
first1 Start of first range.
last1 End of first range.
first2 Start of second range.
last2 End of second range.
comp The comparison functor.
Returns:
End of the output range.
This operation iterates over both ranges, copying elements present in the first range but not the second in order to the output range. Iterators increment for each range. When the current element of the first range is less than the second according to comp, that element is copied and the iterator advances. If the current element of the second range is less, no element is copied and the iterator advances. If an element is contained in both ranges according to comp, no elements are copied and both ranges advance. The output range may not overlap either input range.

Definition at line 4358 of file stl_algo.h.

template<typename InputIterator1, typename InputIterator2, typename OutputIterator>
OutputIterator std::set_difference InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
OutputIterator  __result
 

Return the difference of two sorted ranges.

Parameters:
first1 Start of first range.
last1 End of first range.
first2 Start of second range.
last2 End of second range.
Returns:
End of the output range.
This operation iterates over both ranges, copying elements present in the first range but not the second in order to the output range. Iterators increment for each range. When the current element of the first range is less than the second, that element is copied and the iterator advances. If the current element of the second range is less, the iterator advances, but no element is copied. If an element is contained in both ranges, no elements are copied and both ranges advance. The output range may not overlap either input range.

Definition at line 4300 of file stl_algo.h.

template<typename InputIterator1, typename InputIterator2, typename OutputIterator, typename Compare>
OutputIterator std::set_intersection InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
OutputIterator  __result,
Compare  comp
 

Return the intersection of two sorted ranges using comparison functor.

Parameters:
first1 Start of first range.
last1 End of first range.
first2 Start of second range.
last2 End of second range.
comp The comparison functor.
Returns:
End of the output range.
This operation iterates over both ranges, copying elements present in both ranges in order to the output range. Iterators increment for each range. When the current element of one range is less than the other according to comp, that iterator advances. If an element is contained in both ranges according to comp, the element from the first range is copied and both ranges advance. The output range may not overlap either input range.

Definition at line 4246 of file stl_algo.h.

template<typename InputIterator1, typename InputIterator2, typename OutputIterator>
OutputIterator std::set_intersection InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
OutputIterator  __result
 

Return the intersection of two sorted ranges.

Parameters:
first1 Start of first range.
last1 End of first range.
first2 Start of second range.
last2 End of second range.
Returns:
End of the output range.
This operation iterates over both ranges, copying elements present in both ranges in order to the output range. Iterators increment for each range. When the current element of one range is less than the other, that iterator advances. If an element is contained in both ranges, the element from the first range is copied and both ranges advance. The output range may not overlap either input range.

Definition at line 4192 of file stl_algo.h.

template<typename InputIterator1, typename InputIterator2, typename OutputIterator, typename Compare>
OutputIterator std::set_symmetric_difference InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
OutputIterator  __result,
Compare  comp
 

Return the symmetric difference of two sorted ranges using comparison functor.

Parameters:
first1 Start of first range.
last1 End of first range.
first2 Start of second range.
last2 End of second range.
comp The comparison functor.
Returns:
End of the output range.
This operation iterates over both ranges, copying elements present in one range but not the other in order to the output range. Iterators increment for each range. When the current element of one range is less than the other according to comp, that element is copied and the iterator advances. If an element is contained in both ranges according to comp, no elements are copied and both ranges advance. The output range may not overlap either input range.

Definition at line 4473 of file stl_algo.h.

template<typename InputIterator1, typename InputIterator2, typename OutputIterator>
OutputIterator std::set_symmetric_difference InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
OutputIterator  __result
 

Return the symmetric difference of two sorted ranges.

Parameters:
first1 Start of first range.
last1 End of first range.
first2 Start of second range.
last2 End of second range.
Returns:
End of the output range.
This operation iterates over both ranges, copying elements present in one range but not the other in order to the output range. Iterators increment for each range. When the current element of one range is less than the other, that element is copied and the iterator advances. If an element is contained in both ranges, no elements are copied and both ranges advance. The output range may not overlap either input range.

Definition at line 4412 of file stl_algo.h.

template<typename InputIterator1, typename InputIterator2, typename OutputIterator, typename Compare>
OutputIterator std::set_union InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
OutputIterator  __result,
Compare  comp
 

Return the union of two sorted ranges using a comparison functor.

Parameters:
first1 Start of first range.
last1 End of first range.
first2 Start of second range.
last2 End of second range.
comp The comparison functor.
Returns:
End of the output range.
This operation iterates over both ranges, copying elements present in each range in order to the output range. Iterators increment for each range. When the current element of one range is less than the other according to comp, that element is copied and the iterator advanced. If an equivalent element according to comp is contained in both ranges, the element from the first range is copied and both ranges advance. The output range may not overlap either input range.

Definition at line 4131 of file stl_algo.h.

template<typename InputIterator1, typename InputIterator2, typename OutputIterator>
OutputIterator std::set_union InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2,
InputIterator2  last2,
OutputIterator  __result
 

Return the union of two sorted ranges.

Parameters:
first1 Start of first range.
last1 End of first range.
first2 Start of second range.
last2 End of second range.
Returns:
End of the output range.
This operation iterates over both ranges, copying elements present in each range in order to the output range. Iterators increment for each range. When the current element of one range is less than the other, that element is copied and the iterator advanced. If an element is contained in both ranges, the element from the first range is copied and both ranges advance. The output range may not overlap either input range.

Definition at line 4069 of file stl_algo.h.


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