AP_Common: missing: move definitions to standard headers

This way we don't create problems regarding which header to include: we
just include the normal/c++11 headers and everything works as it should.
This commit is contained in:
Lucas De Marchi 2016-02-16 12:35:44 -02:00
parent 75d58bcfb6
commit d80a0e47bc
3 changed files with 33 additions and 12 deletions

View File

@ -3,19 +3,9 @@
#include_next <cstddef>
#if defined(HAVE_STD_NULLPTR_T) && !HAVE_STD_NULLPTR_T
namespace std {
typedef decltype(nullptr) nullptr_t;
#if defined(HAVE_STD_MOVE) && !HAVE_STD_MOVE
template< class T > struct remove_reference {typedef T type;};
template< class T > struct remove_reference<T&> {typedef T type;};
template< class T > struct remove_reference<T&&> {typedef T type;};
template< class T >
typename std::remove_reference<T>::type&& move(T&& t) noexcept
{
return static_cast<typename std::remove_reference<T>::type&&>(t);
}
#endif
}
#endif

View File

@ -0,0 +1,15 @@
#pragma once
#if !defined(HAVE_TYPE_TRAITS_H) || HAVE_TYPE_TRAITS_H
#include_next <type_traits>
#endif
#if defined(HAVE_STD_REMOVE_REFERENCE) && !HAVE_STD_REMOVE_REFERENCE
namespace std {
template<class T> struct remove_reference { typedef T type; };
template<class T> struct remove_reference<T&> { typedef T type; };
template<class T> struct remove_reference<T&&> { typedef T type; };
}
#endif

View File

@ -0,0 +1,16 @@
#pragma once
#include_next <utility>
#if defined(HAVE_STD_MOVE) && !HAVE_STD_MOVE
#include <type_traits>
namespace std {
template<class T>
typename std::remove_reference<T>::type&& move(T&& t) noexcept
{
return static_cast<typename std::remove_reference<T>::type&&>(t);
}
}
#endif