mirror of
https://github.com/boostorg/type_traits.git
synced 2025-07-29 20:17:21 +02:00
Add _t aliases
This commit is contained in:
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using add_const_t = typename add_const<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `T const` for all `T`.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using add_cv_t = typename add_cv<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `T const volatile` for all `T`.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; // C++11 and above
|
||||
|
||||
__type If `T` names an object or function type then the member typedef `type`
|
||||
shall name `T&`; otherwise, if `T` names a type ['rvalue reference to U] then
|
||||
the member typedef type shall name `U&`; otherwise, type shall name `T`.
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using add_pointer_t = typename add_pointer<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `remove_reference<T>::type*`.
|
||||
|
||||
The rationale for this template
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using add_rvalue_reference_t = typename add_rvalue_reference<T>::type; // C++11 and above
|
||||
|
||||
__type If `T` names an object or function type then the member typedef type
|
||||
shall name `T&&`; otherwise, type shall name `T`. ['\[Note: This rule reflects
|
||||
the semantics of reference collapsing. For example, when a type `T` names
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using add_volatile_t = typename add_volatile<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `T volatile` for all `T`.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
@ -15,6 +15,7 @@ __header ` #include <boost/type_traits/common_type.hpp>` or ` #include <boost/ty
|
||||
|
||||
namespace boost {
|
||||
template <class... T> struct common_type;
|
||||
template<class... T> using common_type_t = typename common_type<T...>::type; // C++11 and above
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@ __header ` #include <boost/type_traits/conditional.hpp>` or ` #include <boost/ty
|
||||
|
||||
namespace boost {
|
||||
template <bool B, class T, class U> struct __conditional;
|
||||
template <bool B, class T, class U> using conditional_t = typename conditional<B, T, U>::type; // C++11 and above
|
||||
}
|
||||
|
||||
If B is true, the member typedef type shall equal T. If B is false, the member typedef type shall equal U.
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T, class U> using copy_cv_t = typename copy_cv<T, U>::type; // C++11 and above
|
||||
|
||||
__type [^T /cv/], where /cv/ are the cv-qualifiers of `U`.
|
||||
|
||||
__header ` #include <boost/type_traits/copy_cv.hpp>` or ` #include <boost/type_traits.hpp>`
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using decay_t = typename decay<T>::type; // C++11 and above
|
||||
|
||||
__type Let `U` be the result of `remove_reference<T>::type`, then if `U` is
|
||||
an array type, the result is `remove_extent<U>::type*`, otherwise if `U` is a
|
||||
function type then the result is `U*`, otherwise the result is `U`.
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using floating_point_promotion_t = typename floating_point_promotion<T>::type; // C++11 and above
|
||||
|
||||
__type If floating point promotion can be applied to an rvalue of type `T`,
|
||||
then applies floating point promotion to `T` and keeps cv-qualifiers of `T`,
|
||||
otherwise leaves `T` unchanged.
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using integral_promotion_t = typename integral_promotion<T>::type; // C++11 and above
|
||||
|
||||
__type If integral promotion can be applied to an rvalue of type `T`, then
|
||||
applies integral promotion to `T` and keeps cv-qualifiers of `T`,
|
||||
otherwise leaves `T` unchanged.
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using make_signed_t = typename make_signed<T>::type; // C++11 and above
|
||||
|
||||
__type If T is a signed integer type then the same type as T, if T is an
|
||||
unsigned integer type then the corresponding signed type.
|
||||
Otherwise if T is an enumerated or
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using make_unsigned_t = typename make_unsigned<T>::type; // C++11 and above
|
||||
|
||||
__type If T is a unsigned integer type then the same type as T, if T is an
|
||||
signed integer type then the corresponding unsigned type.
|
||||
Otherwise if T is an enumerated or
|
||||
|
@ -13,6 +13,8 @@
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T> using promote_t = typename promote<T>::type; // C++11 and above
|
||||
|
||||
__type If integral or floating point promotion can be applied to an rvalue
|
||||
of type `T`, then applies integral and floating point promotions to `T` and
|
||||
keeps cv-qualifiers of `T`, otherwise leaves `T` unchanged. See also
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using remove_all_extents_t = typename remove_all_extents<T>::type; // C++11 and above
|
||||
|
||||
__type If `T` is an array type, then removes all of the array bounds on `T`, otherwise
|
||||
leaves `T` unchanged.
|
||||
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using remove_const_t = typename remove_const<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `T`, but with any /top level/ const-qualifier removed.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using remove_cv_t = typename remove_cv<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `T`, but with any /top level/ cv-qualifiers removed.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using remove_extent_t = typename remove_extent<T>::type; // C++11 and above
|
||||
|
||||
__type If `T` is an array type, then removes the topmost array bound,
|
||||
otherwise leaves `T` unchanged.
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
template <class T> using remove_pointer_t = typename remove_pointer<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `T`, but with any pointer modifier removed. Note that pointers to members are left unchanged:
|
||||
removing the pointer decoration would result in an invalid type.
|
||||
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using remove_reference_t = typename remove_reference<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `T`, but with any reference modifier removed.
|
||||
|
||||
__std_ref 8.3.2.
|
||||
|
@ -12,7 +12,9 @@
|
||||
{
|
||||
typedef __below type;
|
||||
};
|
||||
|
||||
|
||||
template <class T> using remove_volatile_t = typename remove_volatile<T>::type; // C++11 and above
|
||||
|
||||
__type The same type as `T`, but with any /top level/ volatile-qualifier removed.
|
||||
|
||||
__std_ref 3.9.3.
|
||||
|
@ -41,6 +41,12 @@ namespace boost {
|
||||
typedef T& type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using add_const_t = typename add_const<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_ADD_CONST_HPP_INCLUDED
|
||||
|
@ -36,6 +36,12 @@ template <class T> struct add_cv{ typedef T const volatile type; };
|
||||
|
||||
template <class T> struct add_cv<T&>{ typedef T& type; };
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using add_cv_t = typename add_cv<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_ADD_CV_HPP_INCLUDED
|
||||
|
@ -22,6 +22,12 @@ template <class T> struct add_lvalue_reference<T&&>
|
||||
};
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using add_lvalue_reference_t = typename add_lvalue_reference<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif // BOOST_TYPE_TRAITS_EXT_ADD_LVALUE_REFERENCE__HPP
|
||||
|
@ -56,6 +56,12 @@ struct add_pointer
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using add_pointer_t = typename add_pointer<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_ADD_POINTER_HPP_INCLUDED
|
||||
|
@ -58,6 +58,12 @@ template <class T> struct add_rvalue_reference
|
||||
typedef typename boost::type_traits_detail::add_rvalue_reference_imp<T>::type type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using add_rvalue_reference_t = typename add_rvalue_reference<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
|
||||
|
@ -35,6 +35,12 @@ template <class T> struct add_volatile{ typedef T volatile type; };
|
||||
|
||||
template <class T> struct add_volatile<T&>{ typedef T& type; };
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using add_volatile_t = typename add_volatile<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_ADD_VOLATILE_HPP_INCLUDED
|
||||
|
@ -14,6 +14,12 @@ namespace boost {
|
||||
template <bool b, class T, class U> struct conditional { typedef T type; };
|
||||
template <class T, class U> struct conditional<false, T, U> { typedef U type; };
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <bool b, class T, class U> using conditional_t = typename conditional<b, T, U>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
|
@ -29,6 +29,12 @@ public:
|
||||
typedef typename boost::conditional<boost::is_volatile<U>::value, typename boost::add_volatile<CT>::type, CT>::type type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T, class U> using copy_cv_t = typename copy_cv<T, U>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_TYPE_TRAITS_COPY_CV_HPP_INCLUDED
|
||||
|
@ -37,6 +37,12 @@ namespace boost
|
||||
typedef typename boost::detail::decay_imp<Ty, boost::is_array<Ty>::value, boost::is_function<Ty>::value>::type type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using decay_t = typename decay<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
|
@ -14,6 +14,12 @@ namespace boost {
|
||||
template<> struct floating_point_promotion<float volatile>{ typedef double volatile type; };
|
||||
template<> struct floating_point_promotion<float const volatile> { typedef double const volatile type; };
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using floating_point_promotion_t = typename floating_point_promotion<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif // #ifndef FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED
|
||||
|
@ -175,6 +175,12 @@ public:
|
||||
typedef typename boost::type_traits::detail::integral_promotion<T, tag_type::value>::type type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using integral_promotion_t = typename integral_promotion<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif // #ifndef FILE_boost_type_traits_integral_promotion_hpp_INCLUDED
|
||||
|
@ -125,6 +125,12 @@ public:
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using make_signed_t = typename make_signed<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED
|
||||
|
@ -124,6 +124,12 @@ public:
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using make_unsigned_t = typename make_unsigned<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_ADD_REFERENCE_HPP_INCLUDED
|
||||
|
@ -14,6 +14,12 @@ namespace boost {
|
||||
|
||||
template<class T> struct promote : public integral_promotion<typename floating_point_promotion<T>::type>{};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using promote_t = typename promote<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif // #ifndef FILE_boost_type_traits_promote_hpp_INCLUDED
|
||||
|
@ -30,6 +30,12 @@ template <class T> struct remove_all_extents<T const volatile[]> : public remove
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using remove_all_extents_t = typename remove_all_extents<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED
|
||||
|
@ -28,6 +28,12 @@ namespace boost {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using remove_const_t = typename remove_const<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_REMOVE_CONST_HPP_INCLUDED
|
||||
|
@ -34,6 +34,11 @@ template <class T> struct remove_cv<T volatile[]>{ typedef T type[]; };
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using remove_cv_t = typename remove_cv<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
@ -30,6 +30,12 @@ template <typename T> struct remove_extent<T const volatile[]> { typedef T const
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using remove_extent_t = typename remove_extent<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_REMOVE_BOUNDS_HPP_INCLUDED
|
||||
|
@ -72,6 +72,12 @@ template <class T> struct remove_pointer<T*const volatile>{ typedef T type; };
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using remove_pointer_t = typename remove_pointer<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_REMOVE_POINTER_HPP_INCLUDED
|
||||
|
@ -48,6 +48,11 @@ template <class T> struct remove_reference<T&volatile>{ typedef T type; };
|
||||
template <class T> struct remove_reference<T&const volatile>{ typedef T type; };
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using remove_reference_t = typename remove_reference<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
@ -28,6 +28,11 @@ namespace boost {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
template <class T> using remove_volatile_t = typename remove_volatile<T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
Reference in New Issue
Block a user