nixd
Loading...
Searching...
No Matches
CheckReturn.h File Reference

Go to the source code of this file.

Macros

#define CheckReturn(x, Ret)
 Used for simplify early-returns.
 
#define CheckDefault(x)
 Variant of CheckReturn, but returns default constructed CheckTy
 

Macro Definition Documentation

◆ CheckDefault

#define CheckDefault ( x)
Value:
CheckReturn(x, CheckTy{})
#define CheckReturn(x, Ret)
Used for simplify early-returns.
Definition CheckReturn.h:6

Variant of CheckReturn, but returns default constructed CheckTy

Definition at line 16 of file CheckReturn.h.

◆ CheckReturn

#define CheckReturn ( x,
Ret )
Value:
({ \
decltype(x) temp = (x); \
if (!temp) [[unlikely]] { \
return Ret; \
} \
temp; \
})

Used for simplify early-returns.

const auto *foo = checkReturn(get(), nullptr)

Definition at line 6 of file CheckReturn.h.