#include <iostream>
#include <functional>
 
#define CALL_TILL_FALIURE sequence_call_till_failure()
 
class sequence_call_till_failure
{
    bool success;
public:    
    sequence_call_till_failure() : success(false) { }
    
    template < typename Func, typename... Args >
    sequence_call_till_failure&
    operator()( Func func, Args... args ) {
        
        if( !success )
            success = success || func( std::forward<Args>(args)... );
            
        return *this;
    }
    
    operator bool() const {
        return success;
    }
};
 
bool PlanA() { std::cout << __FUNCTION__ << std::endl; return false; }
bool PlanB() { std::cout << __FUNCTION__ << std::endl; return false; }
bool PlanC() { std::cout << __FUNCTION__ << std::endl; return false; }
bool is_odd( int value ) { std::cout << __FUNCTION__ << std::endl; return value % 2 == 1; }
int add( int lhs, int rhs ) { std::cout << __FUNCTION__ << std::endl; return lhs + rhs; }
bool Error() { std::cout << __FUNCTION__ << std::endl; return false; }
 
int main() {
    
    using namespace std;
    
    bool result = CALL_TILL_FALIURE( PlanA )( PlanB )( PlanC )( is_odd, 2 )( add, 2, 3 )( Error );
    
    cout << result << endl;
}