mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Merge pull request #268 from galik/master
Fix: Issue: #267 gsl::fail_fast only defined for one configuration
This commit is contained in:
commit
5ae7e71f09
@ -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)) \
|
||||
|
Loading…
Reference in New Issue
Block a user