mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
Two cpp98 fixes (#206)
* C++98/03 compatibility changes * Added support for nullptr == and != for cpp98 * This default type made problem in cpp98 Co-authored-by: John Wellbelove <github@wellbelove.co.uk>
This commit is contained in:
parent
d1b3dfcc05
commit
5cc55527f1
@ -67,6 +67,27 @@ namespace std
|
||||
// Can't take address of nullptr.
|
||||
void operator&() const ETL_DELETE;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
bool operator==(const T* t, const std::nullptr_t nullptr) {
|
||||
return t == (T*)0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool operator==(const std::nullptr_t nullptr, const T* t) {
|
||||
return t == nullptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool operator!=(const T* t, const std::nullptr_t nullptr) {
|
||||
return !(t == nullptr);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool operator!=(const std::nullptr_t nullptr, const T* t) {
|
||||
return t != nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
||||
@ -864,12 +864,18 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Swaps the values.
|
||||
//*************************************************************************
|
||||
template <typename T, typename TTraits = etl::char_traits<T> >
|
||||
template <typename T, typename TTraits >
|
||||
void swap(etl::basic_string_view<T, TTraits>& lhs, etl::basic_string_view<T, TTraits>& rhs)
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void swap(etl::basic_string_view<T, etl::char_traits<T> >& lhs, etl::basic_string_view<T, etl::char_traits<T> >& rhs)
|
||||
{
|
||||
lhs.swap(rhs);
|
||||
}
|
||||
|
||||
#include "private/minmax_pop.h"
|
||||
|
||||
#undef ETL_FILE
|
||||
|
||||
@ -13,7 +13,9 @@ Added code for ARM5 compiler compatibility in limits.h
|
||||
|
||||
Simplified conditional compilation for nullptr definition.
|
||||
|
||||
Compiler compatibility changes to assign() in etl::string_view
|
||||
Changes to assign() in etl::string_view for compiler compatibility
|
||||
|
||||
Changes to container iterators fo compiler compatibility.
|
||||
|
||||
===============================================================================
|
||||
16.8.1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user