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
This commit is contained in:
Marshall Clow
2016-09-24 17:36:14 +00:00
parent 7dc2fa31af
commit db86684746
5 changed files with 148 additions and 1 deletions

View File

@@ -46,6 +46,12 @@ template <class T> struct is_error_code_enum
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 @@ template <class _Tp>
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: