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:
Tom 2020-03-28 11:29:05 +03:00 committed by GitHub
parent d1b3dfcc05
commit 5cc55527f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 2 deletions

View File

@ -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;
}
}
//*****************************************************************************

View File

@ -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

View 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