diff --git a/include/array_view.h b/include/array_view.h index 482666e..bca973a 100644 --- a/include/array_view.h +++ b/include/array_view.h @@ -43,6 +43,10 @@ // VS 2013 workarounds #if _MSC_VER <= 1800 +#pragma push_macro("GSL_MSVC_HAS_VARIADIC_CTOR_BUG") +#define GSL_MSVC_HAS_VARIADIC_CTOR_BUG + + // noexcept is not understood #ifndef GSL_THROWS_FOR_TESTING #define noexcept /* nothing */ @@ -106,9 +110,19 @@ public: std::copy(values, values + Rank, elems); } - template::value, typename Dummy = std::enable_if_t> - constexpr index(Ts... ds) noexcept : elems{ static_cast(ds)... } - {} +#ifdef GSL_MSVC_HAS_VARIADIC_CTOR_BUG + template::value && + details::are_integral::value>> + constexpr index(T t, Ts... ds) : index({ static_cast(t), static_cast(ds)... }) + {} +#else + template::value>> + constexpr index(Ts... ds) noexcept : elems{ static_cast(ds)... } + {} +#endif constexpr index(const index& other) noexcept = default; @@ -1957,6 +1971,10 @@ general_array_view_iterator operator+(typename general_array_view_ite #pragma undef noexcept #endif // GSL_THROWS_FOR_TESTING +#undef GSL_MSVC_HAS_VARIADIC_CTOR_BUG +#pragma pop_macro("GSL_MSVC_HAS_VARIADIC_CTOR_BUG") + + #endif // _MSC_VER <= 1800 #endif // _MSC_VER