set_intersection [C++ Reference]
Keywords: stl,algorithm,set_intersection
Date: 2009-10-09T02:04:02-0700

[[set_intersection]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- fr
- it
- jp
- pl
- ru
- tr

## set_intersection

Syntax:

        #include <algorithm>
        template< typename InIterA, typename InIterB, typename OutIter >
        OutIter set_intersection( InIterA start1, InIterA end1, InIterB start2, InIterB end2, OutIter result );
        template< typename InIterA, typename InIterB, typename OutIter, typename StrictWeakOrdering >
        OutIter set_intersection( InIterA start1, InIterA end1, InIterB start2, InIterB end2, OutIter result, StrictWeakOrdering cmp );

The set_intersection() algorithm computes the intersection of the two sets defined by [start1,end1) and [start2,end2) and stores the intersection starting at result.

Both of the sets, given as ranges, must be sorted in ascending order.

The return value of set_intersection() is an iterator to the end of the intersection range.

set_intersection() runs in linear time.

If the strict weak ordering comparison function object cmp is not specified, set_intersection() will use the < operator to compare elements.

Related Topics: includes, set_difference, set_symmetric_difference, set_union

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •