cstdbool
bool success = function();
if (success) {
// Do something if the function succeeded
} else {
// Handle the failure
}class MyClass {
bool valid;
public:
bool isValid() { return valid; }
};
MyClass obj;
if (obj.isValid()) {
// Do something with the valid object
} else {
// Handle the invalid object
}