mirror of https://github.com/ARMmbed/mbed-os.git
ARMC5 <array>: add comparison operators
parent
9f258c4798
commit
0449e6f1a3
|
@ -160,8 +160,44 @@ struct array {
|
|||
}
|
||||
};
|
||||
|
||||
template <typename _TypeT, size_t _Size>
|
||||
bool operator==(const array<_TypeT, _Size> &__x, const array<_TypeT, _Size> &__y)
|
||||
{
|
||||
return equal(__x.begin(), __x.end(), __y.begin());
|
||||
}
|
||||
|
||||
template <typename _TypeT, size_t _Size>
|
||||
bool operator!=(const array<_TypeT, _Size> &__x, const array<_TypeT, _Size> &__y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <typename _TypeT, size_t _Size>
|
||||
bool operator<(const array<_TypeT, _Size> &__x, const array<_TypeT, _Size> &__y)
|
||||
{
|
||||
return lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
|
||||
}
|
||||
|
||||
template <typename _TypeT, size_t _Size>
|
||||
bool operator>(const array<_TypeT, _Size> &__x, const array<_TypeT, _Size> &__y)
|
||||
{
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
template <typename _TypeT, size_t _Size>
|
||||
bool operator<=(const array<_TypeT, _Size> &__x, const array<_TypeT, _Size> &__y)
|
||||
{
|
||||
return !(__x > __y);
|
||||
}
|
||||
|
||||
template <typename _TypeT, size_t _Size>
|
||||
bool operator>=(const array<_TypeT, _Size> &__x, const array<_TypeT, _Size> &__y)
|
||||
{
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
// [array.special]
|
||||
template <class _TypeT, size_t _Size>
|
||||
template <typename _TypeT, size_t _Size>
|
||||
void swap(array<_TypeT, _Size> &__x, array<_TypeT, _Size> &__y)
|
||||
{
|
||||
__x.swap(__y);
|
||||
|
|
Loading…
Reference in New Issue