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 (#1408)
* Print test names at test time (#1343) * Fix operator| conflict with std::ranges (#1395) * 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. --------- Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com> Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
This commit is contained in:
parent
43e97b7f3c
commit
ff772d4bd1
@ -2370,47 +2370,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