From fc54e0d89a0fff924fc60e0c61bd8d3a83353a9a Mon Sep 17 00:00:00 2001 From: "Jordan Maples [MSFT]" <49793787+JordanMaples@users.noreply.github.com> Date: Mon, 24 Feb 2020 15:49:30 -0800 Subject: [PATCH] just pulling in array header if we detect apple clang --- include/gsl/span | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/include/gsl/span b/include/gsl/span index fc1677e..c13a7c8 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -25,6 +25,24 @@ #include // for reverse_iterator, distance, random_access_... #include // for enable_if_t, declval, is_convertible, inte... +// forward declaring std::array. +// pulling the entire array header is unnecessary for span because array is only used for a few constructors. +// The end user's logic will pull in the actual definition of array if they need it. +// To do: find a way to forward declare array for Apple Clang +#if defined(__APPLE__) +#include +#else +namespace std +{ +template +#if defined(__clang__) +struct array; +#else +class array; +#endif // defined(__clang__) +} +#endif // defined(__APPLE__) + #if defined(_MSC_VER) && !defined(__clang__) #pragma warning(push) @@ -62,26 +80,6 @@ #pragma GCC diagnostic ignored "-Wsign-conversion" #endif -namespace std -{ -// forward declaring std::array. -// array is only used for a few constructors, so pulling the entire header is unnecessary for span. -// The end user's logic will pull in the actual definition of array if they need it. -template -#if defined(__clang__) - -#if defined(__APPLE__) -#define VIS_MOD _LIBCPP_TYPE_VIS_ONLY -#else -#define VIS_MOD -#endif - -struct VIS_MOD array; -#else -class array; -#endif // defined(__clang__) -} - namespace gsl {