diff --git a/include/xtensor/containers/xfixed.hpp b/include/xtensor/containers/xfixed.hpp index 54270caa7..e1b02867d 100644 --- a/include/xtensor/containers/xfixed.hpp +++ b/include/xtensor/containers/xfixed.hpp @@ -256,12 +256,7 @@ namespace xt using inner_backstrides_type = backstrides_type; // NOTE: 0D (S::size() == 0) results in storage for 1 element (scalar) -#if defined(_MSC_VER) && _MSC_VER < 1910 && !defined(_WIN64) - // WORKAROUND FOR MSVC 2015 32 bit, fallback to unaligned container for 0D scalar case - using storage_type = std::array::value>; -#else using storage_type = aligned_array::value>; -#endif using reference = typename storage_type::reference; using const_reference = typename storage_type::const_reference; diff --git a/include/xtensor/containers/xstorage.hpp b/include/xtensor/containers/xstorage.hpp index af96f002b..62b2e4a35 100644 --- a/include/xtensor/containers/xstorage.hpp +++ b/include/xtensor/containers/xstorage.hpp @@ -649,13 +649,9 @@ namespace xt using reverse_iterator = std::reverse_iterator; using const_reverse_iterator = std::reverse_iterator; -#if defined(_MSC_VER) && _MSC_VER < 1910 - static constexpr std::size_t alignment = detail::allocator_alignment::value; -#else static constexpr std::size_t alignment = detail::allocator_alignment::value != 0 ? detail::allocator_alignment::value : alignof(T); -#endif svector() noexcept; ~svector(); diff --git a/include/xtensor/core/xiterable.hpp b/include/xtensor/core/xiterable.hpp index d0caf9d6f..14d386207 100644 --- a/include/xtensor/core/xiterable.hpp +++ b/include/xtensor/core/xiterable.hpp @@ -322,21 +322,6 @@ namespace xt static constexpr layout_type static_layout = inner_types::layout; -#if defined(_MSC_VER) && _MSC_VER >= 1910 - // Workaround for compiler bug in Visual Studio 2017 with respect to alias templates with non-type - // parameters. - template - using layout_iterator = xiterator; - template - using const_layout_iterator = xiterator< - typename iterable_base::const_stepper, - typename iterable_base::inner_shape_type*, - L>; - template - using reverse_layout_iterator = std::reverse_iterator>; - template - using const_reverse_layout_iterator = std::reverse_iterator>; -#else template using layout_iterator = typename iterable_base::template layout_iterator; template @@ -345,7 +330,6 @@ namespace xt using reverse_layout_iterator = typename iterable_base::template reverse_layout_iterator; template using const_reverse_layout_iterator = typename iterable_base::template const_reverse_layout_iterator; -#endif template using broadcast_iterator = typename iterable_base::template broadcast_iterator; diff --git a/include/xtensor/core/xmath.hpp b/include/xtensor/core/xmath.hpp index 77f864929..315e13a82 100644 --- a/include/xtensor/core/xmath.hpp +++ b/include/xtensor/core/xmath.hpp @@ -1088,31 +1088,6 @@ namespace xt return xfunction_type(detail::lambda_adapt(std::forward(lambda)), std::forward(args)...); } -// Workaround for MSVC 2015 & GCC 4.9 -#if (defined(_MSC_VER) && _MSC_VER < 1910) || (defined(__GNUC__) && __GNUC__ < 5) -#define XTENSOR_DISABLE_LAMBDA_FCT -#endif - -#ifdef XTENSOR_DISABLE_LAMBDA_FCT - struct square_fct - { - template - auto operator()(T x) const -> decltype(x * x) - { - return x * x; - } - }; - - struct cube_fct - { - template - auto operator()(T x) const -> decltype(x * x * x) - { - return x * x * x; - } - }; -#endif - /** * @ingroup pow_functions * @brief Square power function, equivalent to e1 * e1. @@ -1125,15 +1100,11 @@ namespace xt template inline auto square(E1&& e1) noexcept { -#ifdef XTENSOR_DISABLE_LAMBDA_FCT - return make_lambda_xfunction(square_fct{}, std::forward(e1)); -#else auto fnct = [](auto x) -> decltype(x * x) { return x * x; }; return make_lambda_xfunction(std::move(fnct), std::forward(e1)); -#endif } /** @@ -1148,19 +1119,13 @@ namespace xt template inline auto cube(E1&& e1) noexcept { -#ifdef XTENSOR_DISABLE_LAMBDA_FCT - return make_lambda_xfunction(cube_fct{}, std::forward(e1)); -#else auto fnct = [](auto x) -> decltype(x * x * x) { return x * x * x; }; return make_lambda_xfunction(std::move(fnct), std::forward(e1)); -#endif } -#undef XTENSOR_DISABLE_LAMBDA_FCT - namespace detail { // Thanks to Matt Pharr in http://pbrt.org/hair.pdf diff --git a/include/xtensor/core/xvectorize.hpp b/include/xtensor/core/xvectorize.hpp index 053d7c92b..edd199021 100644 --- a/include/xtensor/core/xvectorize.hpp +++ b/include/xtensor/core/xvectorize.hpp @@ -54,14 +54,9 @@ namespace xt template xvectorizer vectorize(F&& f, R (*)(Args...)); -// Workaround for Visual Studio 15.7.1. -// Error C2668 (ambiguous call to overloaded function) mistaking a declarations -// for the definition of another overload. -#ifndef _MSC_VER template auto vectorize(F&& f) -> decltype(vectorize(std::forward(f), std::declval*>())); -#endif /****************************** * xvectorizer implementation * diff --git a/include/xtensor/generators/xbuilder.hpp b/include/xtensor/generators/xbuilder.hpp index 5ba9f7a36..d6bb27d31 100644 --- a/include/xtensor/generators/xbuilder.hpp +++ b/include/xtensor/generators/xbuilder.hpp @@ -954,17 +954,10 @@ namespace xt template inline auto meshgrid_impl(std::index_sequence, E&&... e) noexcept { -#if defined _MSC_VER - const std::array shape = {e.shape()[0]...}; - return std::make_tuple( - detail::make_xgenerator(detail::repeat_impl>(std::forward(e), I), shape)... - ); -#else return std::make_tuple(detail::make_xgenerator( detail::repeat_impl>(std::forward(e), I), {e.shape()[0]...} )...); -#endif } } diff --git a/include/xtensor/io/xinfo.hpp b/include/xtensor/io/xinfo.hpp index f78cc3c76..478569cc7 100644 --- a/include/xtensor/io/xinfo.hpp +++ b/include/xtensor/io/xinfo.hpp @@ -14,49 +14,21 @@ #include "../core/xlayout.hpp" -#ifndef _MSC_VER -#if __cplusplus < 201103 -#define CONSTEXPR11_TN -#define CONSTEXPR14_TN -#define NOEXCEPT_TN -#elif __cplusplus < 201402 -#define CONSTEXPR11_TN constexpr -#define CONSTEXPR14_TN -#define NOEXCEPT_TN noexcept -#else -#define CONSTEXPR11_TN constexpr -#define CONSTEXPR14_TN constexpr -#define NOEXCEPT_TN noexcept -#endif -#else // _MSC_VER -#if _MSC_VER < 1900 -#define CONSTEXPR11_TN -#define CONSTEXPR14_TN -#define NOEXCEPT_TN -#elif _MSC_VER < 2000 -#define CONSTEXPR11_TN constexpr -#define CONSTEXPR14_TN -#define NOEXCEPT_TN noexcept -#else -#define CONSTEXPR11_TN constexpr -#define CONSTEXPR14_TN constexpr -#define NOEXCEPT_TN noexcept -#endif -#endif - namespace xt { // see http://stackoverflow.com/a/20170989 struct static_string { template - explicit CONSTEXPR11_TN static_string(const char (&a)[N]) NOEXCEPT_TN : data(a), - size(N - 1) + explicit constexpr static_string(const char (&a)[N]) noexcept + : data(a) + , size(N - 1) { } - CONSTEXPR11_TN static_string(const char* a, const std::size_t sz) NOEXCEPT_TN : data(a), - size(sz) + constexpr static_string(const char* a, const std::size_t sz) noexcept + : data(a) + , size(sz) { } @@ -65,18 +37,14 @@ namespace xt }; template - CONSTEXPR14_TN static_string type_name() + constexpr static_string type_name() { #ifdef __clang__ static_string p(__PRETTY_FUNCTION__); return static_string(p.data + 39, p.size - 39 - 1); #elif defined(__GNUC__) static_string p(__PRETTY_FUNCTION__); -#if __cplusplus < 201402 - return static_string(p.data + 36, p.size - 36 - 1); -#else return static_string(p.data + 54, p.size - 54 - 1); -#endif #elif defined(_MSC_VER) static const static_string p(__FUNCSIG__); return static_string(p.data + 47, p.size - 47 - 7); diff --git a/include/xtensor/utils/xutils.hpp b/include/xtensor/utils/xutils.hpp index 5a3e2af14..ca9fb0942 100644 --- a/include/xtensor/utils/xutils.hpp +++ b/include/xtensor/utils/xutils.hpp @@ -28,12 +28,6 @@ #include "../core/xtensor_config.hpp" -#if (defined(_MSC_VER) && _MSC_VER >= 1910) -#define NOEXCEPT(T) -#else -#define NOEXCEPT(T) noexcept(T) -#endif - namespace xt { /**************** @@ -53,7 +47,7 @@ namespace xt constexpr decltype(auto) argument(Args&&... args) noexcept; template - R apply(std::size_t index, F&& func, const std::tuple& s) NOEXCEPT(noexcept(func(std::get<0>(s)))); + R apply(std::size_t index, F&& func, const std::tuple& s) noexcept(noexcept(func(std::get<0>(s)))); template void nested_copy(T&& iter, const S& s); @@ -198,7 +192,7 @@ namespace xt * accumulate implementation * *****************************/ - /// @cond DOXYGEN_INCLUDE_NOEXCEPT + /// @cond DOXYGEN_INCLUDE_noexcept namespace detail { @@ -266,8 +260,8 @@ namespace xt ************************/ template - inline R apply(std::size_t index, F&& func, const std::tuple& s) - NOEXCEPT(noexcept(func(std::get<0>(s)))) + inline R + apply(std::size_t index, F&& func, const std::tuple& s) noexcept(noexcept(func(std::get<0>(s)))) { XTENSOR_ASSERT(sizeof...(S) > index); return std::apply( diff --git a/test/test_xdatesupport.cpp b/test/test_xdatesupport.cpp index 6c5894be7..33cd7ee46 100644 --- a/test/test_xdatesupport.cpp +++ b/test/test_xdatesupport.cpp @@ -55,8 +55,6 @@ namespace xt EXPECT_EQ((result < result2), expected); } -// need to wait until the system clock on Windows catches up with Linux -#ifndef _MSC_VER TEST(xdate, date_arange) { xarray tarr = xt::arange( @@ -66,7 +64,6 @@ namespace xt ); EXPECT_TRUE(tarr.storage().back() > tarr.storage().front()); } -#endif TEST(xdate, xfunction) { diff --git a/test/test_xfunction.cpp b/test/test_xfunction.cpp index 05c869517..69426d22d 100644 --- a/test/test_xfunction.cpp +++ b/test/test_xfunction.cpp @@ -480,21 +480,13 @@ namespace xt auto f1 = 2.0 * x; auto f2 = x * 2.0 * x; iterator_tester(f1); -// For an unknown reason, MSVC cannot correctly generate -// linear_cbegin() for a function of function. Moreover, -// a simple SFINAE deduction like has_linear_iterator -// harcoded and tested here fails (while it builds fine in any -// empty project) -#ifndef _MSC_VER iterator_tester(f2); iterator_tester(x * y * 3.0); iterator_tester(5.0 + x * y * 3.0); iterator_tester(x * y * z); iterator_tester(x / y / z); -#endif } -#ifndef _MSC_VER TEST(xfunction, xfunction_in_xfunction) { using Point3 = xt::xtensor_fixed>; @@ -507,5 +499,4 @@ namespace xt xtensor res{r1, r2, r3}; EXPECT_EQ(c, res); } -#endif } diff --git a/test/test_xutils.cpp b/test/test_xutils.cpp index 62df3144e..e46a883c8 100644 --- a/test/test_xutils.cpp +++ b/test/test_xutils.cpp @@ -113,11 +113,7 @@ namespace xt return i; }; auto t = std::make_tuple(1, 2, 3); -#if (_MSC_VER >= 1910) - static_assert(!noexcept(apply(1, func_ne, t))); -#else static_assert(noexcept(apply(1, func_ne, t))); -#endif } TEST(utils, conditional_cast)