还有行为和 std::is_constructible 不一致的地方:
class Test {
~Test() = delete ;
};
std::is_constructible::value ==> false
#include#include template struct is_reference : std::is_same > {}; template inline constexpr bool is_reference_v = ! is_reference ::value ; #if 1 template struct is_constructible_impl : std::false_type {}; template struct is_constructible_impl< void , T&, Args&...> : std::true_type {}; template struct is_constructible_impl< void , T&, Args...> : std::false_type {}; template struct is_constructible_impl< void , T&, Args&&...> : std::false_type {}; //======================================================================= template struct is_constructible_impl< void , T&&, Args...> : std::true_type {}; template struct is_constructible_impl< void , T&&, Args&...> : std::false_type {}; template struct is_constructible_impl< void , T&&, Args&&...> : std::true_type {}; template struct is_constructible_impl ()...) ), void() ) , T, Args...> : std::true_type {}; template struct is_constructible : is_constructible_impl {}; #else using std::is_constructible; #endif // TEST CASE static_assert(is_constructible ::value); static_assert(!is_constructible ::value ); static_assert(is_constructible ::value); static_assert(is_constructible ::value); static_assert(is_constructible ::value); //左侧是左值引用时,右侧只能是左值引用; static_assert(is_constructible ::value); static_assert(!is_constructible ::value); static_assert(!is_constructible ::value); //左侧是右值引用时,右侧不能是左值引用 static_assert(!is_constructible ::value); static_assert( is_constructible ::value); static_assert( is_constructible ::value); static_assert(is_constructible ::value); static_assert(!is_constructible ::value); static_assert(!is_constructible ::value); static_assert(!is_constructible ::value); static_assert(is_constructible ::value);



