diff options
author | Juan Carlos Arevalo Baeza <jcab@JCABs-Rumblings.com> | 2022-04-27 00:41:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-27 00:41:10 +0300 |
commit | f21f29d210939d4025069576e5891665b001f402 (patch) | |
tree | 8d8bbb524a590c82a402ffe50b29cb3da2068e4c | |
parent | 2bfd4950802a223dde37a08a205812b6dfdfeb61 (diff) |
gsl/narrow should include <exception> (#1044)
This file uses std::exception, so it should include the appropriate header.
Normally it gets the STL's <exception> header included via the gsl/assert file, but this is skipped with _HAS_EXCEPTIONS=0. I understand _HAS_EXCEPTIONS is undocumented and unsupported, but regardless, the appropriate header should be included here.
Alternatively, gsl/narrow should be modified to support _HAS_EXCEPTIONS=0, like gsl/assert was. But I'm not proposing that change. <exception> does define std::exception even with _HAS_EXCEPTIONS=0.
-rw-r--r-- | include/gsl/narrow | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/gsl/narrow b/include/gsl/narrow index 2c3c518..6cb1781 100644 --- a/include/gsl/narrow +++ b/include/gsl/narrow @@ -16,8 +16,9 @@ #ifndef GSL_NARROW_H
#define GSL_NARROW_H
-#include "assert" // for Expects
-#include "util" // for narrow_cast
+#include "assert" // for Expects
+#include "util" // for narrow_cast
+#include <exception> // for std::exception
namespace gsl
{
struct narrowing_error : public std::exception
|