Set operators [C++ Reference]
Keywords: stl,set,set_operators
Date: 2008-11-15T08:54:31-0800

[[Set operators]]
C++ Reference
Translations of this page?:

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

## Set operators

Syntax:

        #include <set>
        set operator=(const set& c2);
        bool operator==(const set& c1, const set& c2);
        bool operator!=(const set& c1, const set& c2);
        bool operator<(const set& c1, const set& c2);
        bool operator>(const set& c1, const set& c2);
        bool operator<=(const set& c1, const set& c2);
        bool operator>=(const set& c1, const set& c2);

All of the C++ containers can be compared and assigned with the standard comparison operators: ==, !=, <=, >=, <, >, and =. Performing a comparison or assigning one set to another takes linear time.

Two sets are equal if:

1. Their size is the same, and
2. Each member in location i in one set is equal to the the member in location i in the other set.

Comparisons among sets are done lexicographically.

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