mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 12:02:36 +08:00
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:
@@ -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:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user