Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions include/xtensor/containers/xfixed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ET, detail::fixed_compute_size<S>::value>;
#else
using storage_type = aligned_array<ET, detail::fixed_compute_size<S>::value>;
#endif

using reference = typename storage_type::reference;
using const_reference = typename storage_type::const_reference;
Expand Down
4 changes: 0 additions & 4 deletions include/xtensor/containers/xstorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,9 @@ namespace xt
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;

#if defined(_MSC_VER) && _MSC_VER < 1910
static constexpr std::size_t alignment = detail::allocator_alignment<A>::value;
#else
static constexpr std::size_t alignment = detail::allocator_alignment<A>::value != 0
? detail::allocator_alignment<A>::value
: alignof(T);
#endif

svector() noexcept;
~svector();
Expand Down
16 changes: 0 additions & 16 deletions include/xtensor/core/xiterable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <layout_type L>
using layout_iterator = xiterator<typename iterable_base::stepper, typename iterable_base::inner_shape_type*, L>;
template <layout_type L>
using const_layout_iterator = xiterator<
typename iterable_base::const_stepper,
typename iterable_base::inner_shape_type*,
L>;
template <layout_type L>
using reverse_layout_iterator = std::reverse_iterator<layout_iterator<L>>;
template <layout_type L>
using const_reverse_layout_iterator = std::reverse_iterator<const_layout_iterator<L>>;
#else
template <layout_type L>
using layout_iterator = typename iterable_base::template layout_iterator<L>;
template <layout_type L>
Expand All @@ -345,7 +330,6 @@ namespace xt
using reverse_layout_iterator = typename iterable_base::template reverse_layout_iterator<L>;
template <layout_type L>
using const_reverse_layout_iterator = typename iterable_base::template const_reverse_layout_iterator<L>;
#endif

template <class S, layout_type L>
using broadcast_iterator = typename iterable_base::template broadcast_iterator<S, L>;
Expand Down
35 changes: 0 additions & 35 deletions include/xtensor/core/xmath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,31 +1088,6 @@ namespace xt
return xfunction_type(detail::lambda_adapt<F>(std::forward<F>(lambda)), std::forward<E>(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 <class T>
auto operator()(T x) const -> decltype(x * x)
{
return x * x;
}
};

struct cube_fct
{
template <class T>
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.
Expand All @@ -1125,15 +1100,11 @@ namespace xt
template <class E1>
inline auto square(E1&& e1) noexcept
{
#ifdef XTENSOR_DISABLE_LAMBDA_FCT
return make_lambda_xfunction(square_fct{}, std::forward<E1>(e1));
#else
auto fnct = [](auto x) -> decltype(x * x)
{
return x * x;
};
return make_lambda_xfunction(std::move(fnct), std::forward<E1>(e1));
#endif
}

/**
Expand All @@ -1148,19 +1119,13 @@ namespace xt
template <class E1>
inline auto cube(E1&& e1) noexcept
{
#ifdef XTENSOR_DISABLE_LAMBDA_FCT
return make_lambda_xfunction(cube_fct{}, std::forward<E1>(e1));
#else
auto fnct = [](auto x) -> decltype(x * x * x)
{
return x * x * x;
};
return make_lambda_xfunction(std::move(fnct), std::forward<E1>(e1));
#endif
}

#undef XTENSOR_DISABLE_LAMBDA_FCT

namespace detail
{
// Thanks to Matt Pharr in http://pbrt.org/hair.pdf
Expand Down
5 changes: 0 additions & 5 deletions include/xtensor/core/xvectorize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,9 @@ namespace xt
template <class F, class R, class... Args>
xvectorizer<F, R> 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 <class F>
auto vectorize(F&& f)
-> decltype(vectorize(std::forward<F>(f), std::declval<detail::get_function_type<F>*>()));
#endif

/******************************
* xvectorizer implementation *
Expand Down
7 changes: 0 additions & 7 deletions include/xtensor/generators/xbuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,17 +954,10 @@ namespace xt
template <std::size_t... I, class... E>
inline auto meshgrid_impl(std::index_sequence<I...>, E&&... e) noexcept
{
#if defined _MSC_VER
const std::array<std::size_t, sizeof...(E)> shape = {e.shape()[0]...};
return std::make_tuple(
detail::make_xgenerator(detail::repeat_impl<xclosure_t<E>>(std::forward<E>(e), I), shape)...
);
#else
return std::make_tuple(detail::make_xgenerator(
detail::repeat_impl<xclosure_t<E>>(std::forward<E>(e), I),
{e.shape()[0]...}
)...);
#endif
}
}

Expand Down
46 changes: 7 additions & 39 deletions include/xtensor/io/xinfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <std::size_t N>
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)
{
}

Expand All @@ -65,18 +37,14 @@ namespace xt
};

template <class T>
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);
Expand Down
14 changes: 4 additions & 10 deletions include/xtensor/utils/xutils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/****************
Expand All @@ -53,7 +47,7 @@ namespace xt
constexpr decltype(auto) argument(Args&&... args) noexcept;

template <class R, class F, class... S>
R apply(std::size_t index, F&& func, const std::tuple<S...>& s) NOEXCEPT(noexcept(func(std::get<0>(s))));
R apply(std::size_t index, F&& func, const std::tuple<S...>& s) noexcept(noexcept(func(std::get<0>(s))));

template <class T, class S>
void nested_copy(T&& iter, const S& s);
Expand Down Expand Up @@ -198,7 +192,7 @@ namespace xt
* accumulate implementation *
*****************************/

/// @cond DOXYGEN_INCLUDE_NOEXCEPT
/// @cond DOXYGEN_INCLUDE_noexcept

namespace detail
{
Expand Down Expand Up @@ -266,8 +260,8 @@ namespace xt
************************/

template <class R, class F, class... S>
inline R apply(std::size_t index, F&& func, const std::tuple<S...>& s)
NOEXCEPT(noexcept(func(std::get<0>(s))))
inline R
apply(std::size_t index, F&& func, const std::tuple<S...>& s) noexcept(noexcept(func(std::get<0>(s))))
{
XTENSOR_ASSERT(sizeof...(S) > index);
return std::apply(
Expand Down
3 changes: 0 additions & 3 deletions test/test_xdatesupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<tp> tarr = xt::arange<tp>(
Expand All @@ -66,7 +64,6 @@ namespace xt
);
EXPECT_TRUE(tarr.storage().back() > tarr.storage().front());
}
#endif

TEST(xdate, xfunction)
{
Expand Down
9 changes: 0 additions & 9 deletions test/test_xfunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double, xshape<3>>;
Expand All @@ -507,5 +499,4 @@ namespace xt
xtensor<Point3, 1> res{r1, r2, r3};
EXPECT_EQ(c, res);
}
#endif
}
4 changes: 0 additions & 4 deletions test/test_xutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ namespace xt
return i;
};
auto t = std::make_tuple(1, 2, 3);
#if (_MSC_VER >= 1910)
static_assert(!noexcept(apply<int>(1, func_ne, t)));
#else
static_assert(noexcept(apply<int>(1, func_ne, t)));
#endif
}

TEST(utils, conditional_cast)
Expand Down
Loading