diff --git a/include/__functional_base b/include/__functional_base index 1a08ea29d..82b414674 100644 --- a/include/__functional_base +++ b/include/__functional_base @@ -625,6 +625,11 @@ struct _LIBCPP_TYPE_VIS_ONLY uses_allocator { }; +#if _LIBCPP_STD_VER > 14 +template +constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value; +#endif + #ifndef _LIBCPP_HAS_NO_VARIADICS // allocator construction diff --git a/include/functional b/include/functional index d0b65b29a..aec609234 100644 --- a/include/functional +++ b/include/functional @@ -212,6 +212,13 @@ template unspecified not_fn(F&& f); // C++17 template struct is_bind_expression; template struct is_placeholder; + // See C++14 20.9.9, Function object binders +template constexpr bool is_bind_expression_v + = is_bind_expression::value; // C++17 +template constexpr int is_placeholder_v + = is_placeholder::value; // C++17 + + template unspecified bind(Fn&&, BoundArgs&&...); template @@ -1970,10 +1977,20 @@ template struct __is_bind_expression : public false_type {}; template struct _LIBCPP_TYPE_VIS_ONLY is_bind_expression : public __is_bind_expression::type> {}; +#if _LIBCPP_STD_VER > 14 +template +constexpr size_t is_bind_expression_v = is_bind_expression<_Tp>::value; +#endif + template struct __is_placeholder : public integral_constant {}; template struct _LIBCPP_TYPE_VIS_ONLY is_placeholder : public __is_placeholder::type> {}; +#if _LIBCPP_STD_VER > 14 +template +constexpr size_t is_placeholder_v = is_placeholder<_Tp>::value; +#endif + namespace placeholders { diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp index 83fa452fe..5d833e288 100644 --- a/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp +++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_bind_expression.pass.cpp @@ -14,12 +14,16 @@ // template struct is_bind_expression #include +#include "test_macros.h" template void test(const T&) { static_assert(std::is_bind_expression::value == Expected, ""); +#if TEST_STD_VER > 14 + static_assert(std::is_bind_expression_v == Expected, ""); +#endif } struct C {}; diff --git a/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp b/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp index 6a52bd184..1d7c649df 100644 --- a/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp +++ b/test/std/utilities/function.objects/bind/func.bind/func.bind.isbind/is_placeholder.pass.cpp @@ -12,12 +12,16 @@ // struct is_placeholder #include +#include "test_macros.h" template void test(const T&) { static_assert(std::is_placeholder::value == Expected, ""); +#if TEST_STD_VER > 14 + static_assert(std::is_placeholder_v == Expected, ""); +#endif } struct C {}; diff --git a/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp b/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp index bd32bc34e..919c56bc7 100644 --- a/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp +++ b/test/std/utilities/memory/allocator.uses/allocator.uses.trait/uses_allocator.pass.cpp @@ -38,16 +38,38 @@ private: typedef int allocator_type; }; -int main() +template +void +test() { - static_assert((!std::uses_allocator >::value), ""); - static_assert(( std::uses_allocator, std::allocator >::value), ""); - static_assert((!std::uses_allocator >::value), ""); - static_assert((!std::uses_allocator >::value), ""); - static_assert(( std::uses_allocator::value), ""); - static_assert((!std::uses_allocator::value), ""); - static_assert((!std::uses_allocator::value), ""); -#if TEST_STD_VER >= 11 - static_assert((!std::uses_allocator::value), ""); + static_assert(std::uses_allocator::value == Expected, ""); +#if TEST_STD_VER > 14 + static_assert(std::uses_allocator_v == Expected, ""); #endif } + +int main() +{ + test >(); + test, std::allocator >(); + test >(); + test >(); + test(); + test(); + test(); +#if TEST_STD_VER >= 11 + test(); +#endif + + +// static_assert((!std::uses_allocator >::value), ""); +// static_assert(( std::uses_allocator, std::allocator >::value), ""); +// static_assert((!std::uses_allocator >::value), ""); +// static_assert((!std::uses_allocator >::value), ""); +// static_assert(( std::uses_allocator::value), ""); +// static_assert((!std::uses_allocator::value), ""); +// static_assert((!std::uses_allocator::value), ""); +// #if TEST_STD_VER >= 11 +// static_assert((!std::uses_allocator::value), ""); +// #endif +}