diff --git a/include/gsl_assert.h b/include/gsl_assert.h index 81cfd13..51e8ab6 100644 --- a/include/gsl_assert.h +++ b/include/gsl_assert.h @@ -20,6 +20,7 @@ #define GSL_CONTRACTS_H #include +#include // // There are three configuration options for this GSL implementation's behavior @@ -42,10 +43,6 @@ // GSL.assert: assertions // -#if defined(GSL_THROW_ON_CONTRACT_VIOLATION) - -#include - namespace gsl { struct fail_fast : public std::runtime_error @@ -54,6 +51,8 @@ struct fail_fast : public std::runtime_error }; } +#if defined(GSL_THROW_ON_CONTRACT_VIOLATION) + #define Expects(cond) if (!(cond)) \ throw gsl::fail_fast("GSL: Precondition failure at " __FILE__ ": " GSL_STRINGIFY(__LINE__)); #define Ensures(cond) if (!(cond)) \