1
0
forked from boostorg/core

Apply msvc-12.0 (and below) workarounds

This commit is contained in:
Peter Dimov
2021-10-05 05:30:37 +03:00
parent 01bd23df5d
commit b93317815c
2 changed files with 25 additions and 3 deletions

View File

@ -14,6 +14,7 @@
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/core/demangle.hpp>
#include <boost/core/is_same.hpp>
#include <boost/config.hpp>
#include <string>
#include <functional>
@ -73,6 +74,24 @@ template<class T> struct tn_is_reference<T&&>
#endif
// tn_remove_const
template<class T> struct tn_remove_const
{
typedef T type;
};
template<class T> struct tn_remove_const<T const>
{
typedef T type;
};
// tn_is_function (also catches references but that's OK)
template<class T, class U = typename tn_remove_const<T>::type> struct tn_is_function: core::is_same<U, U const>
{
};
#if !defined(BOOST_NO_TYPEID)
// typeid_name
@ -261,21 +280,21 @@ template<class T> std::string type_name( tn_identity<T const volatile> )
#else
template<class T>
typename tn_enable_if<!tn_is_reference<T>::value, std::string>::type
typename tn_enable_if<!tn_is_function<T>::value, std::string>::type
type_name( tn_identity<T const> )
{
return type_name( tn_identity<T>() ) + " const";
}
template<class T>
typename tn_enable_if<!tn_is_reference<T>::value, std::string>::type
typename tn_enable_if<!tn_is_function<T>::value, std::string>::type
type_name( tn_identity<T volatile> )
{
return type_name( tn_identity<T>() ) + " volatile";
}
template<class T>
typename tn_enable_if<!tn_is_reference<T>::value, std::string>::type
typename tn_enable_if<!tn_is_function<T>::value, std::string>::type
type_name( tn_identity<T const volatile> )
{
return type_name( tn_identity<T>() ) + " const volatile";

View File

@ -105,6 +105,8 @@ int main()
TEST(void*);
TEST(void const* volatile*);
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
TEST(void());
TEST(int(float, A, B*));
@ -115,6 +117,7 @@ int main()
TEST(void(&&)());
#endif
#endif
TEST(A[]);