Provides () - help reference library

I am trying to figure out how to use Ensures()in code. As indicated in the example , if I tried to use Ensures()as follows ...

int main(void)
{
    int result = 0;
    // Some calculation
    Ensures(result == 255);
    return 0;
}

If the variable is resultnot equal 255, the program crashes with the next output "terminate called without an active exception". My question is: how to use it correctly Ensures()?

+4
source share
1 answer

Microsoft GSL? , gsl_assert.h, , GSL_TERMINATE_ON_CONTRACT_VIOLATION ( ), Ensures std::terminate, , .

, ( ), GSL_THROW_ON_CONTRACT_VIOLATION, GSL.

, Ensures , , .

+7

All Articles