Variable templates for type traits (library fundamentals TS) (original) (raw)

Version 1 of the C++ Extensions for Library Fundamentals provides a number of constexpr variable templates for type traits classes, as well as other similar class templates with public ::value members.

Unless otherwise noted, the following variable templates are defined in the std::experimental namespace.

Supported operations
Variable template Value
Defined in header <experimental/type_traits>
template<class T, class... Args> constexpr bool is_constructible_v = std::is_constructible<T, Args...>::value;
template<class T, class... Args> constexpr bool is_trivially_constructible_v = std::is_trivially_constructible<T, Args...>::value;
template<class T, class... Args> constexpr bool is_nothrow_constructible_v = std::is_nothrow_constructible<T, Args...>::value;
template<class T> constexpr bool is_default_constructible_v = std::is_default_constructible<T>::value;
template<class T> constexpr bool is_trivially_default_constructible_v = std::is_trivially_default_constructible<T>::value;
template<class T> constexpr bool is_nothrow_default_constructible_v = std::is_nothrow_default_constructible<T>::value;
template<class T> constexpr bool is_copy_constructible_v = std::is_copy_constructible<T>::value;
template<class T> constexpr bool is_trivially_copy_constructible_v = std::is_trivially_copy_constructible<T>::value;
template<class T> constexpr bool is_nothrow_copy_constructible_v = std::is_nothrow_copy_constructible<T>::value;
template<class T> constexpr bool is_move_constructible_v = std::is_move_constructible<T>::value;
template<class T> constexpr bool is_trivially_move_constructible_v = std::is_trivially_move_constructible<T>::value;
template<class T> constexpr bool is_nothrow_move_constructible_v = std::is_nothrow_move_constructible<T>::value;
template<class T, class U> constexpr bool is_assignable_v = std::is_assignable<T, U>::value;
template<class T, class U> constexpr bool is_trivially_assignable_v = std::is_trivially_assignable<T, U>::value;
template<class T, class U> constexpr bool is_nothrow_assignable_v = std::is_nothrow_assignable<T, U>::value;
template<class T> constexpr bool is_copy_assignable_v = std::is_copy_assignable<T>::value;
template<class T> constexpr bool is_trivially_copy_assignable_v = std::is_trivially_copy_assignable<T>::value;
template<class T> constexpr bool is_nothrow_copy_assignable_v = std::is_nothrow_copy_assignable<T>::value;
template<class T> constexpr bool is_move_assignable_v = std::is_move_assignable<T>::value;
template<class T> constexpr bool is_trivially_move_assignable_v = std::is_trivially_move_assignable<T>::value;
template<class T> constexpr bool is_nothrow_move_assignable_v = std::is_nothrow_move_assignable<T>::value;
template<class T> constexpr bool is_destructible_v = std::is_destructible<T>::value;
template<class T> constexpr bool is_trivially_destructible_v = std::is_trivially_destructible<T>::value;
template<class T> constexpr bool is_nothrow_destructible_v = std::is_nothrow_destructible<T>::value;
template<class T> constexpr bool has_virtual_destructor_v = std::has_virtual_destructor<T>::value;
Property queries
Variable template Value
Defined in header <experimental/type_traits>
template<class T> constexpr std::size_t alignment_of_v = std::alignment_of<T>::value;
template<class T> constexpr std::size_t rank_v = std::rank<T>::value;
template<class T, unsigned I = 0> constexpr std::size_t extent_v = std::extent<T, I>::value;
Type relationships
Variable template Value
Defined in header <experimental/type_traits>
template<class T, class U> constexpr bool is_same_v = std::is_same<T, U>::value;
template<class Base, class Derived> constexpr bool is_base_of_v = std::is_base_of<Base, Derived>::value;
template<class From, class To> constexpr bool is_convertible_v = std::is_convertible<From, To>::value;
Other variable templates
std::ratio comparison
Variable template Value
Defined in header <experimental/ratio>
template<class R1, class R2> constexpr bool ratio_equal_v = std::ratio_equal<R1, R2>::value;
template<class R1, class R2> constexpr bool ratio_not_equal_v = std::ratio_not_equal<R1, R2>::value;
template<class R1, class R2> constexpr bool ratio_less_v = std::ratio_less<R1, R2>::value;
template<class R1, class R2> constexpr bool ratio_less_equal_v = std::ratio_less_equal<R1, R2>::value;
template<class R1, class R2> constexpr bool ratio_greater_v = std::ratio_greater<R1, R2>::value;
template<class R1, class R2> constexpr bool ratio_greater_equal_v = std::ratio_greater_equal<R1, R2>::value;
Miscellaneous
Variable template Value
Defined in header <experimental/tuple>
template<class T> constexpr std::size_t tuple_size_v = std::tuple_size<T>::value;
Defined in header <experimental/chrono>
template<class Rep> constexpr bool treat_as_floating_point_v = std::chrono::treat_as_floating_point<Rep>::value;[1]
Defined in header <experimental/system_error>
template<class T> constexpr bool is_error_code_enum_v = std::is_error_code_enum<T>::value;
template<class T> constexpr bool is_error_condition_enum_v = std::is_error_condition_enum<T>::value;
Defined in header <experimental/functional>
template<class T> constexpr bool is_bind_expression_v = std::is_bind_expression<T>::value;
template<class T> constexpr int is_placeholder_v = std::is_placeholder<T>::value;
Defined in header <experimental/memory>
template<class T, class Alloc> constexpr bool uses_allocator_v = std::uses_allocator<T, Alloc>::value;

[edit] Notes

[1]: Defined in the std::chrono::experimental namespace.