Document comparison operators for non tree associative containers.

This commit is contained in:
Ion Gaztañaga committed 2014-01-03 12:43:03 +01:00
1 parent 4dc3df6b6b
commit 2489010881
6 files changed
+252 -84

No files matched your search

+29 -8
View File
@@ -1537,24 +1537,45 @@ class deque : protected deque_base<Allocator>
this->members_.m_finish = this->members_.m_start;
}
//! <b>Effects</b>: Returns true if x and y are equal
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator==(const deque& x, const deque& y)
{ return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); }
//! <b>Effects</b>: Returns true if x and y are unequal
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator!=(const deque& x, const deque& y)
{ return !(x == y); }
{ return !(x == y); }
//! <b>Effects</b>: Returns true if x is less than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator<(const deque& x, const deque& y)
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
{ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
//! <b>Effects</b>: Returns true if x is greater than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator>(const deque& x, const deque& y)
{ return y < x; }
friend bool operator>=(const deque& x, const deque& y)
{ return !(x < y); }
{ return y < x; }
//! <b>Effects</b>: Returns true if x is equal or less than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator<=(const deque& x, const deque& y)
{ return !(y < x); }
{ return !(y < x); }
//! <b>Effects</b>: Returns true if x is equal or greater than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator>=(const deque& x, const deque& y)
{ return !(x < y); }
//! <b>Effects</b>: x.swap(y)
//!
//! <b>Complexity</b>: Constant.
friend void swap(deque& x, deque& y)
{ x.swap(y); }