Implement is_error_code_v and is_error_condition_v for c++17. Rework the tests for is_error_code and is_error_condition, since they were really lacking. Thanks to Alisdair for the heads-up that we were missing these.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@282331 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/system_error b/include/system_error
index 5145d23..faaeaa0 100644
--- a/include/system_error
+++ b/include/system_error
@@ -46,6 +46,12 @@
template <class T> struct is_error_condition_enum
: public false_type {};
+template <class _Tp>
+constexpr size_t is_error_condition_enum_v = is_error_condition_enum<_Tp>::value; // C++17
+
+template <class _Tp>
+constexpr size_t is_error_code_enum_v = is_error_code_enum<_Tp>::value; // C++17
+
class error_code
{
public:
@@ -236,12 +242,22 @@
struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum
: public false_type {};
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+constexpr size_t is_error_code_enum_v = is_error_code_enum<_Tp>::value;
+#endif
+
// is_error_condition_enum
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY is_error_condition_enum
: public false_type {};
+#if _LIBCPP_STD_VER > 14
+template <class _Tp>
+constexpr size_t is_error_condition_enum_v = is_error_condition_enum<_Tp>::value;
+#endif
+
// Some error codes are not present on all platforms, so we provide equivalents
// for them: