forked from boostorg/type_traits
Improve tests for new *_t template aliases.
Add missing *_t aliases.
This commit is contained in:
@ -18,6 +18,8 @@ for backwards compatibility only.
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T> using add_reference_t = typename add_reference<T>::type; // C++11 and above
|
||||
|
||||
__type If `T` is not a reference type then `T&`, otherwise `T`.
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <class T> using type_identity_t = typename type_identity<T>::type; // C++11 and above
|
||||
|
||||
__header ` #include <boost/type_traits/type_identity.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
||||
|
@ -54,6 +54,13 @@ template <> struct add_reference<const volatile void> { typedef const volatile v
|
||||
template <> struct add_reference<volatile void> { typedef volatile void type; };
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using add_reference_t = typename add_reference<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED
|
||||
|
@ -16,6 +16,13 @@ namespace boost
|
||||
|
||||
template <class T> struct remove_bounds : public remove_extent<T> {};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using remove_bounds_t = typename remove_bounds<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED
|
||||
|
@ -17,6 +17,13 @@ template<class T> struct type_identity
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using type_identity_t = typename type_identity<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_TYPE_TRAITS_TYPE_IDENTITY_HPP_INCLUDED
|
||||
|
@ -96,8 +96,34 @@ int error_count = 0;
|
||||
int main(){
|
||||
#define TT_TEST_END return error_count; }
|
||||
|
||||
#ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES
|
||||
|
||||
#define TRANSFORM_CHECK_ALIASES(name, from_suffix, to_suffix)\
|
||||
BOOST_CHECK_TYPE(bool to_suffix, name##_t<bool from_suffix>);\
|
||||
BOOST_CHECK_TYPE(char to_suffix, name##_t<char from_suffix>);\
|
||||
BOOST_CHECK_TYPE(wchar_t to_suffix, name##_t<wchar_t from_suffix>);\
|
||||
BOOST_CHECK_TYPE(signed char to_suffix, name##_t<signed char from_suffix>);\
|
||||
BOOST_CHECK_TYPE(unsigned char to_suffix, name##_t<unsigned char from_suffix>);\
|
||||
BOOST_CHECK_TYPE(short to_suffix, name##_t<short from_suffix>);\
|
||||
BOOST_CHECK_TYPE(unsigned short to_suffix, name##_t<unsigned short from_suffix>);\
|
||||
BOOST_CHECK_TYPE(int to_suffix, name##_t<int from_suffix>);\
|
||||
BOOST_CHECK_TYPE(unsigned int to_suffix, name##_t<unsigned int from_suffix>);\
|
||||
BOOST_CHECK_TYPE(long to_suffix, name##_t<long from_suffix>);\
|
||||
BOOST_CHECK_TYPE(unsigned long to_suffix, name##_t<unsigned long from_suffix>);\
|
||||
BOOST_CHECK_TYPE(float to_suffix, name##_t<float from_suffix>);\
|
||||
BOOST_CHECK_TYPE(long double to_suffix, name##_t<long double from_suffix>);\
|
||||
BOOST_CHECK_TYPE(double to_suffix, name##_t<double from_suffix>);\
|
||||
BOOST_CHECK_TYPE(UDT to_suffix, name##_t<UDT from_suffix>);\
|
||||
BOOST_CHECK_TYPE(enum1 to_suffix, name##_t<enum1 from_suffix>);
|
||||
|
||||
#else
|
||||
|
||||
#define TRANSFORM_CHECK_ALIASES(name, from_suffix, to_suffix) /**/
|
||||
|
||||
#endif
|
||||
|
||||
#define TRANSFORM_CHECK(name, from_suffix, to_suffix)\
|
||||
TRANSFORM_CHECK_ALIASES(name, from_suffix, to_suffix)\
|
||||
BOOST_CHECK_TYPE(bool to_suffix, name<bool from_suffix>::type);\
|
||||
BOOST_CHECK_TYPE(char to_suffix, name<char from_suffix>::type);\
|
||||
BOOST_CHECK_TYPE(wchar_t to_suffix, name<wchar_t from_suffix>::type);\
|
||||
|
Reference in New Issue
Block a user