stl:list:list_operators

C++ Reference

List operators

Syntax:

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

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

Two lists are equal if:

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

Comparisons among lists are done lexicographically.

Related Topics: merge, unique