mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Move operators for etl::unique_ptr to etl namespace
This is in accordance with the operators of std::unique_ptr. Also, it doesn't pollute the global namespace, and also works together with ADL, finding the operators in the etl namespace now.
This commit is contained in:
parent
3e4d41ca57
commit
a41f1d5ec8
@ -2259,47 +2259,43 @@ namespace etl
|
||||
pointer p;
|
||||
TDeleter deleter;
|
||||
};
|
||||
} // namespace etl
|
||||
|
||||
//*****************************************************************************
|
||||
// Global functions for unique_ptr
|
||||
//*****************************************************************************
|
||||
template <typename T1, typename TD1, typename T2, typename TD2>
|
||||
bool operator==(const etl::unique_ptr<T1, TD1>& lhs, const etl::unique_ptr<T2, TD2>& rhs)
|
||||
{
|
||||
return lhs.get() == rhs.get();
|
||||
}
|
||||
//*****************************************************************************
|
||||
// Comparison operators for unique_ptr
|
||||
//*****************************************************************************
|
||||
template <typename T1, typename TD1, typename T2, typename TD2>
|
||||
bool operator==(const etl::unique_ptr<T1, TD1>& lhs, const etl::unique_ptr<T2, TD2>& rhs)
|
||||
{
|
||||
return lhs.get() == rhs.get();
|
||||
}
|
||||
|
||||
//*********************************
|
||||
template <typename T1, typename TD1, typename T2, typename TD2>
|
||||
bool operator<(const etl::unique_ptr<T1, TD1>& lhs, const etl::unique_ptr<T2, TD2>& rhs)
|
||||
{
|
||||
return reinterpret_cast<char*>(lhs.get()) < reinterpret_cast<char*>(rhs.get());
|
||||
}
|
||||
//*********************************
|
||||
template <typename T1, typename TD1, typename T2, typename TD2>
|
||||
bool operator<(const etl::unique_ptr<T1, TD1>& lhs, const etl::unique_ptr<T2, TD2>& rhs)
|
||||
{
|
||||
return reinterpret_cast<char*>(lhs.get()) < reinterpret_cast<char*>(rhs.get());
|
||||
}
|
||||
|
||||
//*********************************
|
||||
template <typename T1, typename TD1, typename T2, typename TD2>
|
||||
bool operator<=(const etl::unique_ptr<T1, TD1>& lhs, const etl::unique_ptr<T2, TD2>& rhs)
|
||||
{
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
//*********************************
|
||||
template <typename T1, typename TD1, typename T2, typename TD2>
|
||||
bool operator<=(const etl::unique_ptr<T1, TD1>& lhs, const etl::unique_ptr<T2, TD2>& rhs)
|
||||
{
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
|
||||
//*********************************
|
||||
template <typename T1, typename TD1, typename T2, typename TD2>
|
||||
bool operator>(const etl::unique_ptr<T1, TD1>& lhs, const etl::unique_ptr<T2, TD2>& rhs)
|
||||
{
|
||||
return (rhs < lhs);
|
||||
}
|
||||
//*********************************
|
||||
template <typename T1, typename TD1, typename T2, typename TD2>
|
||||
bool operator>(const etl::unique_ptr<T1, TD1>& lhs, const etl::unique_ptr<T2, TD2>& rhs)
|
||||
{
|
||||
return (rhs < lhs);
|
||||
}
|
||||
|
||||
//*********************************
|
||||
template <typename T1, typename TD1, typename T2, typename TD2>
|
||||
bool operator>=(const etl::unique_ptr<T1, TD1>& lhs, const etl::unique_ptr<T2, TD2>& rhs)
|
||||
{
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
namespace etl
|
||||
{
|
||||
//*********************************
|
||||
template <typename T1, typename TD1, typename T2, typename TD2>
|
||||
bool operator>=(const etl::unique_ptr<T1, TD1>& lhs, const etl::unique_ptr<T2, TD2>& rhs)
|
||||
{
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
//*****************************************************************************
|
||||
/// Default construct an item at address p.
|
||||
///\ingroup memory
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user