just pulling in array header if we detect apple clang

This commit is contained in:
Jordan Maples [MSFT] 2020-02-24 15:49:30 -08:00
parent 32e5fea6ac
commit fc54e0d89a

View File

@ -25,6 +25,24 @@
#include <iterator> // for reverse_iterator, distance, random_access_...
#include <type_traits> // 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 <array>
#else
namespace std
{
template <class Type, std::size_t Sz>
#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 <class Type, std::size_t Sz>
#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
{