mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-22 19:32:39 +02:00
Add C++ only R_CATCH_MANY helper.
This commit is contained in:
parent
ee05e2d91a
commit
05c58ef002
@ -56,3 +56,19 @@ extern "C" {
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// For C++, also define R_CATCH_MANY helper.
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
template<Result... rs>
|
||||||
|
constexpr inline bool _CheckResultsForMultiTryCatch(const Result &rc) {
|
||||||
|
static_assert((R_FAILED(rs) && ...), "Multi try catch result must be constexpr error Result!");
|
||||||
|
return ((rs == rc) || ...);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define R_CATCH_MANY(...) \
|
||||||
|
} else if (_CheckResultsForMultiTryCatch<__VA_ARGS__>(_tmp_r_try_catch_rc)) { \
|
||||||
|
if (false) { } \
|
||||||
|
else
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user