Fix: Issue: #267 gsl::fail_fast only defined for one configuration

This commit is contained in:
galik 2016-02-16 00:57:04 +00:00
parent 0be53d99ef
commit 1843b1739e

View File

@ -20,6 +20,7 @@
#define GSL_CONTRACTS_H
#include <exception>
#include <stdexcept>
//
// 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 <stdexcept>
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)) \