forked from boostorg/container
- Modified relational operators to be friend inline definitions. This allows compilation checking when instantiating classes, avoids predeclarations and results in less verbose code.
- First to make associative containers' tree implementation configurable.
This commit is contained in:
@@ -1510,8 +1510,28 @@ class stable_vector
|
||||
void clear() BOOST_CONTAINER_NOEXCEPT
|
||||
{ this->erase(this->cbegin(),this->cend()); }
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
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()); }
|
||||
|
||||
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 y<x; }
|
||||
|
||||
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); }
|
||||
|
||||
friend void swap(stable_vector& x,stable_vector& y)
|
||||
{ x.swap(y); }
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
private:
|
||||
|
||||
class insert_rollback
|
||||
@@ -1839,50 +1859,6 @@ class stable_vector
|
||||
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
};
|
||||
|
||||
template <typename T,typename Allocator>
|
||||
bool operator==(const stable_vector<T,Allocator>& x,const stable_vector<T,Allocator>& y)
|
||||
{
|
||||
return x.size()==y.size()&&std::equal(x.begin(),x.end(),y.begin());
|
||||
}
|
||||
|
||||
template <typename T,typename Allocator>
|
||||
bool operator< (const stable_vector<T,Allocator>& x,const stable_vector<T,Allocator>& y)
|
||||
{
|
||||
return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end());
|
||||
}
|
||||
|
||||
template <typename T,typename Allocator>
|
||||
bool operator!=(const stable_vector<T,Allocator>& x,const stable_vector<T,Allocator>& y)
|
||||
{
|
||||
return !(x==y);
|
||||
}
|
||||
|
||||
template <typename T,typename Allocator>
|
||||
bool operator> (const stable_vector<T,Allocator>& x,const stable_vector<T,Allocator>& y)
|
||||
{
|
||||
return y<x;
|
||||
}
|
||||
|
||||
template <typename T,typename Allocator>
|
||||
bool operator>=(const stable_vector<T,Allocator>& x,const stable_vector<T,Allocator>& y)
|
||||
{
|
||||
return !(x<y);
|
||||
}
|
||||
|
||||
template <typename T,typename Allocator>
|
||||
bool operator<=(const stable_vector<T,Allocator>& x,const stable_vector<T,Allocator>& y)
|
||||
{
|
||||
return !(x>y);
|
||||
}
|
||||
|
||||
// specialized algorithms:
|
||||
|
||||
template <typename T, typename Allocator>
|
||||
void swap(stable_vector<T,Allocator>& x,stable_vector<T,Allocator>& y)
|
||||
{
|
||||
x.swap(y);
|
||||
}
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
|
||||
#undef STABLE_VECTOR_CHECK_INVARIANT
|
||||
|
Reference in New Issue
Block a user