diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..3d5d4608 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vs +CMakeSettings.json +out diff --git a/include/experimental/__p0009_bits/config.hpp b/include/experimental/__p0009_bits/config.hpp index aaa4a156..2eb9ba4d 100644 --- a/include/experimental/__p0009_bits/config.hpp +++ b/include/experimental/__p0009_bits/config.hpp @@ -55,11 +55,19 @@ # include #endif +#ifdef _MSVC_LANG +#define _MDSPAN_CPLUSPLUS _MSVC_LANG +#else +#define _MDSPAN_CPLUSPLUS __cplusplus +#endif + +static_assert(_MDSPAN_CPLUSPLUS >= 201102L, "MDSpan requires C++11 or later."); + #define MDSPAN_CXX_STD_14 201402L #define MDSPAN_CXX_STD_17 201703L -#define MDSPAN_HAS_CXX_14 (__cplusplus >= MDSPAN_CXX_STD_14) -#define MDSPAN_HAS_CXX_17 (__cplusplus >= MDSPAN_CXX_STD_17) +#define MDSPAN_HAS_CXX_14 (_MDSPAN_CPLUSPLUS >= MDSPAN_CXX_STD_14) +#define MDSPAN_HAS_CXX_17 (_MDSPAN_CPLUSPLUS >= MDSPAN_CXX_STD_17) #ifdef __apple_build_version__ # define _MDSPAN_COMPILER_APPLECLANG diff --git a/include/experimental/__p0009_bits/extents.hpp b/include/experimental/__p0009_bits/extents.hpp index b4dce317..8915f6ab 100644 --- a/include/experimental/__p0009_bits/extents.hpp +++ b/include/experimental/__p0009_bits/extents.hpp @@ -282,7 +282,7 @@ class extents MDSPAN_INLINE_FUNCTION static constexpr index_type __static_extent() noexcept { - return __base_t::__stored_type::template __get_static_n(); + return __storage_t::template __get_static_n(); } }; diff --git a/include/experimental/__p0009_bits/no_unique_address.hpp b/include/experimental/__p0009_bits/no_unique_address.hpp index f509cd79..5ebbecc6 100644 --- a/include/experimental/__p0009_bits/no_unique_address.hpp +++ b/include/experimental/__p0009_bits/no_unique_address.hpp @@ -75,7 +75,19 @@ struct __no_unique_address_emulation< // If the type isn't trivially destructible, its destructor // won't be called at the right time, so don't use this // specialization - _MDSPAN_TRAIT(is_trivially_destructible, _T)>> : private _T { + _MDSPAN_TRAIT(is_trivially_destructible, _T)>> : +#ifdef _MSC_VER + // MSVC doesn't allow you to access public static member functions of a type + // when you *happen* to privately inherit from that type. + protected +#else + // But we still want this to be private if possible so that we don't accidentally + // access members of _T directly rather than calling __ref() first, which wouldn't + // work if _T happens to be stateful and thus we're using the unspecialized definition + // of __no_unique_address_emulation above. + private +#endif + _T { using __stored_type = _T; MDSPAN_FORCE_INLINE_FUNCTION constexpr _T const &__ref() const noexcept { return *static_cast<_T const *>(this); diff --git a/include/experimental/__p0009_bits/standard_layout_static_array.hpp b/include/experimental/__p0009_bits/standard_layout_static_array.hpp index aa9a8be5..7ca950d0 100644 --- a/include/experimental/__p0009_bits/standard_layout_static_array.hpp +++ b/include/experimental/__p0009_bits/standard_layout_static_array.hpp @@ -83,7 +83,6 @@ template