diff --git a/doc/add_reference.qbk b/doc/add_reference.qbk index 279d986..9d8bb4c 100644 --- a/doc/add_reference.qbk +++ b/doc/add_reference.qbk @@ -18,6 +18,8 @@ for backwards compatibility only. { typedef __below type; }; + + template using add_reference_t = typename add_reference::type; // C++11 and above __type If `T` is not a reference type then `T&`, otherwise `T`. diff --git a/doc/type_identity.qbk b/doc/type_identity.qbk index 975653d..5fe7e92 100644 --- a/doc/type_identity.qbk +++ b/doc/type_identity.qbk @@ -12,6 +12,8 @@ { typedef T type; }; + + template using type_identity_t = typename type_identity::type; // C++11 and above __header ` #include ` or ` #include ` diff --git a/include/boost/type_traits/add_reference.hpp b/include/boost/type_traits/add_reference.hpp index 3c91415..33e9bc7 100644 --- a/include/boost/type_traits/add_reference.hpp +++ b/include/boost/type_traits/add_reference.hpp @@ -54,6 +54,13 @@ template <> struct add_reference { typedef const volatile v template <> struct add_reference { typedef volatile void type; }; #endif +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template using add_reference_t = typename add_reference::type; + +#endif + + } // namespace boost #endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED diff --git a/include/boost/type_traits/remove_bounds.hpp b/include/boost/type_traits/remove_bounds.hpp index 56988d2..cd0565d 100644 --- a/include/boost/type_traits/remove_bounds.hpp +++ b/include/boost/type_traits/remove_bounds.hpp @@ -16,6 +16,13 @@ namespace boost template struct remove_bounds : public remove_extent {}; +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template using remove_bounds_t = typename remove_bounds::type; + +#endif + + } // namespace boost #endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED diff --git a/include/boost/type_traits/type_identity.hpp b/include/boost/type_traits/type_identity.hpp index 6d2dd5b..73cb3f3 100644 --- a/include/boost/type_traits/type_identity.hpp +++ b/include/boost/type_traits/type_identity.hpp @@ -17,6 +17,13 @@ template struct type_identity typedef T type; }; +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +template using type_identity_t = typename type_identity::type; + +#endif + + } // namespace boost #endif // #ifndef BOOST_TYPE_TRAITS_TYPE_IDENTITY_HPP_INCLUDED diff --git a/test/test.hpp b/test/test.hpp index 6514dab..9db5d29 100644 --- a/test/test.hpp +++ b/test/test.hpp @@ -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);\ + BOOST_CHECK_TYPE(char to_suffix, name##_t);\ + BOOST_CHECK_TYPE(wchar_t to_suffix, name##_t);\ + BOOST_CHECK_TYPE(signed char to_suffix, name##_t);\ + BOOST_CHECK_TYPE(unsigned char to_suffix, name##_t);\ + BOOST_CHECK_TYPE(short to_suffix, name##_t);\ + BOOST_CHECK_TYPE(unsigned short to_suffix, name##_t);\ + BOOST_CHECK_TYPE(int to_suffix, name##_t);\ + BOOST_CHECK_TYPE(unsigned int to_suffix, name##_t);\ + BOOST_CHECK_TYPE(long to_suffix, name##_t);\ + BOOST_CHECK_TYPE(unsigned long to_suffix, name##_t);\ + BOOST_CHECK_TYPE(float to_suffix, name##_t);\ + BOOST_CHECK_TYPE(long double to_suffix, name##_t);\ + BOOST_CHECK_TYPE(double to_suffix, name##_t);\ + BOOST_CHECK_TYPE(UDT to_suffix, name##_t);\ + BOOST_CHECK_TYPE(enum1 to_suffix, name##_t); + +#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::type);\ BOOST_CHECK_TYPE(char to_suffix, name::type);\ BOOST_CHECK_TYPE(wchar_t to_suffix, name::type);\