diff --git a/include/boost/container/deque.hpp b/include/boost/container/deque.hpp index 14d5f2e..d3ee484 100644 --- a/include/boost/container/deque.hpp +++ b/include/boost/container/deque.hpp @@ -1537,24 +1537,45 @@ class deque : protected deque_base this->members_.m_finish = this->members_.m_start; } + //! Effects: Returns true if x and y are equal + //! + //! Complexity: 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()); } - + + //! Effects: Returns true if x and y are unequal + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator!=(const deque& x, const deque& y) - { return !(x == y); } + { return !(x == y); } + //! Effects: Returns true if x is less than y + //! + //! Complexity: 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()); } + //! Effects: Returns true if x is greater than y + //! + //! Complexity: 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; } + //! Effects: Returns true if x is equal or less than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator<=(const deque& x, const deque& y) - { return !(y < x); } + { return !(y < x); } + //! Effects: Returns true if x is equal or greater than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator>=(const deque& x, const deque& y) + { return !(x < y); } + + //! Effects: x.swap(y) + //! + //! Complexity: Constant. friend void swap(deque& x, deque& y) { x.swap(y); } diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index 02388ca..95b9e5e 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -859,26 +859,47 @@ class flat_map std::pair equal_range(const key_type& x) const { return container_detail::force_copy >(m_flat_tree.equal_range(x)); } + //! Effects: Returns true if x and y are equal + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator==(const flat_map& x, const flat_map& y) - { return x.m_flat_tree == y.m_flat_tree; } - - friend bool operator<(const flat_map& x, const flat_map& y) - { return x.m_flat_tree < y.m_flat_tree; } + { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } + //! Effects: Returns true if x and y are unequal + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator!=(const flat_map& x, const flat_map& y) - { return !(x == y); } + { return !(x == y); } + //! Effects: Returns true if x is less than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator<(const flat_map& x, const flat_map& y) + { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + + //! Effects: Returns true if x is greater than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator>(const flat_map& x, const flat_map& y) - { return y < x; } + { return y < x; } + //! Effects: Returns true if x is equal or less than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator<=(const flat_map& x, const flat_map& y) - { return !(y < x); } + { return !(y < x); } + //! Effects: Returns true if x is equal or greater than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator>=(const flat_map& x, const flat_map& y) - { return !(x < y); } + { return !(x < y); } + //! Effects: x.swap(y) + //! + //! Complexity: Constant. friend void swap(flat_map& x, flat_map& y) - { x.swap(y); } + { x.swap(y); } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: @@ -1651,26 +1672,47 @@ class flat_multimap std::pair equal_range(const key_type& x) const { return container_detail::force_copy >(m_flat_tree.equal_range(x)); } + //! Effects: Returns true if x and y are equal + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator==(const flat_multimap& x, const flat_multimap& y) - { return x.m_flat_tree == y.m_flat_tree; } - - friend bool operator<(const flat_multimap& x, const flat_multimap& y) - { return x.m_flat_tree < y.m_flat_tree; } + { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } + //! Effects: Returns true if x and y are unequal + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator!=(const flat_multimap& x, const flat_multimap& y) - { return !(x == y); } + { return !(x == y); } + //! Effects: Returns true if x is less than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator<(const flat_multimap& x, const flat_multimap& y) + { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + + //! Effects: Returns true if x is greater than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator>(const flat_multimap& x, const flat_multimap& y) - { return y < x; } + { return y < x; } + //! Effects: Returns true if x is equal or less than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator<=(const flat_multimap& x, const flat_multimap& y) - { return !(y < x); } + { return !(y < x); } + //! Effects: Returns true if x is equal or greater than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator>=(const flat_multimap& x, const flat_multimap& y) - { return !(x < y); } + { return !(x < y); } + //! Effects: x.swap(y) + //! + //! Complexity: Constant. friend void swap(flat_multimap& x, flat_multimap& y) - { x.swap(y); } + { x.swap(y); } }; }} diff --git a/include/boost/container/flat_set.hpp b/include/boost/container/flat_set.hpp index 48a9e88..bb1c2a9 100644 --- a/include/boost/container/flat_set.hpp +++ b/include/boost/container/flat_set.hpp @@ -659,26 +659,47 @@ class flat_set std::pair equal_range(const key_type& x) { return m_flat_tree.equal_range(x); } + //! Effects: Returns true if x and y are equal + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator==(const flat_set& x, const flat_set& y) - { return x.m_flat_tree == y.m_flat_tree; } - - friend bool operator<(const flat_set& x, const flat_set& y) - { return x.m_flat_tree < y.m_flat_tree; } + { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } + //! Effects: Returns true if x and y are unequal + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator!=(const flat_set& x, const flat_set& y) - { return !(x == y); } + { return !(x == y); } + //! Effects: Returns true if x is less than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator<(const flat_set& x, const flat_set& y) + { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + + //! Effects: Returns true if x is greater than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator>(const flat_set& x, const flat_set& y) - { return y < x; } + { return y < x; } + //! Effects: Returns true if x is equal or less than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator<=(const flat_set& x, const flat_set& y) - { return !(y < x); } + { return !(y < x); } + //! Effects: Returns true if x is equal or greater than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator>=(const flat_set& x, const flat_set& y) - { return !(x < y); } + { return !(x < y); } + //! Effects: x.swap(y) + //! + //! Complexity: Constant. friend void swap(flat_set& x, flat_set& y) - { x.swap(y); } + { x.swap(y); } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: @@ -1299,26 +1320,47 @@ class flat_multiset std::pair equal_range(const key_type& x) { return m_flat_tree.equal_range(x); } + //! Effects: Returns true if x and y are equal + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator==(const flat_multiset& x, const flat_multiset& y) - { return x.m_flat_tree == y.m_flat_tree; } - - friend bool operator<(const flat_multiset& x, const flat_multiset& y) - { return x.m_flat_tree < y.m_flat_tree; } + { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } + //! Effects: Returns true if x and y are unequal + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator!=(const flat_multiset& x, const flat_multiset& y) - { return !(x == y); } + { return !(x == y); } + //! Effects: Returns true if x is less than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator<(const flat_multiset& x, const flat_multiset& y) + { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + + //! Effects: Returns true if x is greater than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator>(const flat_multiset& x, const flat_multiset& y) - { return y < x; } + { return y < x; } + //! Effects: Returns true if x is equal or less than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator<=(const flat_multiset& x, const flat_multiset& y) - { return !(y < x); } + { return !(y < x); } + //! Effects: Returns true if x is equal or greater than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator>=(const flat_multiset& x, const flat_multiset& y) - { return !(x < y); } + { return !(x < y); } + //! Effects: x.swap(y) + //! + //! Complexity: Constant. friend void swap(flat_multiset& x, flat_multiset& y) - { x.swap(y); } + { x.swap(y); } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: diff --git a/include/boost/container/list.hpp b/include/boost/container/list.hpp index 022d1b9..e6c3155 100644 --- a/include/boost/container/list.hpp +++ b/include/boost/container/list.hpp @@ -1216,6 +1216,9 @@ class list void reverse() BOOST_CONTAINER_NOEXCEPT { this->icont().reverse(); } + //! Effects: Returns true if x and y are equal + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator==(const list& x, const list& y) { if(x.size() != y.size()){ @@ -1233,21 +1236,39 @@ class list return i1 == end1; } - friend bool operator<(const list& x, const list& y) - { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - + //! Effects: Returns true if x and y are unequal + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator!=(const list& x, const list& y) { return !(x == y); } - + + //! Effects: Returns true if x is less than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator<(const list& x, const list& y) + { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + + //! Effects: Returns true if x is greater than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator>(const list& x, const list& y) { return y < x; } + //! Effects: Returns true if x is equal or less than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator<=(const list& x, const list& y) { return !(y < x); } + //! Effects: Returns true if x is equal or greater than y + //! + //! Complexity: Linear to the number of elements in the container. friend bool operator>=(const list& x, const list& y) { return !(x < y); } - + + //! Effects: x.swap(y) + //! + //! Complexity: Constant. friend void swap(list& x, list& y) { x.swap(y); } diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp index 38cee3a..adcb979 100644 --- a/include/boost/container/stable_vector.hpp +++ b/include/boost/container/stable_vector.hpp @@ -1510,25 +1510,46 @@ class stable_vector void clear() BOOST_CONTAINER_NOEXCEPT { this->erase(this->cbegin(),this->cend()); } - friend bool operator==(const stable_vector& x,const stable_vector& y) - { return x.size()==y.size()&&std::equal(x.begin(),x.end(),y.begin()); } + //! Effects: Returns true if x and y are equal + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator==(const stable_vector& x, const stable_vector& y) + { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } - friend bool operator< (const stable_vector& x,const stable_vector& y) - { return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end()); } + //! Effects: Returns true if x and y are unequal + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator!=(const stable_vector& x, const stable_vector& y) + { return !(x == y); } - friend bool operator!=(const stable_vector& x,const stable_vector& y) - { return !(x==y); } + //! Effects: Returns true if x is less than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator<(const stable_vector& x, const stable_vector& y) + { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - friend bool operator> (const stable_vector& x,const stable_vector& y) - { return yEffects: Returns true if x is greater than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator>(const stable_vector& x, const stable_vector& y) + { return y < x; } - friend bool operator>=(const stable_vector& x,const stable_vector& y) - { return !(xEffects: Returns true if x is equal or less than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator<=(const stable_vector& x, const stable_vector& y) + { return !(y < x); } - friend bool operator<=(const stable_vector& x,const stable_vector& y) - { return !(x>y); } + //! Effects: Returns true if x is equal or greater than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator>=(const stable_vector& x, const stable_vector& y) + { return !(x < y); } - friend void swap(stable_vector& x,stable_vector& y) + //! Effects: x.swap(y) + //! + //! Complexity: Constant. + friend void swap(stable_vector& x, stable_vector& y) { x.swap(y); } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp index 22f4282..86ba488 100644 --- a/include/boost/container/vector.hpp +++ b/include/boost/container/vector.hpp @@ -1564,10 +1564,52 @@ class vector //! //! Throws: Nothing. //! - //! Complexity: Linear to the number of elements in the vector. + //! Complexity: Linear to the number of elements in the container. void clear() BOOST_CONTAINER_NOEXCEPT { this->priv_destroy_all(); } + //! Effects: Returns true if x and y are equal + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator==(const vector& x, const vector& y) + { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } + + //! Effects: Returns true if x and y are unequal + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator!=(const vector& x, const vector& y) + { return !(x == y); } + + //! Effects: Returns true if x is less than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator<(const vector& x, const vector& y) + { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + + //! Effects: Returns true if x is greater than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator>(const vector& x, const vector& y) + { return y < x; } + + //! Effects: Returns true if x is equal or less than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator<=(const vector& x, const vector& y) + { return !(y < x); } + + //! Effects: Returns true if x is equal or greater than y + //! + //! Complexity: Linear to the number of elements in the container. + friend bool operator>=(const vector& x, const vector& y) + { return !(x < y); } + + //! Effects: x.swap(y) + //! + //! Complexity: Constant. + friend void swap(vector& x, vector& y) + { x.swap(y); } + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED //Absolutely experimental. This function might change, disappear or simply crash! @@ -1586,27 +1628,6 @@ class vector this->priv_insert_ordered_at(element_count, last_position_it, true, last_skip_it, last_value_it); } - friend bool operator==(const vector& x, const vector& y) - { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } - - friend bool operator!=(const vector& x, const vector& y) - { return !(x == y); } - - friend bool operator<(const vector& x, const vector& y) - { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - - friend bool operator>(const vector& x, const vector& y) - { return y < x; } - - friend bool operator<=(const vector& x, const vector& y) - { return !(y < x); } - - friend bool operator>=(const vector& x, const vector& y) - { return !(x < y); } - - friend void swap(vector& x, vector& y) - { x.swap(y); } - private: template