From 1843b1739e30393f9a05693d4c4176eb7fe0aa83 Mon Sep 17 00:00:00 2001 From: galik Date: Tue, 16 Feb 2016 00:57:04 +0000 Subject: [PATCH] Fix: Issue: #267 gsl::fail_fast only defined for one configuration --- include/gsl_assert.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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)) \