[#133] Making sure comparison operators are in the etl namespace (#135)

This commit is contained in:
Jonathan Pan 2019-06-28 23:48:42 -07:00 committed by John Wellbelove
parent 49799d3d7e
commit ee82c052c8
9 changed files with 937 additions and 937 deletions

View File

@ -2372,87 +2372,87 @@ namespace etl
/// The uninitialised buffer of T used in the deque.
typename etl::aligned_storage<sizeof(T), etl::alignment_of<T>::value>::type buffer[BUFFER_SIZE];
};
}
//***************************************************************************
/// Equal operator.
///\param lhs Reference to the _begin deque.
///\param rhs Reference to the second deque.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
///\ingroup deque
//***************************************************************************
template <typename T>
bool operator ==(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
/// Equal operator.
///\param lhs Reference to the _begin deque.
///\param rhs Reference to the second deque.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
///\ingroup deque
//***************************************************************************
template <typename T>
bool operator ==(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
/// Not equal operator.
///\param lhs Reference to the _begin deque.
///\param rhs Reference to the second deque.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
///\ingroup deque
//***************************************************************************
template <typename T>
bool operator !=(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Not equal operator.
///\param lhs Reference to the _begin deque.
///\param rhs Reference to the second deque.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
///\ingroup deque
//***************************************************************************
template <typename T>
bool operator !=(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Less than operator.
///\param lhs Reference to the _begin deque.
///\param rhs Reference to the second deque.
///\return <b>true</b> if the _begin deque is lexicographically less than the second, otherwise <b>false</b>
///\ingroup deque
//***************************************************************************
template <typename T>
bool operator <(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//***************************************************************************
/// Less than operator.
///\param lhs Reference to the _begin deque.
///\param rhs Reference to the second deque.
///\return <b>true</b> if the _begin deque is lexicographically less than the second, otherwise <b>false</b>
///\ingroup deque
//***************************************************************************
template <typename T>
bool operator <(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//***************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the _begin deque.
///\param rhs Reference to the second deque.
///\return <b>true</b> if the _begin deque is lexicographically less than or equal to the second, otherwise <b>false</b>
///\ingroup deque
//***************************************************************************
template <typename T>
bool operator <=(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return !(lhs > rhs);
}
//***************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the _begin deque.
///\param rhs Reference to the second deque.
///\return <b>true</b> if the _begin deque is lexicographically less than or equal to the second, otherwise <b>false</b>
///\ingroup deque
//***************************************************************************
template <typename T>
bool operator <=(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return !(lhs > rhs);
}
//***************************************************************************
/// Greater than operator.
///\param lhs Reference to the _begin deque.
///\param rhs Reference to the second deque.
///\return <b>true</b> if the _begin deque is lexicographically greater than the second, otherwise <b>false</b>
///\ingroup deque
//***************************************************************************
template <typename T>
bool operator >(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return (rhs < lhs);
}
//***************************************************************************
/// Greater than operator.
///\param lhs Reference to the _begin deque.
///\param rhs Reference to the second deque.
///\return <b>true</b> if the _begin deque is lexicographically greater than the second, otherwise <b>false</b>
///\ingroup deque
//***************************************************************************
template <typename T>
bool operator >(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return (rhs < lhs);
}
//***************************************************************************
/// Greater than or equal operator.
///\param "lhs Reference to the _begin deque.
///\param "rhs Reference to the second deque.
///\return <b>true</b> if the _begin deque is lexicographically greater than or equal to the second, otherwise <b>false</b>
///\ingroup deque
//***************************************************************************
template <typename T>
bool operator >=(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return !(lhs < rhs);
//***************************************************************************
/// Greater than or equal operator.
///\param "lhs Reference to the _begin deque.
///\param "rhs Reference to the second deque.
///\return <b>true</b> if the _begin deque is lexicographically greater than or equal to the second, otherwise <b>false</b>
///\ingroup deque
//***************************************************************************
template <typename T>
bool operator >=(const etl::ideque<T>& lhs, const etl::ideque<T>& rhs)
{
return !(lhs < rhs);
}
}
#undef ETL_FILE

View File

@ -174,97 +174,97 @@ namespace etl
TIterator it; ///< The underlying iterator.
};
}
//*****************************************************************************
/// + difference operator.
//*****************************************************************************
template <typename TIterator>
etl::fixed_iterator<TIterator>& operator +(etl::fixed_iterator<TIterator>& lhs,
typename std::iterator_traits<TIterator>::difference_type /*rhs*/)
{
return lhs;
}
//*****************************************************************************
/// + difference operator.
//*****************************************************************************
template <typename TIterator>
etl::fixed_iterator<TIterator>& operator +(etl::fixed_iterator<TIterator>& lhs,
typename std::iterator_traits<TIterator>::difference_type /*rhs*/)
{
return lhs;
}
//*****************************************************************************
/// - difference operator.
//*****************************************************************************
template <typename TIterator>
etl::fixed_iterator<TIterator>& operator -(etl::fixed_iterator<TIterator>& lhs,
typename std::iterator_traits<TIterator>::difference_type /*rhs*/)
{
return lhs;
}
//*****************************************************************************
/// - difference operator.
//*****************************************************************************
template <typename TIterator>
etl::fixed_iterator<TIterator>& operator -(etl::fixed_iterator<TIterator>& lhs,
typename std::iterator_traits<TIterator>::difference_type /*rhs*/)
{
return lhs;
}
//*****************************************************************************
/// - fixed_iterator operator.
//*****************************************************************************
template <typename TIterator>
typename std::iterator_traits<TIterator>::difference_type operator -(etl::fixed_iterator<TIterator>& lhs,
etl::fixed_iterator<TIterator>& rhs)
{
return TIterator(lhs) - TIterator(rhs);
}
//*****************************************************************************
/// - fixed_iterator operator.
//*****************************************************************************
template <typename TIterator>
typename std::iterator_traits<TIterator>::difference_type operator -(etl::fixed_iterator<TIterator>& lhs,
etl::fixed_iterator<TIterator>& rhs)
{
return TIterator(lhs) - TIterator(rhs);
}
//*****************************************************************************
/// Equality operator. fixed_iterator == fixed_iterator.
//*****************************************************************************
template <typename TIterator>
bool operator ==(const etl::fixed_iterator<TIterator>& lhs,
const etl::fixed_iterator<TIterator>& rhs)
{
return TIterator(lhs) == TIterator(rhs);
}
//*****************************************************************************
/// Equality operator. fixed_iterator == fixed_iterator.
//*****************************************************************************
template <typename TIterator>
bool operator ==(const etl::fixed_iterator<TIterator>& lhs,
const etl::fixed_iterator<TIterator>& rhs)
{
return TIterator(lhs) == TIterator(rhs);
}
//*****************************************************************************
/// Equality operator. fixed_iterator == iterator.
//*****************************************************************************
template <typename TIterator>
bool operator ==(const etl::fixed_iterator<TIterator>& lhs,
TIterator rhs)
{
return TIterator(lhs) == rhs;
}
//*****************************************************************************
/// Equality operator. fixed_iterator == iterator.
//*****************************************************************************
template <typename TIterator>
bool operator ==(const etl::fixed_iterator<TIterator>& lhs,
TIterator rhs)
{
return TIterator(lhs) == rhs;
}
//*****************************************************************************
/// Equality operator. iterator == fixed_iterator.
//*****************************************************************************
template <typename TIterator>
bool operator ==(TIterator lhs,
const etl::fixed_iterator<TIterator>& rhs)
{
return lhs == TIterator(rhs);
}
//*****************************************************************************
/// Equality operator. iterator == fixed_iterator.
//*****************************************************************************
template <typename TIterator>
bool operator ==(TIterator lhs,
const etl::fixed_iterator<TIterator>& rhs)
{
return lhs == TIterator(rhs);
}
//*****************************************************************************
/// Inequality operator. fixed_iterator == fixed_iterator.
//*****************************************************************************
template <typename TIterator>
bool operator !=(const etl::fixed_iterator<TIterator>& lhs,
const etl::fixed_iterator<TIterator>& rhs)
{
return !(lhs == rhs);
}
//*****************************************************************************
/// Inequality operator. fixed_iterator == fixed_iterator.
//*****************************************************************************
template <typename TIterator>
bool operator !=(const etl::fixed_iterator<TIterator>& lhs,
const etl::fixed_iterator<TIterator>& rhs)
{
return !(lhs == rhs);
}
//*****************************************************************************
/// Inequality operator. fixed_iterator == iterator.
//*****************************************************************************
template <typename TIterator>
bool operator !=(const etl::fixed_iterator<TIterator>& lhs,
TIterator rhs)
{
return !(lhs == rhs);
}
//*****************************************************************************
/// Inequality operator. fixed_iterator == iterator.
//*****************************************************************************
template <typename TIterator>
bool operator !=(const etl::fixed_iterator<TIterator>& lhs,
TIterator rhs)
{
return !(lhs == rhs);
}
//*****************************************************************************
/// Inequality operator. iterator == fixed_iterator.
//*****************************************************************************
template <typename TIterator>
bool operator !=(TIterator& lhs,
const etl::fixed_iterator<TIterator>& rhs)
{
return !(lhs == rhs);
//*****************************************************************************
/// Inequality operator. iterator == fixed_iterator.
//*****************************************************************************
template <typename TIterator>
bool operator !=(TIterator& lhs,
const etl::fixed_iterator<TIterator>& rhs)
{
return !(lhs == rhs);
}
}
#endif

View File

@ -1825,86 +1825,86 @@ namespace etl
this->set_node_pool(pool);
}
};
}
//*************************************************************************
/// Equal operator.
///\param lhs Reference to the first forward_list.
///\param rhs Reference to the second forward_list.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator ==(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return (lhs.size() == rhs.size()) &&
std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//*************************************************************************
/// Equal operator.
///\param lhs Reference to the first forward_list.
///\param rhs Reference to the second forward_list.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator ==(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return (lhs.size() == rhs.size()) &&
std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//*************************************************************************
/// Not equal operator.
///\param lhs Reference to the first forward_list.
///\param rhs Reference to the second forward_list.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator !=(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return !(lhs == rhs);
}
//*************************************************************************
/// Not equal operator.
///\param lhs Reference to the first forward_list.
///\param rhs Reference to the second forward_list.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator !=(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return !(lhs == rhs);
}
//*************************************************************************
/// Less than operator.
///\param lhs Reference to the first forward_list.
///\param rhs Reference to the second forward_list.
///\return <b>true</b> if the first forward_list is lexicographically less than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator <(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//*************************************************************************
/// Less than operator.
///\param lhs Reference to the first forward_list.
///\param rhs Reference to the second forward_list.
///\return <b>true</b> if the first forward_list is lexicographically less than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator <(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//*************************************************************************
/// Greater than operator.
///\param lhs Reference to the first forward_list.
///\param rhs Reference to the second forward_list.
///\return <b>true</b> if the first forward_list is lexicographically greater than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator >(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return (rhs < lhs);
}
//*************************************************************************
/// Greater than operator.
///\param lhs Reference to the first forward_list.
///\param rhs Reference to the second forward_list.
///\return <b>true</b> if the first forward_list is lexicographically greater than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator >(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return (rhs < lhs);
}
//*************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first forward_list.
///\param rhs Reference to the second forward_list.
///\return <b>true</b> if the first forward_list is lexicographically less than or equal
/// to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator <=(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first forward_list.
///\param rhs Reference to the second forward_list.
///\return <b>true</b> if the first forward_list is lexicographically less than or equal
/// to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator <=(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first forward_list.
///\param rhs Reference to the second forward_list.
///\return <b>true</b> if the first forward_list is lexicographically greater than or
/// equal to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator >=(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return !(lhs < rhs);
//*************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first forward_list.
///\param rhs Reference to the second forward_list.
///\return <b>true</b> if the first forward_list is lexicographically greater than or
/// equal to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator >=(const etl::iforward_list<T>& lhs, const etl::iforward_list<T>& rhs)
{
return !(lhs < rhs);
}
}
#include "private/minmax_pop.h"

View File

@ -2246,85 +2246,85 @@ namespace etl
this->set_node_pool(pool);
}
};
}
//*************************************************************************
/// Equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator ==(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//*************************************************************************
/// Equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator ==(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//*************************************************************************
/// Not equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator !=(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return !(lhs == rhs);
}
//*************************************************************************
/// Not equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator !=(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return !(lhs == rhs);
}
//*************************************************************************
/// Less than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator <(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//*************************************************************************
/// Less than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator <(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//*************************************************************************
/// Greater than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator >(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return (rhs < lhs);
}
//*************************************************************************
/// Greater than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator >(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return (rhs < lhs);
}
//*************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than or equal
/// to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator <=(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than or equal
/// to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator <=(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than or
/// equal to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator >=(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return !(lhs < rhs);
//*************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than or
/// equal to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T>
bool operator >=(const etl::ilist<T>& lhs, const etl::ilist<T>& rhs)
{
return !(lhs < rhs);
}
}
#include "private/minmax_pop.h"

View File

@ -2115,87 +2115,87 @@ namespace etl
/// The pool of data nodes used for the map.
etl::pool<typename etl::imap<TKey, TValue, TCompare>::Data_Node, MAX_SIZE> node_pool;
};
}
//***************************************************************************
/// Equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
/// Equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
/// Not equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator !=(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Not equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator !=(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return !(lhs == rhs);
}
//*************************************************************************
/// Less than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator <(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//*************************************************************************
/// Less than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator <(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//*************************************************************************
/// Greater than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator >(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return (rhs < lhs);
}
//*************************************************************************
/// Greater than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator >(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return (rhs < lhs);
}
//*************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than or equal
/// to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator <=(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than or equal
/// to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator <=(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than or
/// equal to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator >=(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return !(lhs < rhs);
//*************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than or
/// equal to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator >=(const etl::imap<TKey, TMapped, TKeyCompare>& lhs, const etl::imap<TKey, TMapped, TKeyCompare>& rhs)
{
return !(lhs < rhs);
}
}
#include "private/minmax_pop.h"

View File

@ -2001,87 +2001,87 @@ namespace etl
/// The pool of data nodes used for the multimap.
etl::pool<typename etl::imultimap<TKey, TValue, TCompare>::Data_Node, MAX_SIZE> node_pool;
};
}
//***************************************************************************
/// Equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
/// Equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator ==(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
/// Not equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator !=(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Not equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator !=(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return !(lhs == rhs);
}
//*************************************************************************
/// Less than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator <(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//*************************************************************************
/// Less than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator <(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//*************************************************************************
/// Greater than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator >(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return (rhs < lhs);
}
//*************************************************************************
/// Greater than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator >(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return (rhs < lhs);
}
//*************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than or equal
/// to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator <=(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than or equal
/// to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator <=(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than or
/// equal to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator >=(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return !(lhs < rhs);
//*************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than or
/// equal to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename TKey, typename TMapped, typename TKeyCompare>
bool operator >=(const etl::imultimap<TKey, TMapped, TKeyCompare>& lhs, const etl::imultimap<TKey, TMapped, TKeyCompare>& rhs)
{
return !(lhs < rhs);
}
}
#include "private/minmax_pop.h"

View File

@ -1966,87 +1966,87 @@ namespace etl
/// The pool of data nodes used for the multiset.
etl::pool<typename etl::imultiset<T, TCompare>::Data_Node, MAX_SIZE> node_pool;
};
}
//***************************************************************************
/// Equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename T, typename TCompare>
bool operator ==(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
/// Equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename T, typename TCompare>
bool operator ==(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
/// Not equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename T, typename TCompare>
bool operator !=(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Not equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename T, typename TCompare>
bool operator !=(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return !(lhs == rhs);
}
//*************************************************************************
/// Less than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator <(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//*************************************************************************
/// Less than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator <(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//*************************************************************************
/// Greater than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator >(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return (rhs < lhs);
}
//*************************************************************************
/// Greater than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator >(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return (rhs < lhs);
}
//*************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than or equal
/// to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator <=(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than or equal
/// to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator <=(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than or
/// equal to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator >=(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return !(lhs < rhs);
//*************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than or
/// equal to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator >=(const etl::imultiset<T, TCompare>& lhs, const etl::imultiset<T, TCompare>& rhs)
{
return !(lhs < rhs);
}
}
#include "private/minmax_pop.h"

View File

@ -419,6 +419,340 @@ namespace etl
typename etl::aligned_storage_as<sizeof(T), T>::type storage;
bool valid;
};
//***************************************************************************
/// Equality operator. cppreference 1
//***************************************************************************
template <typename T>
bool operator ==(const etl::optional<T>& lhs, const etl::optional<T>& rhs)
{
if (bool(lhs) != bool(rhs))
{
return false;
}
else if (!bool(lhs) && !bool(rhs))
{
return true;
}
else
{
return lhs.value() == rhs.value();
}
}
//***************************************************************************
/// Equality operator. cppreference 2
//***************************************************************************
template <typename T>
bool operator !=(const etl::optional<T>& lhs, const etl::optional<T>& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Less than operator. cppreference 3
//***************************************************************************
template <typename T>
bool operator <(const etl::optional<T>& lhs, const etl::optional<T>& rhs)
{
if (!bool(rhs))
{
return false;
}
else if (!bool(lhs))
{
return true;
}
else
{
return lhs.value() < rhs.value();
}
}
//***************************************************************************
/// Less than equal operator. cppreference 4
//***************************************************************************
template <typename T>
bool operator <=(const etl::optional<T>& lhs, const etl::optional<T>& rhs)
{
if (!bool(lhs))
{
return true;
}
else if (!bool(rhs))
{
return false;
}
else
{
return lhs.value() <= rhs.value();
}
}
//***************************************************************************
/// greater than operator. cppreference 5
//***************************************************************************
template <typename T>
bool operator >(const etl::optional<T>& lhs, const etl::optional<T>& rhs)
{
if (!bool(lhs))
{
return false;
}
else if (!bool(rhs))
{
return true;
}
else
{
return lhs.value() > rhs.value();
}
}
//***************************************************************************
/// greater than equal operator. cppreference 6
//***************************************************************************
template <typename T>
bool operator >=(const etl::optional<T>& lhs, const etl::optional<T>& rhs)
{
if (!bool(rhs))
{
return true;
}
else if (!bool(lhs))
{
return false;
}
else
{
return lhs.value() >= rhs.value();
}
}
//***************************************************************************
/// Equality operator. cppreference 7
//***************************************************************************
template <typename T>
bool operator ==(const etl::optional<T>& lhs, etl::nullopt_t)
{
return !bool(lhs);
}
//***************************************************************************
/// Equality operator. cppreference 8
//***************************************************************************
template <typename T>
bool operator ==(etl::nullopt_t, const etl::optional<T>& rhs)
{
return !bool(rhs);
}
//***************************************************************************
/// Inequality operator. cppreference 9
//***************************************************************************
template <typename T>
bool operator !=(const etl::optional<T>& lhs, etl::nullopt_t)
{
return !(lhs == etl::nullopt);
}
//***************************************************************************
/// Inequality operator. cppreference 10
//***************************************************************************
template <typename T>
bool operator !=(etl::nullopt_t , const etl::optional<T>& rhs)
{
return !(etl::nullopt == rhs);
}
//***************************************************************************
/// Less than operator. cppreference 11
//***************************************************************************
template <typename T>
bool operator <(const etl::optional<T>&, etl::nullopt_t)
{
return false;
}
//***************************************************************************
/// Less than operator. cppreference 12
//***************************************************************************
template <typename T>
bool operator <(etl::nullopt_t, const etl::optional<T>& rhs)
{
return bool(rhs);
}
//***************************************************************************
/// Less than equal operator. cppreference 13
//***************************************************************************
template <typename T>
bool operator <=(const etl::optional<T>& lhs, etl::nullopt_t)
{
return !bool(lhs);
}
//***************************************************************************
/// Less than equal operator. cppreference 14
//***************************************************************************
template <typename T>
bool operator <=(etl::nullopt_t, const etl::optional<T>&)
{
return true;
}
//***************************************************************************
/// Greater than operator. cppreference 15
//***************************************************************************
template <typename T>
bool operator >(const etl::optional<T>& lhs, etl::nullopt_t)
{
return bool(lhs);
}
//***************************************************************************
/// Greater than operator. cppreference 16
//***************************************************************************
template <typename T>
bool operator >(etl::nullopt_t, const etl::optional<T>&)
{
return false;
}
//***************************************************************************
/// Greater than equal operator. cppreference 17
//***************************************************************************
template <typename T>
bool operator >=(const etl::optional<T>&, etl::nullopt_t)
{
return true;
}
//***************************************************************************
/// Greater than equal operator. cppreference 18
//***************************************************************************
template <typename T>
bool operator >=(etl::nullopt_t, const etl::optional<T>& rhs)
{
return !bool(rhs);
}
//***************************************************************************
/// Equality operator. cppreference 19
//**************************************************************************
template <typename T, typename U>
bool operator ==(const etl::optional<T>& lhs, const U& rhs)
{
return bool(lhs) ? lhs.value() == rhs : false;
}
//***************************************************************************
/// Inequality operator. cppreference 21
//**************************************************************************
template <typename T, typename U>
bool operator !=(const etl::optional<T>& lhs, const U& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Equality operator. cppreference 20
//**************************************************************************
template <typename T, typename U>
bool operator ==(const U& lhs, const etl::optional<T>& rhs)
{
return bool(rhs) ? rhs.value() == lhs : false;
}
//***************************************************************************
/// Inequality operator. cppreference 22
//**************************************************************************
template <typename T, typename U>
bool operator !=(const U& lhs, const etl::optional<T>& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Less than operator. cppreference 23
//***************************************************************************
template <typename T, typename U>
bool operator <(const etl::optional<T>& lhs, const U& rhs)
{
return bool(lhs) ? lhs.value() < rhs : true;
}
//***************************************************************************
/// Less than operator. cppreference 24
//***************************************************************************
template <typename T, typename U>
bool operator <(const U& lhs, const etl::optional<T>& rhs)
{
return bool(rhs) ? lhs < rhs.value() : false;
}
//***************************************************************************
/// Less than equal operator. cppreference 25
//***************************************************************************
template <typename T, typename U>
bool operator <=(const etl::optional<T>& lhs, const U& rhs)
{
return bool(lhs) ? lhs.value() <= rhs : true;
}
//***************************************************************************
/// Less than equal operator. cppreference 26
//***************************************************************************
template <typename T, typename U>
bool operator <=(const U& lhs, const etl::optional<T>& rhs)
{
return bool(rhs) ? lhs <= rhs.value() : false;
}
//***************************************************************************
/// Greater than operator. cppreference 27
//***************************************************************************
template <typename T, typename U>
bool operator >(const etl::optional<T>& lhs, const U& rhs)
{
return bool(lhs) ? lhs.value() > rhs : false;
}
//***************************************************************************
/// Greater than operator. cppreference 28
//***************************************************************************
template <typename T, typename U>
bool operator >(const U& lhs, const etl::optional<T>& rhs)
{
return bool(rhs) ? lhs > rhs.value() : true;
}
//***************************************************************************
/// Greater than equal operator. cppreference 29
//***************************************************************************
template <typename T, typename U>
bool operator >=(const etl::optional<T>& lhs, const U& rhs)
{
return bool(lhs) ? lhs.value() >= rhs : false;
}
//***************************************************************************
/// Greater than equal operator. cppreference 30
//***************************************************************************
template <typename T, typename U>
bool operator >=(const U& lhs, const etl::optional<T>& rhs)
{
return bool(rhs) ? lhs >= rhs.value() : true;
}
//***************************************************************************
/// Make an optional.
//***************************************************************************
template <typename T>
etl::optional<typename etl::decay<T>::type> make_optional(T& value)
{
return etl::optional<typename etl::decay<T>::type>(value);
}
}
//*************************************************************************
@ -430,338 +764,4 @@ void swap(etl::optional<T>& lhs, etl::optional<T>& rhs)
lhs.swap(rhs);
}
//***************************************************************************
/// Equality operator. cppreference 1
//***************************************************************************
template <typename T>
bool operator ==(const etl::optional<T>& lhs, const etl::optional<T>& rhs)
{
if (bool(lhs) != bool(rhs))
{
return false;
}
else if (!bool(lhs) && !bool(rhs))
{
return true;
}
else
{
return lhs.value() == rhs.value();
}
}
//***************************************************************************
/// Equality operator. cppreference 2
//***************************************************************************
template <typename T>
bool operator !=(const etl::optional<T>& lhs, const etl::optional<T>& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Less than operator. cppreference 3
//***************************************************************************
template <typename T>
bool operator <(const etl::optional<T>& lhs, const etl::optional<T>& rhs)
{
if (!bool(rhs))
{
return false;
}
else if (!bool(lhs))
{
return true;
}
else
{
return lhs.value() < rhs.value();
}
}
//***************************************************************************
/// Less than equal operator. cppreference 4
//***************************************************************************
template <typename T>
bool operator <=(const etl::optional<T>& lhs, const etl::optional<T>& rhs)
{
if (!bool(lhs))
{
return true;
}
else if (!bool(rhs))
{
return false;
}
else
{
return lhs.value() <= rhs.value();
}
}
//***************************************************************************
/// greater than operator. cppreference 5
//***************************************************************************
template <typename T>
bool operator >(const etl::optional<T>& lhs, const etl::optional<T>& rhs)
{
if (!bool(lhs))
{
return false;
}
else if (!bool(rhs))
{
return true;
}
else
{
return lhs.value() > rhs.value();
}
}
//***************************************************************************
/// greater than equal operator. cppreference 6
//***************************************************************************
template <typename T>
bool operator >=(const etl::optional<T>& lhs, const etl::optional<T>& rhs)
{
if (!bool(rhs))
{
return true;
}
else if (!bool(lhs))
{
return false;
}
else
{
return lhs.value() >= rhs.value();
}
}
//***************************************************************************
/// Equality operator. cppreference 7
//***************************************************************************
template <typename T>
bool operator ==(const etl::optional<T>& lhs, etl::nullopt_t)
{
return !bool(lhs);
}
//***************************************************************************
/// Equality operator. cppreference 8
//***************************************************************************
template <typename T>
bool operator ==(etl::nullopt_t, const etl::optional<T>& rhs)
{
return !bool(rhs);
}
//***************************************************************************
/// Inequality operator. cppreference 9
//***************************************************************************
template <typename T>
bool operator !=(const etl::optional<T>& lhs, etl::nullopt_t)
{
return !(lhs == etl::nullopt);
}
//***************************************************************************
/// Inequality operator. cppreference 10
//***************************************************************************
template <typename T>
bool operator !=(etl::nullopt_t , const etl::optional<T>& rhs)
{
return !(etl::nullopt == rhs);
}
//***************************************************************************
/// Less than operator. cppreference 11
//***************************************************************************
template <typename T>
bool operator <(const etl::optional<T>&, etl::nullopt_t)
{
return false;
}
//***************************************************************************
/// Less than operator. cppreference 12
//***************************************************************************
template <typename T>
bool operator <(etl::nullopt_t, const etl::optional<T>& rhs)
{
return bool(rhs);
}
//***************************************************************************
/// Less than equal operator. cppreference 13
//***************************************************************************
template <typename T>
bool operator <=(const etl::optional<T>& lhs, etl::nullopt_t)
{
return !bool(lhs);
}
//***************************************************************************
/// Less than equal operator. cppreference 14
//***************************************************************************
template <typename T>
bool operator <=(etl::nullopt_t, const etl::optional<T>&)
{
return true;
}
//***************************************************************************
/// Greater than operator. cppreference 15
//***************************************************************************
template <typename T>
bool operator >(const etl::optional<T>& lhs, etl::nullopt_t)
{
return bool(lhs);
}
//***************************************************************************
/// Greater than operator. cppreference 16
//***************************************************************************
template <typename T>
bool operator >(etl::nullopt_t, const etl::optional<T>&)
{
return false;
}
//***************************************************************************
/// Greater than equal operator. cppreference 17
//***************************************************************************
template <typename T>
bool operator >=(const etl::optional<T>&, etl::nullopt_t)
{
return true;
}
//***************************************************************************
/// Greater than equal operator. cppreference 18
//***************************************************************************
template <typename T>
bool operator >=(etl::nullopt_t, const etl::optional<T>& rhs)
{
return !bool(rhs);
}
//***************************************************************************
/// Equality operator. cppreference 19
//**************************************************************************
template <typename T, typename U>
bool operator ==(const etl::optional<T>& lhs, const U& rhs)
{
return bool(lhs) ? lhs.value() == rhs : false;
}
//***************************************************************************
/// Inequality operator. cppreference 21
//**************************************************************************
template <typename T, typename U>
bool operator !=(const etl::optional<T>& lhs, const U& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Equality operator. cppreference 20
//**************************************************************************
template <typename T, typename U>
bool operator ==(const U& lhs, const etl::optional<T>& rhs)
{
return bool(rhs) ? rhs.value() == lhs : false;
}
//***************************************************************************
/// Inequality operator. cppreference 22
//**************************************************************************
template <typename T, typename U>
bool operator !=(const U& lhs, const etl::optional<T>& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Less than operator. cppreference 23
//***************************************************************************
template <typename T, typename U>
bool operator <(const etl::optional<T>& lhs, const U& rhs)
{
return bool(lhs) ? lhs.value() < rhs : true;
}
//***************************************************************************
/// Less than operator. cppreference 24
//***************************************************************************
template <typename T, typename U>
bool operator <(const U& lhs, const etl::optional<T>& rhs)
{
return bool(rhs) ? lhs < rhs.value() : false;
}
//***************************************************************************
/// Less than equal operator. cppreference 25
//***************************************************************************
template <typename T, typename U>
bool operator <=(const etl::optional<T>& lhs, const U& rhs)
{
return bool(lhs) ? lhs.value() <= rhs : true;
}
//***************************************************************************
/// Less than equal operator. cppreference 26
//***************************************************************************
template <typename T, typename U>
bool operator <=(const U& lhs, const etl::optional<T>& rhs)
{
return bool(rhs) ? lhs <= rhs.value() : false;
}
//***************************************************************************
/// Greater than operator. cppreference 27
//***************************************************************************
template <typename T, typename U>
bool operator >(const etl::optional<T>& lhs, const U& rhs)
{
return bool(lhs) ? lhs.value() > rhs : false;
}
//***************************************************************************
/// Greater than operator. cppreference 28
//***************************************************************************
template <typename T, typename U>
bool operator >(const U& lhs, const etl::optional<T>& rhs)
{
return bool(rhs) ? lhs > rhs.value() : true;
}
//***************************************************************************
/// Greater than equal operator. cppreference 29
//***************************************************************************
template <typename T, typename U>
bool operator >=(const etl::optional<T>& lhs, const U& rhs)
{
return bool(lhs) ? lhs.value() >= rhs : false;
}
//***************************************************************************
/// Greater than equal operator. cppreference 30
//***************************************************************************
template <typename T, typename U>
bool operator >=(const U& lhs, const etl::optional<T>& rhs)
{
return bool(rhs) ? lhs >= rhs.value() : true;
}
//***************************************************************************
/// Make an optional.
//***************************************************************************
template <typename T>
etl::optional<typename etl::decay<T>::type> make_optional(T& value)
{
return etl::optional<typename etl::decay<T>::type>(value);
}
#endif

View File

@ -2023,87 +2023,87 @@ namespace etl
/// The pool of data nodes used for the set.
etl::pool<typename etl::iset<T, TCompare>::Data_Node, MAX_SIZE> node_pool;
};
}
//***************************************************************************
/// Equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename T, typename TCompare>
bool operator ==(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
/// Equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename T, typename TCompare>
bool operator ==(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return (lhs.size() == rhs.size()) && std::equal(lhs.begin(), lhs.end(), rhs.begin());
}
//***************************************************************************
/// Not equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename T, typename TCompare>
bool operator !=(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return !(lhs == rhs);
}
//***************************************************************************
/// Not equal operator.
///\param lhs Reference to the first lookup.
///\param rhs Reference to the second lookup.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
///\ingroup lookup
//***************************************************************************
template <typename T, typename TCompare>
bool operator !=(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return !(lhs == rhs);
}
//*************************************************************************
/// Less than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator <(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//*************************************************************************
/// Less than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator <(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return std::lexicographical_compare(lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end());
}
//*************************************************************************
/// Greater than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator >(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return (rhs < lhs);
}
//*************************************************************************
/// Greater than operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than the
/// second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator >(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return (rhs < lhs);
}
//*************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than or equal
/// to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator <=(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Less than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically less than or equal
/// to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator <=(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return !(lhs > rhs);
}
//*************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than or
/// equal to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator >=(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return !(lhs < rhs);
//*************************************************************************
/// Greater than or equal operator.
///\param lhs Reference to the first list.
///\param rhs Reference to the second list.
///\return <b>true</b> if the first list is lexicographically greater than or
/// equal to the second, otherwise <b>false</b>.
//*************************************************************************
template <typename T, typename TCompare>
bool operator >=(const etl::iset<T, TCompare>& lhs, const etl::iset<T, TCompare>& rhs)
{
return !(lhs < rhs);
}
}
#include "private/minmax_pop.h"